homek8s/apps/base/forgejo/kustomization.yaml

54 lines
2.4 KiB
YAML
Raw Normal View History

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
# Two namespaces: `forgejo` (enforce: baseline) and `ci-runners`
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
# (enforce: privileged — the CI capsule). Namespace objects sort first.
- namespace.yaml
- ci-runners-namespace.yaml
- httproute.yaml
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
- networkpolicy.yaml
# Egress lockdown for the cluster-backup pod: DNS + 10.10.0.5:22 + the API
# only. The allow list above cannot be narrowed per pod, so the deny for
# `world` in this policy is what applies to the job (card t_9d0428d8).
- networkpolicy-backup.yaml
- pvc.yaml
- cluster.yaml
- podmonitor.yaml
- pg-actions-queries.yaml
# Site-root custom assets (robots.txt) mounted into the forgejo pod.
- custom-public.yaml
- deployment.yaml
- service.yaml
- runner-configmap.yaml
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 runner PVCs/Deployments below and the prune CronJob — plus the two
# runner-token Secrets near the bottom — live in namespace `ci-runners`,
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
# 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).
#
# Static PVs/PVCs pinned to rpi: dynamic local-path cannot provision there
# (its helper pod is hardcoded to siriussec). Must sort before the runner
# Deployments that consume the claims.
- runner-dind-storage.yaml
# Cluster-scoped RuntimeClass for the Kata microVM that the rpi deploy runner
# uses (card t_8aa4af50). Its handler exists in containerd on rpi only.
- kata-runtimeclass.yaml
- runner-arm64.yaml
- runner-amd64.yaml
- runner-deploy-arm64.yaml
- prune-cronjob.yaml
# Nightly disaster-recovery backup of forgejo-data + every CNPG database to
# the Linode VPS. Lives here because a PVC cannot be mounted cross-namespace.
- cluster-backup.yaml
secrets: bring 29 hand-made cluster Secrets under Git via SOPS/age (audit F12) Nothing in the cluster was reconciled from the repo: 67 hand-made Secrets and no managed Secret at all, so a restore of this Git tree produced a cluster that would not start. This commits the first-party ones as SOPS/age ciphertext and enables Flux's sops decryptor. * provider: SOPS + age (chosen over SealedSecrets: Flux already ships the sops decryptor, so no extra controller/CRD, and the age key is escrowed off-cluster). * 29 Secrets across forgejo, siriusdevops, piedmont, sirius-growth, osint, metabase and customer1, as apps/base/<ns>/secret-<name>.sops.yaml with encrypted_regex ^(data|stringData)$ — names/namespaces stay reviewable. * each file was generated from the LIVE object and decrypts to a byte-identical data map and type, so the first apply is a no-op (not a rotation). * the CNPG bootstrap secrets (forgejo-pg-app, pg-app, sirius-growth-portal-db) are ours, not operator output — bootstrap.initdb.secret points at them, so a rebuild has no application password without them. * forgejo-pull is included despite docs/registry-pull-auth.md calling it out-of-band: with imagePullSecrets on every workload it is the one Secret whose absence stops the whole cluster from pulling images. * .gitignore keeps **/*secret*.yaml ignored and re-includes only .sops.yaml, so a plaintext Secret still cannot be committed; age.agekey stays ignored. * excluded on purpose (controller/helm-owned): CNPG *-server/*-replication/*-ca, cnpg-system CA+webhook, cert-manager webhook CA, cilium/hubble certs, helm release records, prometheus-operator rendered prompts. Full table in docs/secrets-sops.md. Key locations (never in git): Secret flux-system/sops-age (age.agekey) and /root/sops/homek8s-age.key on the Linode, reached only over the mesh.
2026-11-27 00:17:47 -05:00
# Secrets, SOPS/age-encrypted in git. Flux decrypts them (the `apps`
# Kustomization carries a decryption block; key = flux-system/sops-age).
# Never add a plaintext Secret next to these — see docs/secrets-sops.md.
- secret-forgejo-pg-app.sops.yaml
- secret-forgejo-runner-amd64-token.sops.yaml
- secret-forgejo-runner-deploy-arm64-token.sops.yaml
- secret-cluster-backup-ssh.sops.yaml
# Registry pull credential: cluster-backup now runs an image from the
# in-cluster Forgejo registry instead of alpine/k8s from Docker Hub
# (card t_9d0428d8).
- secret-forgejo-pull.sops.yaml