forgejo runners(arm64): run both arm64 runners as in-cluster dind pods

The Pi's host Docker is no longer the arm64 job-container daemon. Both
forgejo-runner-arm64 and forgejo-runner-deploy-arm64 now run a privileged
docker:27-dind sidecar (--mtu=1420, socket on an emptyDir shared with the
runner, data-root on a PVC), the same shape as forgejo-runner-amd64.

- labels preserved verbatim: shared keeps docker-arm64/arm64/docker, deploy
  keeps deploy-arm64 only; capacity 1 on both
- runner.ini moved from hostPath to the data PVC by copy, uuid preserved
  (4e07c1e9... / a41aad73...); the deploy runner's register init container is
  inverted into a guard so a missing file cannot burn a token and create a
  second runner
- dind limits.memory 4Gi (measured peak 3.10GiB) and 2Gi for the deploy runner
  so a CI run and a deploy cannot both claim the Pi's 7GiB
- static hostPath PVs pinned to rpi with Retain: dynamic local-path cannot
  provision there (helper pod hardcoded to siriussec)
- docker CLI/buildx come from the dind image instead of the host's docker-static
- Pi registry additionally published on 10.10.0.1:5000 (out of band on the Pi)
- RpiDindDataRootFillingUp at 70%: the real cap, since a static PV does not
  enforce its claim and kubelet_volume_stats_* does not exist here

Design and measured proof: docs/arm64-runner-dind.md (t_627c231c).
This commit is contained in:
Lance Walters 2026-10-27 02:03:11 -04:00
commit 131b9bc7c9
6 changed files with 359 additions and 125 deletions

View file

@ -12,6 +12,9 @@
# 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:
@ -43,80 +46,106 @@ spec:
operator: Equal
value: network
effect: PreferNoSchedule
securityContext:
supplementalGroups: [984]
initContainers:
# Self-registration, like the amd64 runner. runner.ini lives on the Pi
# host (/opt/siriusdevops/runner-deploy/data) so a pod restart reuses the
# existing registration instead of burning a single-use runner token.
- name: register
# Must be the multi-arch code.forgejo.org image: alex3305/
# forgejo-runner-dind ships an x86-64 binary in its arm64 manifest and
# dies with "exec format error" on the Pi.
# 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
# The hostPath /data dir is created root:root by kubelet, and the
# runner image's default user cannot write runner.ini into it.
securityContext:
runAsUser: 0
runAsGroup: 0
command:
- sh
- -c
- |
set -e
if [ -s /data/runner.ini ]; then
echo already-registered
exit 0
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
forgejo-runner register --no-interactive \
--instance https://forgejo.siriusdevops.com \
--token "$RUNNER_TOKEN" \
--name pi-deploy-arm64 \
--labels 'deploy-arm64:docker://node:20-bullseye' \
--config /config/config.toml
env:
- name: RUNNER_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-runner-deploy-arm64-token
key: token
echo "registration present: $(grep -o '\"uuid\": \"[^\"]*\"' /data/runner.ini)"
volumeMounts:
- name: config-toml
mountPath: /config/config.toml
subPath: deploy-arm64.toml
- name: data
mountPath: /data
containers:
- name: dind
image: docker:27-dind
imagePullPolicy: IfNotPresent
command:
- sh
- -c
- |
dockerd --host=unix:///var/run/docker.sock --tls=false --mtu=1420 &
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:
- forgejo-runner
- --config
- /config/config.toml
- daemon
- 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
securityContext:
privileged: true
runAsUser: 0
runAsGroup: 0
volumeMounts:
- name: docker-sock
mountPath: /var/run/docker.sock
- name: docker-static
mountPath: /usr/bin/docker
readOnly: true
- name: cli-plugins
mountPath: /usr/local/lib/docker/cli-plugins
readOnly: true
- 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
@ -124,22 +153,11 @@ spec:
limits:
memory: 512Mi
volumes:
- name: docker-sock
hostPath:
path: /var/run/docker.sock
type: Socket
- name: docker-static
hostPath:
path: /usr/local/bin/docker-static
type: File
- name: cli-plugins
hostPath:
path: /opt/siriusdevops/runner/cli-plugins
type: DirectoryOrCreate
- name: config-toml
configMap:
name: forgejo-runner-config
- name: data
hostPath:
path: /opt/siriusdevops/runner-deploy/data
type: DirectoryOrCreate
persistentVolumeClaim:
claimName: forgejo-runner-deploy-arm64-dind
- name: dind-run
emptyDir: {}