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:
parent
77041b35ac
commit
aec63c4d56
18 changed files with 104 additions and 98 deletions
|
|
@ -19,7 +19,7 @@ first thing that must change. See §15.
|
|||
|
||||
> **Namespace note (2026-11-27, card `t_2bbe34a8`):** the three runner
|
||||
> Deployments, their PVCs and the prune CronJob moved from `forgejo` to
|
||||
> `forgejo-runners` so `forgejo` can enforce Pod Security `baseline`. Commands
|
||||
> `ci-runners` so `forgejo` can enforce Pod Security `baseline`. Commands
|
||||
> below use the new namespace; the dind design and every measurement are
|
||||
> unchanged.
|
||||
---
|
||||
|
|
@ -628,7 +628,7 @@ difference between the two runners).
|
|||
`docker:27-dind` already contains the client and the plugins:
|
||||
|
||||
```
|
||||
$ kubectl -n forgejo-runners exec deploy/forgejo-runner-amd64 -c dind -- sh -c 'command -v docker; ls /usr/local/libexec/docker/cli-plugins/'
|
||||
$ kubectl -n ci-runners exec deploy/forgejo-runner-amd64 -c dind -- sh -c 'command -v docker; ls /usr/local/libexec/docker/cli-plugins/'
|
||||
/usr/local/bin/docker
|
||||
docker-buildx
|
||||
docker-compose
|
||||
|
|
@ -705,7 +705,7 @@ risk of migrating a target dir that has already caused `os error 13` corruption.
|
|||
|
||||
Pre-flight — every one is read-only and proves the next step:
|
||||
|
||||
1. `kubectl -n forgejo-runners get deploy,pvc` and `ssh rpi docker ps` — record before.
|
||||
1. `kubectl -n ci-runners get deploy,pvc` and `ssh rpi docker ps` — record before.
|
||||
2. Confirm `onionwire`'s in-flight work: no `running` run on the `docker` label
|
||||
(`action_task`), or accept that the cutover kills it (see §14).
|
||||
3. Publish the Pi registry on `10.10.0.1:5000` and prove
|
||||
|
|
@ -717,7 +717,7 @@ Pre-flight — every one is read-only and proves the next step:
|
|||
|
||||
Cutover — shared runner first (it owns `docker`):
|
||||
|
||||
6. `kubectl -n forgejo-runners scale deploy/forgejo-runner-arm64 --replicas=0`, then
|
||||
6. `kubectl -n ci-runners scale deploy/forgejo-runner-arm64 --replicas=0`, then
|
||||
`ssh rpi docker ps --filter name=GITEA-ACTIONS` and `docker kill`/`rm` any
|
||||
job containers **still running on the host daemon** (a Deployment restart does
|
||||
not stop them; they keep writing to the volumes we are about to abandon).
|
||||
|
|
@ -744,10 +744,10 @@ Cutover — shared runner first (it owns `docker`):
|
|||
landed in the Pi registry (`curl -s http://10.10.0.1:5000/v2/_catalog`) and
|
||||
the Garage sync succeeded.
|
||||
12. Prove the existing prune discovers the new pod before trusting the night:
|
||||
`kubectl -n forgejo-runners create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)`
|
||||
`kubectl -n ci-runners create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)`
|
||||
and check its `dind-daemons` container log lists both new pods (label +
|
||||
container-name contract, §1.6) and reports `docker system df` per daemon.
|
||||
13. `df -h /` on rpi before/after, `kubectl -n forgejo-runners get pvc` (both Bound),
|
||||
13. `df -h /` on rpi before/after, `kubectl -n ci-runners get pvc` (both Bound),
|
||||
`kubectl get deploy -n forgejo -o wide`.
|
||||
|
||||
## 11. Rollback
|
||||
|
|
@ -766,9 +766,9 @@ Kept in place for this purpose, and none of it is deleted by the cutover:
|
|||
Rollback, ~5 minutes:
|
||||
|
||||
```
|
||||
kubectl -n forgejo-runners apply -f <git show HEAD~1:apps/base/forgejo/runner-arm64.yaml>
|
||||
kubectl -n forgejo-runners apply -f <git show HEAD~1:apps/base/forgejo/runner-deploy-arm64.yaml>
|
||||
kubectl -n forgejo-runners scale deploy/forgejo-runner-arm64 --replicas=1
|
||||
kubectl -n ci-runners apply -f <git show HEAD~1:apps/base/forgejo/runner-arm64.yaml>
|
||||
kubectl -n ci-runners apply -f <git show HEAD~1:apps/base/forgejo/runner-deploy-arm64.yaml>
|
||||
kubectl -n ci-runners scale deploy/forgejo-runner-arm64 --replicas=1
|
||||
```
|
||||
|
||||
(down the dind deployment first, kill any job container inside dind, then apply.)
|
||||
|
|
@ -932,7 +932,7 @@ The `dind` container is named exactly `dind` (§1.6 naming contract).
|
|||
an in-pod daemon the socket is still `unix:///var/run/docker.sock` (in
|
||||
`DOCKER_HOST`, the shim, and `container.options`), so the string appears 5×
|
||||
per Deployment. The meaningful test is **no hostPath at all**:
|
||||
`kubectl -n forgejo-runners get deploy <n> -o yaml | grep -c hostPath` = 0 for both,
|
||||
`kubectl -n ci-runners get deploy <n> -o yaml | grep -c hostPath` = 0 for both,
|
||||
and every `docker.sock` reference resolves to the `emptyDir` shared by the
|
||||
`dind` and `runner` containers.
|
||||
|
||||
|
|
@ -962,7 +962,7 @@ The `dind` container is named exactly `dind` (§1.6 naming contract).
|
|||
PVCs bound on rpi, static, `Retain`:
|
||||
|
||||
```
|
||||
$ kubectl -n forgejo-runners get pvc -o wide | grep dind
|
||||
$ kubectl -n ci-runners get pvc -o wide | grep dind
|
||||
forgejo-runner-arm64-dind Bound forgejo-runner-arm64-dind 200Gi RWO local-static
|
||||
forgejo-runner-deploy-arm64-dind Bound forgejo-runner-deploy-arm64-dind 40Gi RWO local-static
|
||||
$ kubectl get pv forgejo-runner-arm64-dind forgejo-runner-deploy-arm64-dind
|
||||
|
|
@ -975,10 +975,10 @@ Pods on rpi, two containers each, daemon `27.5.1` (the dind image — the Pi hos
|
|||
daemon is `29.7.2`, so a job can never be talking to it):
|
||||
|
||||
```
|
||||
$ kubectl -n forgejo-runners get deploy -o wide
|
||||
$ kubectl -n ci-runners get deploy -o wide
|
||||
forgejo-runner-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1
|
||||
forgejo-runner-deploy-arm64 1/1 dind,runner docker:27-dind,code.forgejo.org/forgejo/runner:5.0.1
|
||||
$ kubectl -n forgejo-runners exec <arm64-pod> -c dind -- docker version --format 'server={{.Server.Version}}'
|
||||
$ kubectl -n ci-runners exec <arm64-pod> -c dind -- docker version --format 'server={{.Server.Version}}'
|
||||
server=27.5.1
|
||||
```
|
||||
|
||||
|
|
@ -1007,8 +1007,8 @@ task 1737 in 1782 s (warm); deploy runner: task 1736 (`deploy-site.yml`) green i
|
|||
Nightly prune reaches both new daemons (R10 proof, forced Job):
|
||||
|
||||
```
|
||||
$ kubectl -n forgejo-runners create job --from=cronjob/forgejo-runner-prune prune-manual-1793084490
|
||||
$ kubectl -n forgejo-runners logs job/prune-manual-1793084490 -c dind-daemons | grep -E "daemon: dind in pod/|summary:"
|
||||
$ kubectl -n ci-runners create job --from=cronjob/forgejo-runner-prune prune-manual-1793084490
|
||||
$ kubectl -n ci-runners logs job/prune-manual-1793084490 -c dind-daemons | grep -E "daemon: dind in pod/|summary:"
|
||||
== daemon: dind in pod/forgejo-runner-amd64-f7bb99fb-mbv5f
|
||||
== daemon: dind in pod/forgejo-runner-arm64-7c84998bb8-mmwqd
|
||||
== daemon: dind in pod/forgejo-runner-deploy-arm64-5dcbd9f7fc-6nj2g
|
||||
|
|
@ -1022,7 +1022,7 @@ $ ssh rpi 'ss -lntH "sport = :5000"'
|
|||
LISTEN 0 4096 10.10.0.1:5000 0.0.0.0:*
|
||||
LISTEN 0 4096 127.0.0.1:5000 0.0.0.0:*
|
||||
$ ssh rpi 'curl -m5 -o /dev/null -w "%{http_code}" http://192.168.1.125:5000/v2/' → 000 (refused)
|
||||
$ kubectl -n forgejo-runners exec <arm64-pod> -c dind -- wget -qO- http://10.10.0.1:5000/v2/
|
||||
$ kubectl -n ci-runners exec <arm64-pod> -c dind -- wget -qO- http://10.10.0.1:5000/v2/
|
||||
{} # from the job daemon itself
|
||||
```
|
||||
|
||||
|
|
@ -1066,8 +1066,8 @@ regrown inside dind — they rebuild cold by design, §4.2).
|
|||
|
||||
```
|
||||
# 1. stop the dind pods (a job container lives inside them, so it dies with them)
|
||||
kubectl -n forgejo-runners scale deploy/forgejo-runner-arm64 --replicas=0
|
||||
kubectl -n forgejo-runners scale deploy/forgejo-runner-deploy-arm64 --replicas=0
|
||||
kubectl -n ci-runners scale deploy/forgejo-runner-arm64 --replicas=0
|
||||
kubectl -n ci-runners scale deploy/forgejo-runner-deploy-arm64 --replicas=0
|
||||
# 2. Flux owns these files: suspend the apps Kustomization, or the next
|
||||
# reconcile puts the dind manifests straight back
|
||||
flux -n flux-system suspend kustomization apps
|
||||
|
|
|
|||
|
|
@ -355,9 +355,9 @@ Producer: the **CNPG-I Barman Cloud plugin** (`cnpg-system/barman-cloud`,
|
|||
| 4 | flux-system | `notification-controller-7cd6d4994b-drh8x` | siriussec | 10.244.0.125 | Flux alerts/webhooks | internal |
|
||||
| 5 | flux-system | `source-controller-56549698b5-2lvmc` | siriussec | 10.244.0.44 | Flux git artifact fetcher | internal |
|
||||
| 6 | forgejo | `forgejo-67847d596c-jpb7x` | siriussec | 10.244.0.197 | Forgejo **16.0.5** git/CI/registry UI | **public** `forgejo.siriusdevops.com` |
|
||||
| 7 | forgejo-runners | `forgejo-runner-amd64-…` | siriussec | 10.244.0.x | Actions runner (privileged dind sidecar), labels `docker-amd64`, `amd64` | internal |
|
||||
| 8 | forgejo-runners | `forgejo-runner-arm64-…` | rpi | 10.244.1.x | Actions runner (privileged dind sidecar), labels `docker-arm64`, `arm64`, `docker` | internal |
|
||||
| 9 | forgejo-runners | `forgejo-runner-deploy-arm64-…` | rpi | 10.244.1.x | Actions runner (privileged dind sidecar), label **`deploy-arm64` only** (site deploys) | internal |
|
||||
| 7 | ci-runners | `forgejo-runner-amd64-…` | siriussec | 10.244.0.x | Actions runner (privileged dind sidecar), labels `docker-amd64`, `amd64` | internal |
|
||||
| 8 | ci-runners | `forgejo-runner-arm64-…` | rpi | 10.244.1.x | Actions runner (privileged dind sidecar), labels `docker-arm64`, `arm64`, `docker` | internal |
|
||||
| 9 | ci-runners | `forgejo-runner-deploy-arm64-…` | rpi | 10.244.1.x | Actions runner (privileged dind sidecar), label **`deploy-arm64` only** (site deploys) | internal |
|
||||
| 10 | forgejo | `pg-1` | siriussec | 10.244.0.159 | CNPG PostgreSQL for Forgejo (1 instance) | internal |
|
||||
| 11 | kube-system | `cilium-cz7w6` | siriussec | 10.10.0.2 (host-net) | Cilium agent v1.20.1 | internal |
|
||||
| 12 | kube-system | `cilium-dswfb` | rpi | 10.10.0.1 (host-net) | Cilium agent v1.20.1 | internal |
|
||||
|
|
@ -424,11 +424,11 @@ Label discipline that must not be broken:
|
|||
|
||||
Workflow labels actually present in the local checkouts *(live grep of `.forgejo/workflows`)*: `docker` (×8) and `docker-amd64` (×3) in `onionwire`; `deploy-arm64`, `docker-amd64` in `sirius-growth`; `docker-amd64` in `siriusdevops-contact`.
|
||||
|
||||
### 6.5 Nightly disk reclamation (`forgejo-runners/forgejo-runner-prune`)
|
||||
### 6.5 Nightly disk reclamation (`ci-runners/forgejo-runner-prune`)
|
||||
|
||||
`apps/base/forgejo/prune-cronjob.yaml`, `17 4 * * *` **UTC** (the repo's one CronJob timezone convention), `concurrencyPolicy: Forbid`, `startingDeadlineSeconds: 1800`, `backoffLimit: 1`, `activeDeadlineSeconds: 3600`.
|
||||
|
||||
**Two containers, because there are two kinds of daemon.** `host-daemon` (`docker:27-cli`) mounts the Pi's `/var/run/docker.sock`; `dind-daemons` (`alpine/k8s:1.36.4`) discovers in-cluster dind daemons — pods with label `app=forgejo-runner` **that have a container named `dind`** — and runs the same prune logic inside each over the exec API. The ServiceAccount `forgejo-prune` has only `pods get,list` and `pods/exec create` in namespace `forgejo-runners`. No pod names are in the manifest, so the two arm64 dind daemons from the arm64 migration are picked up the first night they exist (proved by creating an unrelated `app=forgejo-runner` dind pod: the job reported `found=2 pruned=2`).
|
||||
**Two containers, because there are two kinds of daemon.** `host-daemon` (`docker:27-cli`) mounts the Pi's `/var/run/docker.sock`; `dind-daemons` (`alpine/k8s:1.36.4`) discovers in-cluster dind daemons — pods with label `app=forgejo-runner` **that have a container named `dind`** — and runs the same prune logic inside each over the exec API. The ServiceAccount `forgejo-prune` has only `pods get,list` and `pods/exec create` in namespace `ci-runners`. No pod names are in the manifest, so the two arm64 dind daemons from the arm64 migration are picked up the first night they exist (proved by creating an unrelated `app=forgejo-runner` dind pod: the job reported `found=2 pruned=2`).
|
||||
|
||||
**Retention.** Exited containers > 48 h, unused **Pi-host** images > 168 h (a week of rollback for the sites). Build cache is capped at **20 GB** on the Pi host and **4 GB** per dind daemon; above the cap the script walks `--filter until=` down from 72 h to 0 s and stops as soon as the cache is under the cap, so the newest layers survive and a cold cache is the last resort. In-cluster images are **dangling-only** pruned: an `until` filter on a *pulled* image compares the upstream build date, so it would delete `node:20-bullseye` / `rust:*-bookworm` every night and make every job cold.
|
||||
|
||||
|
|
@ -439,9 +439,9 @@ Workflow labels actually present in the local checkouts *(live grep of `.forgejo
|
|||
Force a run (safe any time; it self-skips when busy):
|
||||
|
||||
```bash
|
||||
kubectl -n forgejo-runners create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)
|
||||
kubectl -n forgejo-runners logs job/prune-manual-<ts> -c host-daemon # Pi daemon
|
||||
kubectl -n forgejo-runners logs job/prune-manual-<ts> -c dind-daemons # every dind daemon
|
||||
kubectl -n ci-runners create job --from=cronjob/forgejo-runner-prune prune-manual-$(date +%s)
|
||||
kubectl -n ci-runners logs job/prune-manual-<ts> -c host-daemon # Pi daemon
|
||||
kubectl -n ci-runners logs job/prune-manual-<ts> -c dind-daemons # every dind daemon
|
||||
```
|
||||
|
||||
**Two premises worth writing down, because the code depends on them** (both verified 2026-10-27):
|
||||
|
|
@ -931,8 +931,8 @@ All times 2026-10-26 UTC. `kubeconfig` on the Legion admin laptop → `https://1
|
|||
| 9 | `kubectl -n kube-system get ds,deploy` / image tags | cilium `v1.20.1`, envoy `v1.37.5` |
|
||||
| 10 | `kubectl -n kube-system exec ds/cilium -- cilium-dbg status --brief` | `OK` |
|
||||
| 11 | `kubectl top nodes` | `error: Metrics API not available` → no metrics-server |
|
||||
| 12 | `kubectl -n forgejo-runners get deploy -o json` | 3 runner Deployments + nodeSelectors; pod/container securityContext as documented |
|
||||
| 13 | `kubectl -n forgejo-runners get cm forgejo-runner-config -o jsonpath` | three TOMLs: `amd64.toml`, `arm64.toml`, `deploy-arm64.toml`, all `capacity: 1` |
|
||||
| 12 | `kubectl -n ci-runners get deploy -o json` | 3 runner Deployments + nodeSelectors; pod/container securityContext as documented |
|
||||
| 13 | `kubectl -n ci-runners get cm forgejo-runner-config -o jsonpath` | three TOMLs: `amd64.toml`, `arm64.toml`, `deploy-arm64.toml`, all `capacity: 1` |
|
||||
| 14 | `kubectl -n forgejo exec deploy/forgejo -- forgejo --version` | `16.0.5` |
|
||||
| 15 | rpi: `sudo wg show` | `wg0` 3 peers (handshakes 1 min / 48 min / 6 d); `wg-remote` 1 peer, 35 s |
|
||||
| 16 | rpi: `sudo wg show wg0 dump \| wc -l` | `4` |
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ deploying another exporter.
|
|||
- **CNPG custom-query metrics carry `namespace`/`pod` from the scrape, not the
|
||||
exporter's `cluster` label.** `cnpg_collector_*` has `cluster`; the
|
||||
`cnpg_actions_*` and `cnpg_pg_stat_*` families do not. Filter those by
|
||||
`namespace="forgejo-runners"` (the `cnpg_actions_*` panels keep `namespace="forgejo"`: that label is the Postgres cluster's namespace).
|
||||
`namespace="ci-runners"` (the `cnpg_actions_*` panels keep `namespace="forgejo"`: that label is the Postgres cluster's namespace).
|
||||
|
||||
## Known unknowns (deliberate, documented on the boards themselves)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,14 +3,15 @@
|
|||
Status of Pod Security Admission (PSA) labels per namespace, why one workload
|
||||
still needs `privileged`, and what is enforced where. Two namespaces now
|
||||
*enforce*, not just warn: `forgejo` at `baseline` and the CI capsule
|
||||
`forgejo-runners` at `privileged`.
|
||||
`ci-runners` at `privileged`.
|
||||
|
||||
## Levels in use
|
||||
|
||||
| level | namespaces |
|
||||
|---|---|
|
||||
| `enforce: baseline` + `warn`/`audit: restricted` | `cert-manager`, `customer1`, `forgejo`, `metabase`, `osint`, `piedmont`, `secops`, `sirius-growth`, `siriusdevops` |
|
||||
| `enforce: privileged` + `warn`/`audit: restricted` | `forgejo-runners` (the Actions CI capsule), `logging` |
|
||||
| `enforce: privileged` + `warn`/`audit: privileged` | `ci-runners` (the Actions CI capsule) |
|
||||
| `enforce: privileged` + `warn`/`audit: restricted` | `logging` |
|
||||
| `warn`/`audit: restricted` only | `netsec`, `monitoring`, `node-io`, `internal`, `gateway-system`, `local-path-storage`, plus cluster-owned `kube-system`, `kube-public`, `kube-node-lease`, `default`, `cnpg-system`, `cilium-secrets`, `flux-system` |
|
||||
|
||||
The enforced set was picked by reading the live workload templates first: every
|
||||
|
|
@ -49,7 +50,7 @@ for ns in kube-system kube-public kube-node-lease default cnpg-system cilium-sec
|
|||
done
|
||||
```
|
||||
|
||||
## The Forgejo CI capsule (`forgejo-runners`)
|
||||
## The Forgejo CI capsule (`ci-runners`)
|
||||
|
||||
The three Actions runners (`forgejo-runner-amd64`, `forgejo-runner-arm64`,
|
||||
`forgejo-runner-deploy-arm64`) each carry a docker-in-docker sidecar with
|
||||
|
|
@ -71,10 +72,11 @@ split buys:
|
|||
accepted;
|
||||
* the only namespace allowed to run a privileged pod is the one whose name says
|
||||
so, labelled as such in Git, and it holds nothing but the CI capsule;
|
||||
* the capsule keeps `warn`/`audit: restricted`, so every privileged/hostPath
|
||||
pod there is still printed and recorded as an audit annotation.
|
||||
* the capsule's `warn`/`audit` are `privileged` as well (the operator's decision):
|
||||
they emit nothing because everything there is allowed by design, and the
|
||||
namespace is reviewed in Git rather than at admission.
|
||||
|
||||
What is inside `forgejo-runners`: the three runner Deployments, their PVCs
|
||||
What is inside `ci-runners`: the three runner Deployments, their PVCs
|
||||
(`forgejo-runner-amd64` on siriussec's local-path, `forgejo-runner-arm64-dind`
|
||||
200 Gi and `forgejo-runner-deploy-arm64-dind` 40 Gi as static Retain PVs on
|
||||
rpi), the `forgejo-runner-config` ConfigMap, the two registration-token
|
||||
|
|
@ -134,12 +136,12 @@ Three independent attempts to drop the flag were measured live on 2026-11-27
|
|||
kubectl -n forgejo get pods -o jsonpath='{..securityContext.privileged}'
|
||||
|
||||
# forgejo enforces baseline; the capsule is explicitly privileged + audited
|
||||
kubectl get ns forgejo forgejo-runners -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.labels}{"\n"}{end}'
|
||||
kubectl get ns forgejo ci-runners -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.metadata.labels}{"\n"}{end}'
|
||||
|
||||
# admission really rejects the shape in forgejo (expect Forbidden)
|
||||
kubectl -n forgejo run probe-bad --image=busybox --restart=Never \
|
||||
--overrides='{"spec":{"containers":[{"name":"p","image":"busybox","securityContext":{"privileged":true}}]}}'
|
||||
|
||||
# the prune CronJob (and its RBAC) now live in the capsule
|
||||
kubectl -n forgejo-runners get cronjob,role,rolebinding,sa -l app=forgejo-runner
|
||||
kubectl -n ci-runners get cronjob,role,rolebinding,sa -l app=forgejo-runner
|
||||
```
|
||||
|
|
|
|||
Loading…
Reference in a new issue