gitops-zurrli/apps/zurrli/forgejo-runner/deployment.yaml

117 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: forgejo-runner
name: forgejo-runner
spec:
replicas: 1
selector:
matchLabels:
app: forgejo-runner
strategy: {}
template:
metadata:
labels:
app: forgejo-runner
spec:
restartPolicy: Always
initContainers:
- name: registration
image: code.forgejo.org/forgejo/runner:3.4.1
command:
[
"sh",
"-c",
"if ! [ -f /data/.runner ]; then forgejo-runner register --no-interactive --token ${RUNNER_REGISTRATION_TOKEN} --labels ${LABELS} --name ${RUNNER_NAME} --instance ${INSTANCE_URL}; fi",
]
env:
- name: INSTANCE_URL
value: https://git.tbrnt.ch/
- name: RUNNER_NAME
value: zurrli-runner
- name: LABELS
value: ubuntu-latest,ubuntu-22.04,docker
- name: RUNNER_REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: runner-secret
key: token
volumeMounts:
- name: docker-certs
mountPath: /certs
- name: runner-data
mountPath: /data
- name: runner-config
mountPath: /config
resources:
limits:
cpu: "1"
memory: "1024Mi"
containers:
- name: runner
image: code.forgejo.org/forgejo/runner:3.4.1
command:
[
"sh",
"-c",
"while ! nc -z localhost 2376 </dev/null; do echo 'waiting for docker daemon...'; sleep 5; done; forgejo-runner daemon --config /config/config.yaml",
]
env:
- name: DOCKER_HOST
value: tcp://localhost:2376
- name: DOCKER_CERT_PATH
value: /certs/client
- name: DOCKER_TLS_VERIFY
value: "1"
- name: GITEA_INSTANCE_URL
value: https://git.tbrnt.ch/
- name: GITEA_RUNNER_NAME
value: zurrli-runner
- name: GITEA_RUNNER_REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: runner-secret
key: token
volumeMounts:
- name: docker-certs
mountPath: /certs
- name: runner-data
mountPath: /data
- name: runner-config
mountPath: /config
resources:
limits:
cpu: "1"
memory: "1024Mi"
- name: daemon
image: docker:24.0.9-dind
env:
- name: DOCKER_TLS_CERTDIR
value: /certs
securityContext:
privileged: true
volumeMounts:
- name: docker-certs
mountPath: /certs
- name: docker-data
mountPath: /var/lib/docker
resources:
limits:
cpu: "2"
memory: "4096Mi"
volumes:
- name: docker-certs
emptyDir: {}
- name: runner-data
persistentVolumeClaim:
claimName: forgejo-runner-vol
- name: docker-data
persistentVolumeClaim:
claimName: docker
- name: runner-config
configMap:
name: runner-config
items:
- key: config.yaml
path: config.yaml