fix(netpol): allow cnpg-system operator to read instance status on :8000

The CNPG operator dials each instance's HTTPS status endpoint
(https://<podIP>:8000/pg/status) to derive the system ID and drive
switchover. The tenant isolation added in t_fed52919 opened only
gateway/node/health entities, same-namespace pods and monitoring:9187,
so cnpg-system was denied: forgejo/pg and sirius-growth/portal sat at
Ready=False / ConsistentSystemID=False ('Instance Status Extraction
Error: HTTP communication issue') while their pods served traffic and
automated failover was effectively disabled.

Add one ingress rule to each CNP, scoped to the operator pod label
(app.kubernetes.io/name=cloudnative-pg in cnpg-system) and to TCP 8000
only. Not world, not the whole cluster, not 5432.
This commit is contained in:
Lance Walters 2026-12-04 14:25:37 -05:00
commit 668011809f
2 changed files with 35 additions and 3 deletions

View file

@ -9,7 +9,10 @@
# so they arrive through the Gateway as `reserved:ingress` too and no
# cross-namespace rule is needed. Node/health entities cover kubelet
# probes; Prometheus in `monitoring` is allowed on 9187 only (the
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager).
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager), and the
# CNPG operator in `cnpg-system` on 8000 only — the instance
# manager's HTTPS status endpoint the operator reads to derive the
# system ID and drive failover (card t_4210edec).
# egress: cluster DNS; its own pods (forgejo -> pg-rw:5432); `world` for
# outbound HTTPS (Forgejo webhooks, avatar/mirror fetches, the
# public-URL callbacks the runner flow needs); node IPs on 22, which
@ -54,6 +57,19 @@ spec:
- fromEndpoints:
- matchLabels:
io.kubernetes.pod.namespace: forgejo
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
# status endpoint to derive the system ID and drive switchover/promotion.
# Without it the Cluster reports `Instance Status Extraction Error` and
# Ready=False while the pods serve traffic, and automated failover is dead
# (card t_4210edec). Scoped to 8000: not 5432, not the whole namespace.
- fromEndpoints:
- matchLabels:
io.kubernetes.pod.namespace: cnpg-system
app.kubernetes.io/name: cloudnative-pg
toPorts:
- ports:
- port: "8000"
protocol: TCP
# Prometheus scrapes the CNPG `pg` instance manager on 9187.
- fromEndpoints:
- matchLabels: