fix(forgejo): allow ci-runners -> forgejo:3000 so CI image pushes work
`forgejo-allow` claimed no cross-namespace rule was needed because the CI runners in `ci-runners` "register/poll over the public URL and therefore arrive as reserved:ingress". That holds for registration only. Every image-building workflow pushes to the in-cluster ClusterIP (`PUSH_REGISTRY: forgejo.forgejo.svc.cluster.local:3000`) from the dind sidecar of the runner pod — pod->pod, which `default-deny` dropped, so every build since the policy landed (2026-11-27 07:13Z) died at `Get "http://forgejo.forgejo.svc.cluster.local:3000/v2/": request canceled ... Client.Timeout exceeded`. Add one port-scoped ingress rule: fromEndpoints `io.kubernetes.pod.namespace: ci-runners` -> 3000/TCP (runner container and its dind sidecar share the pod identity, so a single namespace selector covers both). Nothing else in `forgejo` is widened. Rewrite the stale comment paragraph so the next isolation audit does not re-remove it.
This commit is contained in:
parent
aa8a75bdc6
commit
81fe55b0fd
1 changed files with 33 additions and 9 deletions
|
|
@ -3,12 +3,20 @@
|
||||||
# `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 live in
|
# forgejo.siriusdevops.com -> forgejo:3000; the CI runners in
|
||||||
# `ci-runners` and register/poll over the PUBLIC URL
|
# `ci-runners` on 3000 only (they register/poll over the PUBLIC URL,
|
||||||
# (runner-amd64.yaml: `--instance https://forgejo.siriusdevops.com`),
|
# so THAT traffic arrives as `reserved:ingress` — but their image
|
||||||
# so they arrive through the Gateway as `reserved:ingress` too and no
|
# pushes go pod->pod to the internal ClusterIP
|
||||||
# cross-namespace rule is needed. Node/health entities cover kubelet
|
# `forgejo.forgejo.svc.cluster.local:3000`
|
||||||
# probes; Prometheus in `monitoring` is allowed on 9187 only (the
|
# (`PUSH_REGISTRY` in each repo's `.forgejo/workflows/build.yml`,
|
||||||
|
# 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
|
||||||
|
|
@ -22,7 +30,8 @@
|
||||||
# `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`) and are out of scope for this card.
|
# `ci-runners` for `enforce: privileged`); `forgejo-allow` only grants them
|
||||||
|
# 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:
|
||||||
|
|
@ -41,8 +50,9 @@ metadata:
|
||||||
namespace: forgejo
|
namespace: forgejo
|
||||||
spec:
|
spec:
|
||||||
description: >-
|
description: >-
|
||||||
forgejo: gateway + kubelet + Prometheus ingress; egress to own namespace,
|
forgejo: gateway + kubelet + Prometheus + ci-runners registry-push ingress;
|
||||||
cluster DNS, the internet, SSH on node IPs and the API.
|
egress to own namespace, cluster DNS, the internet, SSH on node IPs and the
|
||||||
|
API.
|
||||||
endpointSelector: {}
|
endpointSelector: {}
|
||||||
ingress:
|
ingress:
|
||||||
- fromEntities:
|
- fromEntities:
|
||||||
|
|
@ -57,6 +67,20 @@ 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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue