Compare commits
4 changed files with 2 additions and 79 deletions
|
|
@ -11,4 +11,3 @@ resources:
|
||||||
- runner-arm64.yaml
|
- runner-arm64.yaml
|
||||||
- runner-amd64.yaml
|
- runner-amd64.yaml
|
||||||
- runner-deploy-arm64.yaml
|
- runner-deploy-arm64.yaml
|
||||||
- prune-cronjob.yaml
|
|
||||||
|
|
|
||||||
|
|
@ -1,67 +0,0 @@
|
||||||
---
|
|
||||||
# Disk hygiene for the Pi's build host.
|
|
||||||
#
|
|
||||||
# Every push builds images on the Pi's own docker daemon (deploy-site's arm64
|
|
||||||
# image, onionwire's ci build containers) and nothing ever removed them: the
|
|
||||||
# single / volume sat at 76% (666G/917G) with weeks of exited job containers
|
|
||||||
# and superseded image layers. On one volume that is a slow-motion outage.
|
|
||||||
#
|
|
||||||
# Prune keeps a week of images (a rollback window), 48h of exited containers,
|
|
||||||
# and 72h of builder cache. It runs against the host socket, so it sees exactly
|
|
||||||
# the containers the runners created.
|
|
||||||
apiVersion: batch/v1
|
|
||||||
kind: CronJob
|
|
||||||
metadata:
|
|
||||||
name: forgejo-runner-prune
|
|
||||||
namespace: forgejo
|
|
||||||
labels:
|
|
||||||
app: forgejo-runner
|
|
||||||
role: prune
|
|
||||||
spec:
|
|
||||||
schedule: "17 4 * * *"
|
|
||||||
timeZone: "Etc/UTC"
|
|
||||||
concurrencyPolicy: Forbid
|
|
||||||
successfulJobsHistoryLimit: 3
|
|
||||||
failedJobsHistoryLimit: 3
|
|
||||||
jobTemplate:
|
|
||||||
spec:
|
|
||||||
backoffLimit: 1
|
|
||||||
activeDeadlineSeconds: 1800
|
|
||||||
template:
|
|
||||||
spec:
|
|
||||||
restartPolicy: Never
|
|
||||||
nodeSelector:
|
|
||||||
kubernetes.io/hostname: rpi
|
|
||||||
tolerations:
|
|
||||||
- key: dedicated
|
|
||||||
operator: Equal
|
|
||||||
value: network
|
|
||||||
effect: PreferNoSchedule
|
|
||||||
containers:
|
|
||||||
- name: prune
|
|
||||||
image: docker:27-cli
|
|
||||||
imagePullPolicy: IfNotPresent
|
|
||||||
command:
|
|
||||||
- sh
|
|
||||||
- -c
|
|
||||||
- |
|
|
||||||
set -e
|
|
||||||
echo "== before"; docker system df
|
|
||||||
docker container prune -f --filter until=48h || true
|
|
||||||
docker image prune -af --filter until=168h || true
|
|
||||||
docker builder prune -af --filter until=72h || true
|
|
||||||
echo "== after"; docker system df
|
|
||||||
volumeMounts:
|
|
||||||
- name: docker-sock
|
|
||||||
mountPath: /var/run/docker.sock
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 10m
|
|
||||||
memory: 32Mi
|
|
||||||
limits:
|
|
||||||
memory: 128Mi
|
|
||||||
volumes:
|
|
||||||
- name: docker-sock
|
|
||||||
hostPath:
|
|
||||||
path: /var/run/docker.sock
|
|
||||||
type: Socket
|
|
||||||
|
|
@ -27,7 +27,7 @@ data:
|
||||||
# No docker_host here: setting it makes the runner inject the host socket
|
# No docker_host here: setting it makes the runner inject the host socket
|
||||||
# bind into the job container itself, which collides with the explicit
|
# bind into the job container itself, which collides with the explicit
|
||||||
# -v /var/run/docker.sock in options ("Duplicate mount point").
|
# -v /var/run/docker.sock in options ("Duplicate mount point").
|
||||||
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g
|
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
valid_volumes:
|
valid_volumes:
|
||||||
- "**"
|
- "**"
|
||||||
# Dedicated runner for site deploys. It declares ONLY the `deploy-arm64`
|
# Dedicated runner for site deploys. It declares ONLY the `deploy-arm64`
|
||||||
|
|
@ -54,11 +54,7 @@ data:
|
||||||
privileged: true
|
privileged: true
|
||||||
# Same injection as arm64.toml: the job container is node:20-bullseye,
|
# Same injection as arm64.toml: the job container is node:20-bullseye,
|
||||||
# which has no docker CLI and no buildx, and deploy-site.yml needs both.
|
# which has no docker CLI and no buildx, and deploy-site.yml needs both.
|
||||||
# buildx is the host's cli-plugins binary and binfmt/QEMU is registered on
|
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock
|
||||||
# the Pi host, so amd64 cross-builds work here exactly as on the arm64
|
|
||||||
# runner. --memory caps the job container only (sibling `docker run`
|
|
||||||
# containers a workflow spawns are outside the runner's control).
|
|
||||||
options: -v /usr/local/bin/docker-static:/usr/bin/docker:ro -v /opt/siriusdevops/runner/cli-plugins:/usr/local/lib/docker/cli-plugins:ro -v /var/run/docker.sock:/var/run/docker.sock --memory 3g --memory-swap 3g
|
|
||||||
valid_volumes:
|
valid_volumes:
|
||||||
- "**"
|
- "**"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,11 +55,6 @@ spec:
|
||||||
# dies with "exec format error" on the Pi.
|
# dies with "exec format error" on the Pi.
|
||||||
image: code.forgejo.org/forgejo/runner:5.0.1
|
image: code.forgejo.org/forgejo/runner:5.0.1
|
||||||
imagePullPolicy: IfNotPresent
|
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:
|
command:
|
||||||
- sh
|
- sh
|
||||||
- -c
|
- -c
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue