apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "forgejo-runner.fullname" . }} labels: {{- include "forgejo-runner.labels" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "forgejo-runner.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.podAnnotations }} annotations: {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "forgejo-runner.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} serviceAccountName: {{ include "forgejo-runner.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: {{ .Chart.Name }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: - "/bin/sh" - "-c" - | cd /data # Setup Podman environment for rootless containers export XDG_RUNTIME_DIR="/tmp/runtime-runner" mkdir -p $XDG_RUNTIME_DIR ~/.config/containers ~/.local/share/containers chmod 0700 $XDG_RUNTIME_DIR # Create subuid/subgid for rootless containers echo "1000:100000:65536" > /tmp/subuid echo "1000:100000:65536" > /tmp/subgid export SUBUID_FILE=/tmp/subuid export SUBGID_FILE=/tmp/subgid echo "Testing Podman setup..." podman --version podman info || echo "Podman info failed, continuing..." echo "Registering runner with Forgejo..." /bin/forgejo-runner register \ --no-interactive \ --instance "$FORGEJO_RUNNER_URL" \ --token "$FORGEJO_RUNNER_TOKEN" \ --name "$FORGEJO_RUNNER_NAME" \ --labels "ubuntu-latest:host,ubuntu-22.04:host,node:host,alpine:host" echo "Starting runner..." exec /bin/forgejo-runner daemon --config /etc/forgejo-runner/config.yaml env: - name: FORGEJO_RUNNER_URL value: {{ required "forgejo.url is required" .Values.forgejo.url | quote }} - name: FORGEJO_RUNNER_TOKEN valueFrom: secretKeyRef: name: {{ include "forgejo-runner.fullname" . }}-secret key: token - name: FORGEJO_RUNNER_NAME value: {{ .Values.runner.namePrefix }}-$(hostname) - name: FORGEJO_RUNNER_LABELS value: {{ join "," .Values.runner.labels | quote }} - name: CONTAINER_RUNTIME value: "podman" volumeMounts: - name: runner-data mountPath: /data - name: runner-config mountPath: /etc/forgejo-runner resources: {{- toYaml .Values.resources | nindent 12 }} volumes: - name: runner-data emptyDir: {} - name: runner-config configMap: name: {{ include "forgejo-runner.fullname" . }}-config {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }}