Compare commits

..

View file

@ -3,20 +3,12 @@
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the # `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
# deny. `forgejo-allow` (CiliumNetworkPolicy) re-adds what this namespace uses: # deny. `forgejo-allow` (CiliumNetworkPolicy) re-adds what this namespace uses:
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for # ingress: the Cilium Gateway proxy (`reserved:ingress`) for
# forgejo.siriusdevops.com -> forgejo:3000; the CI runners in # forgejo.siriusdevops.com -> forgejo:3000. The CI runners live in
# `ci-runners` on 3000 only (they register/poll over the PUBLIC URL, # `ci-runners` and register/poll over the PUBLIC URL
# so THAT traffic arrives as `reserved:ingress` — but their image # (runner-amd64.yaml: `--instance https://forgejo.siriusdevops.com`),
# pushes go pod->pod to the internal ClusterIP # so they arrive through the Gateway as `reserved:ingress` too and no
# `forgejo.forgejo.svc.cluster.local:3000` # cross-namespace rule is needed. Node/health entities cover kubelet
# (`PUSH_REGISTRY` in each repo's `.forgejo/workflows/build.yml`, # probes; Prometheus in `monitoring` is allowed on 9187 only (the
# docker daemon in the dind sidecar of the runner pod). Pod->pod is
# not `reserved:ingress`, so `default-deny` dropped it and every
# image build failed 2026-11-27 .. 2026-12-05 with
# `Get "http://forgejo.forgejo.svc.cluster.local:3000/v2/": request
# canceled ... Client.Timeout exceeded` — the cross-namespace rule IS
# required; do not delete it as redundant. Node/health entities
# cover kubelet probes; Prometheus in `monitoring` is allowed on
# 9187 only (the
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager), and the # `cnpg-pg` PodMonitor scrapes the CNPG instance manager), and the
# CNPG operator in `cnpg-system` on 8000 only — the instance # CNPG operator in `cnpg-system` on 8000 only — the instance
# manager's HTTPS status endpoint the operator reads to derive the # manager's HTTPS status endpoint the operator reads to derive the
@ -30,8 +22,7 @@
# `kubectl exec` DB dumps. # `kubectl exec` DB dumps.
# #
# The CI runner pods themselves are NOT in this namespace (they moved to # The CI runner pods themselves are NOT in this namespace (they moved to
# `ci-runners` for `enforce: privileged`); `forgejo-allow` only grants them # `ci-runners` for `enforce: privileged`) and are out of scope for this card.
# forgejo:3000, which is the registry push path the builds depend on.
apiVersion: networking.k8s.io/v1 apiVersion: networking.k8s.io/v1
kind: NetworkPolicy kind: NetworkPolicy
metadata: metadata:
@ -50,9 +41,8 @@ metadata:
namespace: forgejo namespace: forgejo
spec: spec:
description: >- description: >-
forgejo: gateway + kubelet + Prometheus + ci-runners registry-push ingress; forgejo: gateway + kubelet + Prometheus ingress; egress to own namespace,
egress to own namespace, cluster DNS, the internet, SSH on node IPs and the cluster DNS, the internet, SSH on node IPs and the API.
API.
endpointSelector: {} endpointSelector: {}
ingress: ingress:
- fromEntities: - fromEntities:
@ -67,20 +57,6 @@ spec:
- fromEndpoints: - fromEndpoints:
- matchLabels: - matchLabels:
io.kubernetes.pod.namespace: forgejo io.kubernetes.pod.namespace: forgejo
# CI runners (`ci-runners`) push images to the in-cluster registry at
# forgejo.forgejo.svc.cluster.local:3000 (PUSH_REGISTRY in each repo's
# build workflow; the docker daemon lives in the dind sidecar of the same
# pod, so one namespace selector covers runner + sidecar). Registration and
# polling use the public URL and arrive as `reserved:ingress`, but the push
# is pod -> pod and default-deny drops it without this rule. Port-scoped on
# purpose: the registry API only, nothing else in the namespace.
- fromEndpoints:
- matchLabels:
io.kubernetes.pod.namespace: ci-runners
toPorts:
- ports:
- port: "3000"
protocol: TCP
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS # The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
# status endpoint to derive the system ID and drive switchover/promotion. # status endpoint to derive the system ID and drive switchover/promotion.
# Without it the Cluster reports `Instance Status Extraction Error` and # Without it the Cluster reports `Instance Status Extraction Error` and