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:
parent
a243af6591
commit
131b9bc7c9
6 changed files with 359 additions and 125 deletions
|
|
@ -12,6 +12,7 @@ spec:
|
|||
matchLabels:
|
||||
app: forgejo-runner
|
||||
arch: arm64
|
||||
# RWO PVC: never two pods on one data-root.
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
|
|
@ -27,49 +28,100 @@ spec:
|
|||
operator: Equal
|
||||
value: network
|
||||
effect: PreferNoSchedule
|
||||
securityContext:
|
||||
supplementalGroups: [984]
|
||||
# No supplementalGroups: there is no host docker socket and no host
|
||||
# docker gid to match any more. The only daemon this runner talks to is
|
||||
# the privileged `dind` sidecar below.
|
||||
containers:
|
||||
# In-pod Docker daemon. Same shape as forgejo-runner-amd64: privileged,
|
||||
# socket on an emptyDir shared with the runner, data-root on the PVC.
|
||||
# The container MUST be named `dind`, not `docker`/`dockerd`: the
|
||||
# nightly prune (prune-cronjob.yaml) discovers daemons by
|
||||
# `app=forgejo-runner` plus a container literally named `dind`, and
|
||||
# silently prunes nothing for any other name while still reporting
|
||||
# success.
|
||||
- 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:
|
||||
# Measured peak RSS of a real ci.yml-shaped Rust job inside dind on
|
||||
# this Pi: 3.10 GiB (docs/arm64-runner-dind.md §2.6). The previous
|
||||
# 512Mi limit OOM-killed the daemon on the first build; 4Gi copies
|
||||
# the amd64 runner, which runs the same load shape.
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
memory: 4Gi
|
||||
- name: runner
|
||||
# code.forgejo.org/forgejo/runner is genuinely multi-arch and works on
|
||||
# both the amd64 (siriussec) and arm64 (rpi) runners. Do NOT swap this
|
||||
# for alex3305/forgejo-runner-dind:* on the arm64 runner: that image's
|
||||
# arm64 manifest ships an x86-64 forgejo-runner binary, so the Pi dies
|
||||
# with "exec format error" and the pi-runner (the only runner declaring
|
||||
# with "exec format error" and the pi runner (the only runner declaring
|
||||
# the bare `docker` label) goes offline, stalling every `runs-on: docker`
|
||||
# job in onionwire/siriusdevops-contact.
|
||||
image: code.forgejo.org/forgejo/runner:5.0.1
|
||||
imagePullPolicy: IfNotPresent
|
||||
# uid 1000 in this image vs a `660 root:docker` dind socket: the dind
|
||||
# container's one-shot chmod 666 can race a dockerd restart and the
|
||||
# runner's wait loop only checks that the socket exists, so it would
|
||||
# crashloop on "permission denied". Running as root is what the amd64
|
||||
# runner proved deterministic (2eff85b).
|
||||
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: arm64.toml
|
||||
- name: runner-ini
|
||||
mountPath: /config/runner.ini
|
||||
- name: cache
|
||||
mountPath: /opt/siriusdevops/runner/cache
|
||||
- name: siriusdevops
|
||||
mountPath: /opt/siriusdevops
|
||||
# runner.ini + actions cache live on the same PVC as the dind
|
||||
# data-root (subPath docker), so one Retain PV holds the whole
|
||||
# runner identity. Copied from the Pi host before first start —
|
||||
# never registered here, the uuid must survive.
|
||||
- name: data
|
||||
mountPath: /data
|
||||
- name: dind-run
|
||||
mountPath: /var/run
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
|
|
@ -77,30 +129,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: runner-ini
|
||||
hostPath:
|
||||
path: /opt/siriusdevops/runner/config/runner.ini
|
||||
type: File
|
||||
- name: cache
|
||||
hostPath:
|
||||
path: /opt/siriusdevops/runner/cache
|
||||
type: DirectoryOrCreate
|
||||
- name: siriusdevops
|
||||
hostPath:
|
||||
path: /opt/siriusdevops
|
||||
type: Directory
|
||||
- name: data
|
||||
persistentVolumeClaim:
|
||||
claimName: forgejo-runner-arm64-dind
|
||||
- name: dind-run
|
||||
emptyDir: {}
|
||||
|
|
|
|||
Loading…
Reference in a new issue