2024-10-03 14:57:06 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
|
|
|
labels:
|
|
|
|
app: forgejo-runner
|
|
|
|
name: forgejo-runner
|
|
|
|
spec:
|
|
|
|
# Two replicas means that if one is busy, the other can pick up jobs.
|
|
|
|
replicas: 1
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
|
|
|
app: forgejo-runner
|
|
|
|
strategy: {}
|
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
creationTimestamp: null
|
|
|
|
labels:
|
|
|
|
app: forgejo-runner
|
|
|
|
spec:
|
|
|
|
restartPolicy: Always
|
|
|
|
volumes:
|
|
|
|
- name: docker-certs
|
|
|
|
emptyDir: {}
|
|
|
|
- name: runner-data
|
|
|
|
emptyDir: {}
|
|
|
|
- name: docker-socket
|
|
|
|
emptyDir: {}
|
|
|
|
# Initialise our configuration file using offline registration
|
|
|
|
# https://forgejo.org/docs/v1.21/admin/actions/#offline-registration
|
|
|
|
initContainers:
|
|
|
|
- name: runner-register
|
|
|
|
image: code.forgejo.org/forgejo/runner:3.2.0
|
|
|
|
command: ["forgejo-runner", "register", "--no-interactive", "--token", $(RUNNER_SECRET), "--name", $(RUNNER_NAME), "--instance", $(FORGEJO_INSTANCE_URL)]
|
|
|
|
env:
|
|
|
|
- name: RUNNER_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: RUNNER_SECRET
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: forgejo-runner-secret
|
|
|
|
key: token
|
|
|
|
- name: FORGEJO_INSTANCE_URL
|
|
|
|
value: http://forgejo.git.svc.cluster.local
|
|
|
|
resources:
|
2024-10-03 15:22:02 +00:00
|
|
|
requests:
|
|
|
|
cpu: 12m
|
|
|
|
memory: 3304504865
|
2024-10-03 14:57:06 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: runner-data
|
|
|
|
mountPath: /data
|
|
|
|
containers:
|
|
|
|
- name: runner
|
|
|
|
image: code.forgejo.org/forgejo/runner:3.2.0
|
|
|
|
command: ["sh", "-c", "while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner daemon"]
|
|
|
|
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: docker-socket
|
|
|
|
mountPath: /var/run
|
|
|
|
- name: daemon
|
|
|
|
image: docker:23.0.6-dind
|
|
|
|
env:
|
|
|
|
- name: DOCKER_TLS_CERTDIR
|
|
|
|
value: /certs
|
|
|
|
securityContext:
|
|
|
|
privileged: true
|
|
|
|
volumeMounts:
|
|
|
|
- name: docker-certs
|
|
|
|
mountPath: /certs
|
|
|
|
- name: docker-socket
|
|
|
|
mountPath: /var/run
|
|
|
|
|