homek8s/apps/base/forgejo/namespace.yaml

30 lines
1.6 KiB
YAML
Raw Normal View History

apiVersion: v1
kind: Namespace
metadata:
name: forgejo
ci(runners): isolate the CI capsule in forgejo-runners, enforce baseline on forgejo The three Actions runners (privileged dind sidecars) and the nightly prune CronJob (hostPath /var/run/docker.sock) cannot live under PSA baseline, so they move to their own namespace `forgejo-runners` with `enforce: privileged` (plus warn/audit restricted). That lets `forgejo` — Forgejo, CNPG Postgres, cluster-backup — enforce `baseline` instead of only warning. The dind sidecars stay privileged: measured on these nodes, a non-privileged pod cannot host a container runtime (cgroup fs is mounted ro; rootless dind cannot mount procfs; procMount=Unmasked needs hostUsers=false where subuid maps and /dev/net/tun are refused). See docs/pod-security.md. - PVCs/PVs are reused, not recreated: the two static Retain PVs on rpi and the dynamic local-path PV on siriussec were rebound by name, so runner.ini (registration uuid), the dind data-root and the actions cache survive. - prune CronJob + its SA/Role/RoleBinding/configmap move with the runners; NAMESPACE and the Role scope follow. - monitoring: runner/prune queries and runbooks now select forgejo-runners; cnpg_actions_* panels keep namespace="forgejo" (that is the pg namespace). - docs: pod-security.md rewritten for the two enforced namespaces. Verified live: all three runners 2/2 Running in forgejo-runners with their original registration uuids and image counts, forgejo rejects a privileged pod at admission, and a real CI image build completes (see the card).
2026-11-27 01:15:07 -05:00
# Pod Security: `enforce: baseline` here. Everything that lives in this
# namespace — Forgejo itself, the CNPG Postgres cluster, the nightly
# cluster-backup CronJob — is baseline-clean (no privileged, no hostPath,
# no host namespaces, no added capabilities), so the enforcement is real
# rather than decorative.
#
ci(runners): isolate the CI capsule in forgejo-runners, enforce baseline on forgejo The three Actions runners (privileged dind sidecars) and the nightly prune CronJob (hostPath /var/run/docker.sock) cannot live under PSA baseline, so they move to their own namespace `forgejo-runners` with `enforce: privileged` (plus warn/audit restricted). That lets `forgejo` — Forgejo, CNPG Postgres, cluster-backup — enforce `baseline` instead of only warning. The dind sidecars stay privileged: measured on these nodes, a non-privileged pod cannot host a container runtime (cgroup fs is mounted ro; rootless dind cannot mount procfs; procMount=Unmasked needs hostUsers=false where subuid maps and /dev/net/tun are refused). See docs/pod-security.md. - PVCs/PVs are reused, not recreated: the two static Retain PVs on rpi and the dynamic local-path PV on siriussec were rebound by name, so runner.ini (registration uuid), the dind data-root and the actions cache survive. - prune CronJob + its SA/Role/RoleBinding/configmap move with the runners; NAMESPACE and the Role scope follow. - monitoring: runner/prune queries and runbooks now select forgejo-runners; cnpg_actions_* panels keep namespace="forgejo" (that is the pg namespace). - docs: pod-security.md rewritten for the two enforced namespaces. Verified live: all three runners 2/2 Running in forgejo-runners with their original registration uuids and image counts, forgejo rejects a privileged pod at admission, and a real CI image build completes (see the card).
2026-11-27 01:15:07 -05:00
# The Actions runners are NOT here any more. A docker-in-docker sidecar
# cannot lose `privileged: true` on these nodes (procfs needs CAP_SYS_ADMIN,
# 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 `ci-runners`, which enforces PSA at
ci(runners): isolate the CI capsule in forgejo-runners, enforce baseline on forgejo The three Actions runners (privileged dind sidecars) and the nightly prune CronJob (hostPath /var/run/docker.sock) cannot live under PSA baseline, so they move to their own namespace `forgejo-runners` with `enforce: privileged` (plus warn/audit restricted). That lets `forgejo` — Forgejo, CNPG Postgres, cluster-backup — enforce `baseline` instead of only warning. The dind sidecars stay privileged: measured on these nodes, a non-privileged pod cannot host a container runtime (cgroup fs is mounted ro; rootless dind cannot mount procfs; procMount=Unmasked needs hostUsers=false where subuid maps and /dev/net/tun are refused). See docs/pod-security.md. - PVCs/PVs are reused, not recreated: the two static Retain PVs on rpi and the dynamic local-path PV on siriussec were rebound by name, so runner.ini (registration uuid), the dind data-root and the actions cache survive. - prune CronJob + its SA/Role/RoleBinding/configmap move with the runners; NAMESPACE and the Role scope follow. - monitoring: runner/prune queries and runbooks now select forgejo-runners; cnpg_actions_* panels keep namespace="forgejo" (that is the pg namespace). - docs: pod-security.md rewritten for the two enforced namespaces. Verified live: all three runners 2/2 Running in forgejo-runners with their original registration uuids and image counts, forgejo rejects a privileged pod at admission, and a real CI image build completes (see the card).
2026-11-27 01:15:07 -05:00
# `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.
#
# warn/audit stay at `restricted`: a future pod that is baseline-clean but
# not restricted-clean (e.g. missing seccomp/runAsNonRoot) is still printed
# and recorded as audit annotations.
labels:
ci(runners): isolate the CI capsule in forgejo-runners, enforce baseline on forgejo The three Actions runners (privileged dind sidecars) and the nightly prune CronJob (hostPath /var/run/docker.sock) cannot live under PSA baseline, so they move to their own namespace `forgejo-runners` with `enforce: privileged` (plus warn/audit restricted). That lets `forgejo` — Forgejo, CNPG Postgres, cluster-backup — enforce `baseline` instead of only warning. The dind sidecars stay privileged: measured on these nodes, a non-privileged pod cannot host a container runtime (cgroup fs is mounted ro; rootless dind cannot mount procfs; procMount=Unmasked needs hostUsers=false where subuid maps and /dev/net/tun are refused). See docs/pod-security.md. - PVCs/PVs are reused, not recreated: the two static Retain PVs on rpi and the dynamic local-path PV on siriussec were rebound by name, so runner.ini (registration uuid), the dind data-root and the actions cache survive. - prune CronJob + its SA/Role/RoleBinding/configmap move with the runners; NAMESPACE and the Role scope follow. - monitoring: runner/prune queries and runbooks now select forgejo-runners; cnpg_actions_* panels keep namespace="forgejo" (that is the pg namespace). - docs: pod-security.md rewritten for the two enforced namespaces. Verified live: all three runners 2/2 Running in forgejo-runners with their original registration uuids and image counts, forgejo rejects a privileged pod at admission, and a real CI image build completes (see the card).
2026-11-27 01:15:07 -05:00
pod-security.kubernetes.io/enforce: baseline
pod-security.kubernetes.io/enforce-version: latest
pod-security.kubernetes.io/warn: restricted
pod-security.kubernetes.io/warn-version: latest
pod-security.kubernetes.io/audit: restricted
pod-security.kubernetes.io/audit-version: latest