82 lines
2.6 KiB
YAML
82 lines
2.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
labels:
|
|
{{- include "forgejo-runner.labels" . | nindent 4 }}
|
|
name: {{ include "forgejo-runner.fullname" . }}
|
|
spec:
|
|
replicas: {{ .Values.replicaCount }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "forgejo-runner.selectorLabels" . | nindent 6 }}
|
|
strategy: {}
|
|
template:
|
|
metadata:
|
|
{{- with .Values.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "forgejo-runner.labels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
volumes:
|
|
- name: docker-certs
|
|
emptyDir: {}
|
|
- name: runner-data
|
|
emptyDir: {}
|
|
initContainers:
|
|
- name: runner-register
|
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
|
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: {{ include "forgejo-runner.fullname" . }}-token
|
|
key: token
|
|
- name: FORGEJO_INSTANCE_URL
|
|
value: {{ .Values.forgejoUrl }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
volumeMounts:
|
|
- name: runner-data
|
|
mountPath: /data
|
|
containers:
|
|
- name: runner
|
|
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
|
|
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: daemon
|
|
image: docker:23.0.6-dind
|
|
env:
|
|
- name: DOCKER_TLS_CERTDIR
|
|
value: /certs
|
|
securityContext:
|
|
privileged: true
|
|
volumeMounts:
|
|
- name: docker-certs
|
|
mountPath: /certs
|