From 668011809f5537d39fcda31d709ff64314ab7015 Mon Sep 17 00:00:00 2001 From: Lance Walters Date: Fri, 4 Dec 2026 14:25:37 -0500 Subject: [PATCH] fix(netpol): allow cnpg-system operator to read instance status on :8000 The CNPG operator dials each instance's HTTPS status endpoint (https://: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. --- apps/base/forgejo/networkpolicy.yaml | 18 +++++++++++++++++- apps/base/sirius-growth/networkpolicy.yaml | 20 ++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/apps/base/forgejo/networkpolicy.yaml b/apps/base/forgejo/networkpolicy.yaml index 1984aa5..5600b1b 100644 --- a/apps/base/forgejo/networkpolicy.yaml +++ b/apps/base/forgejo/networkpolicy.yaml @@ -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: diff --git a/apps/base/sirius-growth/networkpolicy.yaml b/apps/base/sirius-growth/networkpolicy.yaml index 4f989c6..8a7ddb5 100644 --- a/apps/base/sirius-growth/networkpolicy.yaml +++ b/apps/base/sirius-growth/networkpolicy.yaml @@ -6,8 +6,11 @@ # ingress: Cilium Gateway proxy (`reserved:ingress`) for # siriusgrowthsolutions.com -> site:80 / contact:8090 / # portal-gate:8080 / portal:8091 / blog:8092, node entities for -# kubelet probes, and Prometheus in `monitoring` on 9187 only (the -# `cnpg-portal` PodMonitor scrapes the CNPG instance manager). +# kubelet probes, Prometheus in `monitoring` on 9187 only (the +# `cnpg-portal` 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 (blog/portal -> portal-1:5432, # portal-gate -> portal:8091); `world` for the Telegram Bot API # (contact + portal) and the leadgen crawlers; the node IPs on 3900 @@ -53,6 +56,19 @@ spec: - fromEndpoints: - matchLabels: io.kubernetes.pod.namespace: sirius-growth + # 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 `portal` instance manager on 9187. - fromEndpoints: - matchLabels: