--- # Second Forgejo Actions runner instance on the Pi, declaring ONLY the # `deploy-arm64` label. # # Why: the Pi's original runner (forgejo-runner-arm64) serves every # `runs-on: docker` job in the instance, so a long onionwire `ci` build (Rust, # 20-40 min) holds the only `docker` slot and any site deploy queued behind it # waits indefinitely - that is exactly how siriusgrowthsolutions.com sat on a # stale page while deploy-site runs stayed in `waiting` (runs 1163/1164). # # Deploys are not CPU-bound the way CI is, so a separate runner instance is # cheap; the labels are disjoint in both directions, so neither class can # starve the other. Keep capacity 1: a deploy must not overlap itself (the Pi # registry tag :latest and the k8s restartedAt patch are last-writer-wins). # # Since the arm64 dind cutover this runner has its own in-pod daemon too, so a # deploy no longer shares the Pi's host Docker with anything. apiVersion: apps/v1 kind: Deployment metadata: name: forgejo-runner-deploy-arm64 namespace: forgejo labels: app: forgejo-runner arch: arm64 role: deploy spec: replicas: 1 selector: matchLabels: app: forgejo-runner role: deploy strategy: type: Recreate template: metadata: labels: app: forgejo-runner arch: arm64 role: deploy spec: nodeSelector: kubernetes.io/hostname: rpi tolerations: - key: dedicated operator: Equal value: network effect: PreferNoSchedule initContainers: # Registration guard, NOT a registration step. The runner's identity # (`runner.ini`, action_runner id 14 / uuid a41aad73-…) is copied onto # the PVC from the Pi host before the first start. The previous version # of this init container registered a *new* runner whenever the file was # missing, which burns a single-use token and leaves a second # action_runner row polling under a new uuid. Refuse instead: a missing # file is an operator error, not something to paper over. - name: require-registration image: code.forgejo.org/forgejo/runner:5.0.1 imagePullPolicy: IfNotPresent securityContext: runAsUser: 0 command: - sh - -c - | set -e if [ ! -s /data/runner.ini ]; then echo "runner.ini missing on the data PVC — refusing to register a second uuid" >&2 echo "restore it: ssh rpi sudo install -m600 -o root -g root /opt/siriusdevops/runner-deploy/data/runner.ini /opt/local-path-provisioner/forgejo-runner-deploy-arm64-dind/runner.ini" >&2 exit 1 fi echo "registration present: $(grep -o '\"uuid\": \"[^\"]*\"' /data/runner.ini)" volumeMounts: - name: data mountPath: /data containers: - name: dind image: docker:27-dind imagePullPolicy: IfNotPresent command: - sh - -c - | # --insecure-registry: the Pi registry is plain HTTP on the WG # hub IP. Docker only treats 127.0.0.0/8 as insecure by default, # so without this `docker push 10.10.0.1:5000/...` from a job # fails with "server gave HTTP response to HTTPS client". dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 \ --insecure-registry=10.10.0.1:5000 & pid=$! i=0 while [ "$i" -lt 30 ]; do if [ -S /var/run/docker.sock ]; then chmod 666 /var/run/docker.sock break fi i=$((i+1)) sleep 1 done wait "$pid" securityContext: privileged: true volumeMounts: - name: dind-run mountPath: /var/run - name: data mountPath: /var/lib/docker subPath: docker resources: # Deliberately smaller than the shared runner's 4Gi. A deploy is two # nginx-based site images (112-143 MB each) plus buildx's # docker-container driver and one `--platform linux/amd64` cross # build under qemu; nothing like the Rust ci.yml job that peaked at # 3.10 GiB. The Pi has 7.0 GiB available and capacity 1 per runner # bounds each runner but nothing bounds both: 4Gi + 2Gi limits leave # ~1 GiB for kubelet/Cilium/cloudflared/host Docker even if a CI run # and a deploy overlap, and an OOM here fails one deploy visibly. # (A 4Gi deploy limit would let two runners claim every byte.) requests: cpu: 100m memory: 256Mi limits: memory: 2Gi - name: runner image: code.forgejo.org/forgejo/runner:5.0.1 imagePullPolicy: IfNotPresent securityContext: runAsUser: 0 command: - sh - -c - | set -e i=0 while [ "$i" -lt 60 ]; do if [ -S /var/run/docker.sock ]; then break fi i=$((i+1)) sleep 2 done exec forgejo-runner --config /config/config.toml daemon env: - name: DOCKER_HOST value: unix:///var/run/docker.sock volumeMounts: - name: config-toml mountPath: /config/config.toml subPath: deploy-arm64.toml - name: data mountPath: /data - name: dind-run mountPath: /var/run resources: requests: cpu: 50m memory: 128Mi limits: memory: 512Mi volumes: - name: config-toml configMap: name: forgejo-runner-config - name: data persistentVolumeClaim: claimName: forgejo-runner-deploy-arm64-dind - name: dind-run emptyDir: {}