2023-08-17 04:26:35 -05:00
|
|
|
# Secret data.
|
2023-11-27 15:41:09 -06:00
|
|
|
# You will need to retrive this from the web UI, and your Forgejo instance must be running v1.21+
|
2023-08-17 04:26:35 -05:00
|
|
|
# Alternatively, create this with
|
|
|
|
# kubectl create secret generic runner-secret --from-literal=token=your_offline_token_here
|
2023-06-05 03:46:15 -05:00
|
|
|
apiVersion: v1
|
2023-08-17 04:26:35 -05:00
|
|
|
stringData:
|
|
|
|
token: your_offline_secret_here
|
2023-06-05 03:46:15 -05:00
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: runner-secret
|
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
labels:
|
2023-08-26 05:19:06 -05:00
|
|
|
app: forgejo-runner
|
|
|
|
name: forgejo-runner
|
2023-06-05 03:46:15 -05:00
|
|
|
spec:
|
2023-08-17 04:26:35 -05:00
|
|
|
# Two replicas means that if one is busy, the other can pick up jobs.
|
|
|
|
replicas: 2
|
2023-06-05 03:46:15 -05:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
2023-08-26 05:19:06 -05:00
|
|
|
app: forgejo-runner
|
2023-06-05 03:46:15 -05:00
|
|
|
strategy: {}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
creationTimestamp: null
|
|
|
|
labels:
|
2023-08-26 05:19:06 -05:00
|
|
|
app: forgejo-runner
|
2023-06-05 03:46:15 -05:00
|
|
|
spec:
|
|
|
|
restartPolicy: Always
|
|
|
|
volumes:
|
|
|
|
- name: docker-certs
|
|
|
|
emptyDir: {}
|
|
|
|
- name: runner-data
|
2023-08-17 04:26:35 -05:00
|
|
|
emptyDir: {}
|
|
|
|
# Initialise our configuration file using offline registration
|
|
|
|
# https://forgejo.org/docs/v1.21/admin/actions/#offline-registration
|
|
|
|
initContainers:
|
2023-11-27 15:41:09 -06:00
|
|
|
- name: runner-register
|
|
|
|
image: code.forgejo.org/forgejo/runner:3.2.0
|
2023-11-27 19:08:54 -06:00
|
|
|
command: ["forgejo-runner", "register", "--no-interactive", "--token", $(RUNNER_SECRET), "--name", $(RUNNER_NAME), "--instance", $(FORGEJO_INSTANCE_URL)]
|
2023-11-27 15:41:09 -06:00
|
|
|
env:
|
2023-11-27 19:08:54 -06:00
|
|
|
- name: RUNNER_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
2023-11-27 15:41:09 -06:00
|
|
|
- name: RUNNER_SECRET
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
2024-03-29 17:30:30 -05:00
|
|
|
name: runner-secret
|
2023-11-27 15:41:09 -06:00
|
|
|
key: token
|
|
|
|
- name: FORGEJO_INSTANCE_URL
|
|
|
|
value: http://forgejo-http.forgejo.svc.cluster.local:3000
|
|
|
|
resources:
|
|
|
|
limits:
|
|
|
|
cpu: "0.50"
|
|
|
|
memory: "64Mi"
|
|
|
|
volumeMounts:
|
|
|
|
- name: runner-data
|
|
|
|
mountPath: /data
|
2023-06-05 03:46:15 -05:00
|
|
|
containers:
|
|
|
|
- name: runner
|
2023-08-26 05:19:06 -05:00
|
|
|
image: code.forgejo.org/forgejo/runner:3.0.0
|
|
|
|
command: ["sh", "-c", "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner daemon"]
|
2023-06-05 03:46:15 -05:00
|
|
|
env:
|
|
|
|
- name: DOCKER_HOST
|
|
|
|
value: tcp://localhost:2376
|
|
|
|
- name: DOCKER_CERT_PATH
|
|
|
|
value: /certs/client
|
|
|
|
- name: DOCKER_TLS_VERIFY
|
|
|
|
value: "1"
|
|
|
|
volumeMounts:
|
|
|
|
- name: docker-certs
|
|
|
|
mountPath: /certs
|
|
|
|
- name: runner-data
|
|
|
|
mountPath: /data
|
|
|
|
- name: daemon
|
|
|
|
image: docker:23.0.6-dind
|
|
|
|
env:
|
|
|
|
- name: DOCKER_TLS_CERTDIR
|
|
|
|
value: /certs
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: docker-certs
|
|
|
|
mountPath: /certs
|