Fix CNPG distributed-topology validation errors

Confirmed live against the vcluster.cnpg.io admission webhook: (1)
replica.enabled is mutually exclusive with primary/self - they're two
different mechanisms (old single-source replica-cluster mode vs the
newer distributed-topology model), not composable. (2) Both replica.self
and replica.primary must reference names present in THAT cluster's own
externalClusters list - including a self-referencing entry, even though
it describes the cluster itself. Renamed VPS's 'home-backup' external
cluster to 'home' throughout (bootstrap.recovery.source too) so one name
consistently satisfies barmanObjectStore, connectionParameters, and the
primary reference; added matching self-referencing entries on both
sides.
This commit is contained in:
Scooby Husky
2026-08-19 00:12:50 -05:00
parent b77f0865d0
commit a095c27500
2 changed files with 68 additions and 9 deletions
@@ -68,7 +68,7 @@ spec:
bootstrap:
recovery:
source: home-backup
source: home
# Multi-site active failover pilot (see
# /home/scooby/.claude/plans/jiggly-snacking-iverson.md) - the
@@ -90,11 +90,25 @@ spec:
# just the VPS and witness public IPs. NOT the Netbird mesh directly -
# UniFi has no route to that CIDR, confirmed live (see
# infrastructure/ha-failover/manifests/etcd.yaml for the full story).
# externalClusters[].name is now "home" (was "home-backup") - reused
# consistently for bootstrap.recovery.source, replica.primary, AND the
# connectionParameters below, since CNPG's distributed-topology
# validation requires replica.primary to match an externalClusters name
# exactly (confirmed live: "External cluster home not found" when it
# didn't). serverName inside barmanObjectStore is unaffected by this
# rename - it's an explicit separate override, not derived from the
# entry name.
#
# Also needs a self-referencing "vps" entry below (same reason -
# replica.self must match an externalClusters name too, even though
# it's this very cluster) - its connectionParameters point at VPS's own
# local -rw service, never actually dialed while this cluster is a
# replica.
externalClusters:
- name: home-backup
- name: home
barmanObjectStore:
# serverName defaults to the externalClusters[].name ("home-backup")
# here, NOT the source Postgres cluster's actual name - but home's
# serverName defaults to the externalClusters[].name here, NOT
# the source Postgres cluster's actual name - but home's
# barmanObjectStore backup: block (on the pg-authentik Cluster
# itself) defaults serverName to its own metadata.name
# ("pg-authentik"). Without this override, recovery looks for
@@ -126,13 +140,32 @@ spec:
sslRootCert:
name: pg-authentik-home-ca
key: ca.crt
- name: vps
connectionParameters:
host: pg-authentik-rw
port: "5432"
dbname: app
user: streaming_replica
sslmode: verify-ca
sslCert:
name: pg-authentik-replication
key: tls.crt
sslKey:
name: pg-authentik-replication
key: tls.key
sslRootCert:
name: pg-authentik-ca
key: ca.crt
# Distributed topology: both sides agree home is primary today.
# Distributed topology: both sides agree home is primary today. No
# replica.enabled - that flag belongs to CNPG's older single-source
# replica-cluster mode and is mutually exclusive with primary/self
# (confirmed live: "replica mode enabled is not compatible with the
# primary field").
replica:
enabled: true
self: vps
primary: home
source: home-backup
source: home
monitoring:
enablePodMonitor: false # no Prometheus on the VPS cluster