ci(runners): name the CI capsule ci-runners and mark it privileged in warn/audit too

Renames the namespace introduced in #72 (`forgejo-runners` -> `ci-runners`) per
the orchestrator decision on card t_2bbe34a8, and sets the capsule's
warn/audit levels to `privileged` alongside `enforce: privileged`: everything
in it is allowed by design, so restricted-level warnings on every pod restart
would be noise, and the intent is explicit in Git rather than implied.

Storage is the same three PVs, rebound again by name (Retain + cleared
claimRef), so the runner registration uuids, dind image sets and action caches
survive: verified before/after (uuids 91124ee3/4e07c1e9/a41aad73, image counts
19/2/31, canary files intact). Monitoring selectors and docs follow the new
namespace; the Grafana dashboard keeps its `forgejo-runners` uid.
This commit is contained in:
Lancelot 2026-11-27 01:20:56 -05:00
commit aec63c4d56
18 changed files with 104 additions and 98 deletions

View file

@ -1,7 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: forgejo-runners
name: ci-runners
# The Forgejo Actions CI capsule: three runner Deployments (each with a
# privileged docker-in-docker sidecar), their data PVCs, and the nightly
# prune CronJob (hostPath `/var/run/docker.sock`).
@ -20,12 +20,16 @@ metadata:
# namespace free of anything that is not part of the CI capsule, and give it
# its own NetworkPolicy/RBAC scope rather than widening it.
#
# warn/audit at `restricted` still print and record every violation, so a new
# privileged/hostPath pod here is visible even though it is admitted.
# warn/audit are `privileged` too, on purpose: at that level PSA prints and
# records nothing, which is the honest signal — everything here is allowed by
# design, and the namespace holds only the CI capsule. (Warn/audit at
# `restricted` would emit the same five violations for every pod, every
# restart, and train everyone to ignore them.) Anything added here that is not
# part of the capsule is a review failure in Git, not an admission event.
labels:
pod-security.kubernetes.io/enforce: privileged
pod-security.kubernetes.io/enforce-version: latest
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn: privileged
pod-security.kubernetes.io/warn-version: latest
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/audit-version: latest

View file

@ -1,10 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Two namespaces: `forgejo` (enforce: baseline) and `forgejo-runners`
# Two namespaces: `forgejo` (enforce: baseline) and `ci-runners`
# (enforce: privileged — the CI capsule). Namespace objects sort first.
- namespace.yaml
- runner-namespace.yaml
- ci-runners-namespace.yaml
- httproute.yaml
- pvc.yaml
- cluster.yaml
@ -16,7 +16,7 @@ resources:
- service.yaml
- runner-configmap.yaml
# The runner PVCs/Deployments below and the prune CronJob — plus the two
# runner-token Secrets near the bottom — live in namespace `forgejo-runners`,
# runner-token Secrets near the bottom — live in namespace `ci-runners`,
# not `forgejo`: the dind sidecars need `privileged` and the prune Job needs a
# hostPath socket, both of which `forgejo` now rejects at admission
# (enforce: baseline).

View file

@ -13,7 +13,7 @@ metadata:
# kubelet mounts /sys/fs/cgroup read-only for non-privileged pods, rootless
# dind is blocked by the masked /proc and the absent /dev/net/tun — all
# measured, see docs/pod-security.md), so the three runner Deployments, their
# PVCs and the prune CronJob live in `forgejo-runners`, which enforces PSA at
# PVCs and the prune CronJob live in `ci-runners`, which enforces PSA at
# `privileged` on purpose. Moving them out is what lets this namespace
# enforce baseline: if a runner (or anything else privileged/hostPath) is
# ever added here, admission rejects it instead of silently accepting it.

View file

@ -35,18 +35,18 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: forgejo-prune
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: prune
---
# Least privilege: the job needs to find dind pods (get/list) and to run
# docker inside them (pods/exec create) — in namespace forgejo-runners only.
# docker inside them (pods/exec create) — in namespace ci-runners only.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: forgejo-prune
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: prune
@ -62,7 +62,7 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: forgejo-prune
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: prune
@ -73,13 +73,13 @@ roleRef:
subjects:
- kind: ServiceAccount
name: forgejo-prune
namespace: forgejo-runners
namespace: ci-runners
---
apiVersion: v1
kind: ConfigMap
metadata:
name: forgejo-prune-scripts
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: prune
@ -166,12 +166,12 @@ data:
dind-daemons.sh: |
#!/bin/sh
# Prune every in-cluster dind daemon, discovered by label.
# Selector: pods with app=forgejo-runner in namespace forgejo-runners that have a
# Selector: pods with app=forgejo-runner in namespace ci-runners that have a
# container named `dind`. Nothing here is keyed to a pod name, so a new
# dind runner (e.g. the arm64 migration) is pruned the night it appears.
set -u
NS=${NAMESPACE:-forgejo-runners}
NS=${NAMESPACE:-ci-runners}
CAP_BYTES=${CACHE_CAP_BYTES:-4000000000}
CACHE_AGE_H=${CACHE_AGE_H:-72}
CONTAINER_AGE_H=${CONTAINER_AGE_H:-48}
@ -263,7 +263,7 @@ apiVersion: batch/v1
kind: CronJob
metadata:
name: forgejo-runner-prune
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: prune
@ -343,7 +343,7 @@ spec:
command: ["/bin/sh", "/scripts/dind-daemons.sh"]
env:
- name: NAMESPACE
value: forgejo-runners
value: ci-runners
- name: CACHE_CAP_BYTES
value: "4000000000"
- name: CACHE_AGE_H

View file

@ -2,7 +2,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forgejo-runner-amd64
namespace: forgejo-runners
namespace: ci-runners
spec:
accessModes:
- ReadWriteOnce
@ -15,7 +15,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner-amd64
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
arch: amd64
@ -173,7 +173,7 @@ spec:
#
# Consequence: this Deployment cannot live in namespace
# `forgejo` (PSA enforce: baseline there). All three runners,
# their PVCs and the prune CronJob live in `forgejo-runners`,
# their PVCs and the prune CronJob live in `ci-runners`,
# which enforces PSA at `privileged` by design — keep that
# namespace free of anything but this CI capsule.
privileged: true

View file

@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner-arm64
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
arch: arm64
@ -136,7 +136,7 @@ spec:
# is forbidden by Pod Security baseline).
# What *is* removed: privileged job containers (runner configmap),
# the runner's uid 0, and the host docker socket (no hostPath).
# This pod lives in namespace forgejo-runners (enforce:
# This pod lives in namespace ci-runners (enforce:
# privileged), not forgejo (enforce: baseline) — see runner-amd64.yaml.
privileged: true
volumeMounts:

View file

@ -2,7 +2,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: forgejo-runner-config
namespace: forgejo-runners
namespace: ci-runners
data:
arm64.toml: |
log:

View file

@ -19,7 +19,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: forgejo-runner-deploy-arm64
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
arch: arm64
@ -148,7 +148,7 @@ spec:
# runner-amd64.yaml (procfs without CAP_SYS_ADMIN, /sys/fs/cgroup
# mounted read-only by kubelet, rootless dind blocked by masked
# /proc + missing /dev/net/tun). Verified live 2026-11-27.
# Lives in namespace forgejo-runners (enforce: privileged),
# Lives in namespace ci-runners (enforce: privileged),
# not forgejo (enforce: baseline) — see runner-amd64.yaml.
privileged: true
volumeMounts:

View file

@ -64,7 +64,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forgejo-runner-arm64-dind
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
arch: arm64
@ -108,7 +108,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: forgejo-runner-deploy-arm64-dind
namespace: forgejo-runners
namespace: ci-runners
labels:
app: forgejo-runner
role: deploy

View file

@ -4,7 +4,7 @@ data:
kind: Secret
metadata:
name: forgejo-runner-amd64-token
namespace: forgejo-runners
namespace: ci-runners
type: Opaque
sops:
age:
@ -18,6 +18,6 @@ sops:
-----END AGE ENCRYPTED FILE-----
recipient: age12zdn7x72zrgu9cdv8wdj7xfx42nz09nrwpc2g09cwx5fwdm0ry6qp5h4jp
encrypted_regex: ^(data|stringData)$
lastmodified: "2026-11-27T06:12:09Z"
mac: ENC[AES256_GCM,data:F0c0O4Nq6rUEKepp75smiiLz1dbwtvGpHXBkWqZ6NQhwZPyb/nPKcW+uyZZRHPtgt7qsMVe3ETu8p0PNflI6v5D6TesEwOsnhAoff+fjS+CgUUl8wEW4o4mK0uHsYoN7BJ2yog238LGEqkqU4t7yj0xBbBR4gicN3Dhkuhb++Io=,iv:B9Kqk7oPL8Miip6viXU7HJnUBHlf866+E47sC+BsaaA=,tag:r3/z+/4aIlWrdUaO9nt8aQ==,type:str]
lastmodified: "2026-11-27T06:18:39Z"
mac: ENC[AES256_GCM,data:+hlch3XHEHTl+PUFjAjIL/cJdGIJBtwlA3gldWYpUVtsKOPJ2Vfi5DUfwodvpTCSjZYTTipR4Kz2BoAhQ9y+vVMGfTKko/1fA5UMjf74uiCXhur0B2vyAcFUn79xrZql/J6q7DmkufHveS7baNd5YRQSLV6Catm70IkIL81o1/Q=,iv:6esPz9ggtY0+5NedEfET0NfX39xw5fwokVNQB3ak24s=,tag:+5WduOvKK35AV65auauM2Q==,type:str]
version: 3.13.3

View file

@ -4,7 +4,7 @@ data:
kind: Secret
metadata:
name: forgejo-runner-deploy-arm64-token
namespace: forgejo-runners
namespace: ci-runners
type: Opaque
sops:
age:
@ -18,6 +18,6 @@ sops:
-----END AGE ENCRYPTED FILE-----
recipient: age12zdn7x72zrgu9cdv8wdj7xfx42nz09nrwpc2g09cwx5fwdm0ry6qp5h4jp
encrypted_regex: ^(data|stringData)$
lastmodified: "2026-11-27T06:12:09Z"
mac: ENC[AES256_GCM,data:HcIUcXyxgkJyaQiQVUWdMSYDWWgltavFC5RtKn/+vWJ2Lm8tyXgqLCpmEuFxkYwf+WyQrqmyi++0EzMfBxnsRAE+b7U5PS5VqX+pvq0nD4SAPMSm1B+cXz/zrHAzLBVXHHhOzvK8yJtTXqb9iM89bagXiwFIVNCuvhwzDACtX3k=,iv:m3Lb4CiRz0nEOVLUI6MdtUuPTGx2b8zeFE6Mvkb9EIg=,tag:zOHLyo3Uv1uTMQayMywjOQ==,type:str]
lastmodified: "2026-11-27T06:18:39Z"
mac: ENC[AES256_GCM,data:/SrVMnWWPRDMJYCWcGsmyIp3VuBBEw1pzKSHCty/ZUuqlE4IrvAaQpisAF8ByMsOBTc80JfRjaiFYr5nu1L7jlTDbivPHXAc4CgLMX3FGtvqTgrmPCwvjUV2x0kK6pSNgo/AuDmFYCh+UKqyNEToi4uDnqtiXwy91fsfvg60fLw=,iv:S3SOMKy6ZYWdYKC8DZs4mdQhPTMv/bt+d8+UO5cKOLI=,tag:YvHkNscDXMutN5BFekrfow==,type:str]
version: 3.13.3