railiance-apps/manifests/forgejo-runner.yaml
tegwick 1dd7387cbc
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
RAPPS-WP-0019 finished; forge runner memory limit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 276069@bnt-lap001
Assistant-Session: 2e192b3d-b3e8-4403-94d4-d55a2c8b476c
2026-10-21 23:46:40 +02:00

162 lines
No EOL
5.1 KiB
YAML

# In-cluster Forgejo Actions runner (ADR-004).
# DinD sidecar + forgejo-runner; registration via init container on first boot.
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forgejo-runner-data
namespace: forgejo
labels:
app.kubernetes.io/name: forgejo-runner
app.kubernetes.io/part-of: railiance-apps
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: local-path
---
apiVersion: v1
kind: ConfigMap
metadata:
name: forgejo-runner-init
namespace: forgejo
labels:
app.kubernetes.io/name: forgejo-runner
data:
register.sh: |
#!/bin/sh
set -eu
cd /data
if [ ! -f config.yaml ]; then
forgejo-runner generate-config > config.yaml
fi
if [ ! -f .runner ]; then
forgejo-runner register --no-interactive \
--config /data/config.yaml \
--instance "${FORGEJO_INSTANCE}" \
--token "${REGISTRATION_TOKEN}" \
--name "${RUNNER_NAME}" \
--labels "${RUNNER_LABELS}"
fi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner
namespace: forgejo
labels:
app.kubernetes.io/name: forgejo-runner
app.kubernetes.io/part-of: railiance-apps
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: forgejo-runner
template:
metadata:
labels:
app.kubernetes.io/name: forgejo-runner
spec:
securityContext:
fsGroup: 1000
initContainers:
- name: register
image: code.forgejo.org/forgejo/runner@sha256:5071e6832313bafe71577e05631bece88caff08fcfb372193e4a21941f4ed54b
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "/scripts/register.sh"]
env:
- name: FORGEJO_INSTANCE
value: "https://forgejo.coulomb.social/"
- name: RUNNER_NAME
value: "railiance01-build-01"
- name: RUNNER_LABELS
value: "self-hosted:host,linux:host,linux_amd64:host,container-build:host,registry-publish:host,railiance01:host,ubuntu-latest:docker://node:20-bookworm,docker:docker://node:20-bookworm"
- name: REGISTRATION_TOKEN
valueFrom:
secretKeyRef:
name: forgejo-runner-registration
key: token
volumeMounts:
- name: data
mountPath: /data
- name: init-scripts
mountPath: /scripts
readOnly: true
containers:
- name: dind
image: docker.io/library/docker@sha256:aa3df78ecf320f5fafdce71c659f1629e96e9de0968305fe1de670e0ca9176ce
imagePullPolicy: IfNotPresent
securityContext:
privileged: true
env:
- name: DOCKER_TLS_CERTDIR
value: ""
args:
- dockerd
- -H
- tcp://127.0.0.1:2375
- --tls=false
# FORGE-WP-0011: job workload runs here (one job at a time,
# runner capacity: 1). Request covers idle p95 (391Mi); the limit
# bounds a build burst. Peak 7d: 200m / 693Mi working set.
resources:
requests:
cpu: 100m
memory: 432Mi
limits:
cpu: 1500m
memory: 2Gi
readinessProbe:
exec:
command: ["sh", "-c", "wget -q -O- -T 3 http://127.0.0.1:2375/_ping | grep -qx OK"]
initialDelaySeconds: 10
periodSeconds: 10
- name: runner
image: code.forgejo.org/forgejo/runner@sha256:5071e6832313bafe71577e05631bece88caff08fcfb372193e4a21941f4ed54b
imagePullPolicy: IfNotPresent
# FORGE-WP-0011: runner daemon; p95 2m / 56Mi, peak 124m / 459Mi
# (host-label jobs run in this container). Pod request total
# 125m / 496Mi. No limit set in this change (see FORGE-WP-0011).
resources:
requests:
cpu: 25m
memory: 64Mi
limits:
# 7-day peak 459Mi (`:host` jobs run in this container); ~2.2x margin.
memory: 1Gi
env:
- name: DOCKER_HOST
value: tcp://127.0.0.1:2375
command: ["/bin/sh", "-c"]
args:
- |
set -eu
echo "waiting for DinD..."
for i in $(seq 1 90); do
if wget -q -O- http://127.0.0.1:2375/_ping 2>/dev/null | grep -q OK; then
echo "DinD ready"
break
fi
sleep 2
done
exec forgejo-runner daemon --config /data/config.yaml
volumeMounts:
- name: data
mountPath: /data
readinessProbe:
exec:
command: ["/bin/sh", "-c", "wget -q -O- http://127.0.0.1:2375/_ping | grep -q OK"]
initialDelaySeconds: 15
periodSeconds: 30
volumes:
- name: data
persistentVolumeClaim:
claimName: forgejo-runner-data
- name: init-scripts
configMap:
name: forgejo-runner-init
defaultMode: 0555