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