helm-charts/forgejo-runner/templates/deployment.yaml

131 lines
4.6 KiB
YAML
Raw Permalink Normal View History

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "forgejo-runner.fullname" . }}
labels:
{{- include "forgejo-runner.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "forgejo-runner.selectorLabels" . | nindent 6 }}
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 }}
serviceAccountName: {{ include "forgejo-runner.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: make-config-writeable
{{- with .Values.image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
command: [ "/bin/cp", "/etc/runner/.runner", "/data/.runner" ]
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: runner-data
mountPath: /data
- name: runner-config
mountPath: /etc/runner
containers:
- name: runner
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag | default $.Chart.AppVersion }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
2024-05-17 15:13:29 +02:00
command:
- "sh"
- "-c"
- |
while ! nc -z 127.0.0.1 2376 </dev/null; do
echo 'waiting for docker daemon...';
sleep 5;
done
/bin/forgejo-runner --config /etc/runner/config.yaml daemon
resources:
{{- toYaml .Values.resources | nindent 12 }}
env:
- name: DOCKER_HOST
value: tcp://127.0.0.1:2376
- name: DOCKER_CERT_PATH
value: /certs/client
- name: DOCKER_TLS_VERIFY
value: "1"
{{- with .Values.extraEnvVars }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: runner-configfile
mountPath: /etc/runner
- name: docker-certs
mountPath: /certs
- name: runner-data
mountPath: /data
- name: dind
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.dind.image }}
image: "{{ coalesce $.Values.global.image.registry .registry }}/{{ .repository }}:{{ .tag }}"
imagePullPolicy: {{ coalesce $.Values.global.image.pullPolicy .pullPolicy }}
{{- end }}
resources:
{{- with .Values.dind.resources }}
{{- toYaml . | nindent 12 }}
{{- else }}
{{- toYaml .Values.resources | nindent 12 }}
{{- end }}
env:
- name: DOCKER_TLS_CERTDIR
value: /certs
volumeMounts:
- name: docker-certs
mountPath: /certs
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
volumes:
- name: docker-certs
emptyDir: {}
- name: runner-data
emptyDir: {}
- name: runner-config
secret:
secretName: {{ .Values.runner.config.existingSecret | default (print ( include "forgejo-runner.fullname" . ) "-config") | quote }}
- name: runner-configfile
secret:
secretName: {{ include "forgejo-runner.fullname" . }}-configfile
{{- with .Values.volumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}