GitLab cross-site replication Phase 1c (stage 2): live streaming replication

Adds externalClusters connectionParameters + replica.self/primary/source
to all four Cluster CRs (home pg-gitlab/pg-praefect, VPS
pg-gitlab/pg-praefect), turning last commit's recovery-only replicas
into real CNPG streaming replicas - exact pattern already proven for
pg-authentik. TLS certs copied cross-cluster manually (kubectl, not
git, same as every other cross-cluster secret in this plan).

Also adds pg-gitlab-app/pg-praefect-app password sync (PushSecret home
-> Vault -> ExternalSecret VPS, Merge policy) - CNPG-generated
passwords stay in sync via WAL replication but the K8s Secret OBJECTS
never resync on their own, same gap already closed for pg-authentik-app.

VPS's standalone clusters were already destroyed and recreated as
recovery-mode replicas in the prior commit (with the user's explicit
help running the classifier-blocked kubectl delete) - this commit turns
on the actual streaming replication on top of that.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Scooby Husky
2026-08-22 13:31:09 -05:00
co-authored by Claude Sonnet 5
parent 83c06a888d
commit 4a0de188df
6 changed files with 284 additions and 0 deletions
@@ -65,6 +65,22 @@ spec:
recovery:
source: home
# Stage 2 (see /home/scooby/.claude/plans/jiggly-snacking-iverson.md):
# connectionParameters added alongside the existing barmanObjectStore
# on the SAME "home" entry - the recovery-mode initial seed stays
# exactly as-is, ongoing replication now streams instead of relying on
# WAL-archive polling (the source of the crash-looping/probe-tuning
# fights documented for the pg-authentik precedent). Also needs a
# self-referencing "vps" entry - replica.self must match an
# externalClusters name too, even though it's this very cluster
# (confirmed live: "External cluster vps not found" until one was
# added).
#
# Reachable via home.kube.huskypup.net:61442 - a UniFi WAN port-forward
# to talos-cp-01's real LAN IP, source-IP-restricted to the VPS/witness
# public IPs (see apps/gitlab/manifests/ha-postgres-nodeport.yaml). NOT
# the Netbird mesh directly - UniFi has no route to that CIDR
# (confirmed live for the pg-authentik precedent).
externalClusters:
- name: home
barmanObjectStore:
@@ -84,6 +100,45 @@ spec:
secretAccessKey:
name: vps-minio-secret
key: secretkey
connectionParameters:
host: home.kube.huskypup.net
port: "61442"
dbname: gitlabhq_production
user: streaming_replica
sslmode: verify-ca
sslCert:
name: pg-gitlab-home-replication
key: tls.crt
sslKey:
name: pg-gitlab-home-replication
key: tls.key
sslRootCert:
name: pg-gitlab-home-ca
key: ca.crt
- name: vps
connectionParameters:
host: pg-gitlab-rw
port: "5432"
dbname: gitlabhq_production
user: streaming_replica
sslmode: verify-ca
sslCert:
name: pg-gitlab-replication
key: tls.crt
sslKey:
name: pg-gitlab-replication
key: tls.key
sslRootCert:
name: pg-gitlab-ca
key: ca.crt
# Distributed topology: both sides agree home is primary today. No
# replica.enabled - mutually exclusive with primary/self (confirmed
# live for the pg-authentik precedent).
replica:
self: vps
primary: home
source: home
monitoring:
enablePodMonitor: false # no Prometheus on the VPS cluster