diff --git a/kube/deploy/core/db/pg/clusters/default/ks.yaml b/kube/deploy/core/db/pg/clusters/default/ks.yaml index 5eada507..57b34eaa 100644 --- a/kube/deploy/core/db/pg/clusters/default/ks.yaml +++ b/kube/deploy/core/db/pg/clusters/default/ks.yaml @@ -23,6 +23,7 @@ spec: PG_CONFIG_VERSION: "16" PG_CONFIG_SIZE: "100Gi" PG_DUMPALL: !!str "'TRUE'" + PG_DUMP_FROM: "primary" patches: - patch: |- apiVersion: postgres-operator.crunchydata.com/v1beta1 diff --git a/kube/deploy/core/db/pg/clusters/home/ks.yaml b/kube/deploy/core/db/pg/clusters/home/ks.yaml index 00beb79b..7e58ec6f 100644 --- a/kube/deploy/core/db/pg/clusters/home/ks.yaml +++ b/kube/deploy/core/db/pg/clusters/home/ks.yaml @@ -25,6 +25,7 @@ spec: PG_CONFIG_VERSION: "16" PG_CONFIG_SIZE: "100Gi" PG_DUMPALL: !!str "'TRUE'" + PG_DUMP_FROM: "primary" patches: - patch: |- apiVersion: postgres-operator.crunchydata.com/v1beta1 diff --git a/kube/deploy/core/db/pg/clusters/template/dump-local.yaml b/kube/deploy/core/db/pg/clusters/template/dump-local.yaml index d852d0b2..383e3c57 100644 --- a/kube/deploy/core/db/pg/clusters/template/dump-local.yaml +++ b/kube/deploy/core/db/pg/clusters/template/dump-local.yaml @@ -50,9 +50,10 @@ spec: # DROP backed_up_databases IF EXISTS - name: "POSTGRES_EXTRA_OPTS" value: "--clean --if-exists" - # use pgBouncer service to handle connection loadbalancing and failover + # use pgBouncer service by default to handle connection loadbalancing and failover + # use primary service using Flux envsubst in case replicas are not ready, pgBouncer won't work with dumpall - name: "POSTGRES_HOST" - value: "pg-${PG_APP_NAME}-pods.${PG_APP_NS}.svc.cluster.local" + value: "pg-${PG_APP_NAME}-${PG_DUMP_FROM:=pgbouncer}.${PG_APP_NS}.svc.cluster.local" #value: "pg-${PG_APP_NAME}-replicas.${PG_APP_NS}.svc.cluster.local" #valueFrom: # secretKeyRef: