From 74e87958e313f705dd016ae56d1a4ac449e86405 Mon Sep 17 00:00:00 2001 From: cross-du Date: Tue, 24 Feb 2026 16:22:08 -0500 Subject: [PATCH 1/4] test: add test for pgbouncer configuration --- releaser.yaml | 6 +++--- tasks/test.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/releaser.yaml b/releaser.yaml index f7f95fd..6a81ece 100644 --- a/releaser.yaml +++ b/releaser.yaml @@ -4,10 +4,10 @@ flavors: - name: upstream # renovate-uds: datasource=docker depName=ghcr.io/zalando/postgres-operator extractVersion=^v?(?\d+\.\d+\.\d+)$ - version: 1.15.1-uds.1 + version: 1.15.1-uds.2 - name: registry1 # renovate-uds: datasource=docker depName=registry1.dso.mil/ironbank/opensource/zalando/postgres-operator extractVersion=^v?(?\d+\.\d+\.\d+)$ - version: 1.15.0-uds.1 + version: 1.15.0-uds.2 - name: unicorn # renovate-uds: datasource=docker depName=quay.io/rfcurated/zalando/postgres-operator extractVersion=^v?(?\d+\.\d+\.\d+)$ - version: 1.15.0-uds.1 + version: 1.15.0-uds.2 diff --git a/tasks/test.yaml b/tasks/test.yaml index 9ef7fe5..cb46055 100644 --- a/tasks/test.yaml +++ b/tasks/test.yaml @@ -6,6 +6,7 @@ tasks: actions: - task: health-check - task: create-dbs + - task: configure-pgbouncer - name: create-dbs actions: @@ -23,3 +24,28 @@ tasks: name: app.kubernetes.io/name=postgres-operator namespace: postgres-operator condition: Ready + + - name: configure-pgbouncer + description: Prove pgbouncer deployment isn't working, then configure and verify. + actions: + - cmd: ./zarf tools kubectl get postgresql -n postgres -o jsonpath='{.items[0].spec.enableConnectionPooler}' + setVariables: + - name: POOLER_ENABLED + - description: Check status and apply fix + cmd: | + if [[ "${POOLER_ENABLED}" == "false" ]]; then + echo "PgBouncer was not deployed." && exit 0 + fi + CLUSTER_NAME=$(./zarf tools kubectl get postgresql -n postgres -o jsonpath='{.items[0].metadata.name}') + if ./zarf tools kubectl rollout status deployment/"$CLUSTER_NAME-pooler" -n postgres --timeout=5s; then + echo "PgBouncer already healthy!" && exit 0 + else + echo "Get logs of unhealthy deployment:" + ./zarf tools kubectl logs -n postgres deployment/"$CLUSTER_NAME-pooler" + fi + echo "Configuring connection-pooler" + ./zarf tools wait-for deployment "$CLUSTER_NAME-pooler" exists -n postgres + ./zarf tools kubectl set env -n postgres deployment "$CLUSTER_NAME-pooler" DATABASES_HOST="$CLUSTER_NAME" PGBOUNCER_LISTEN_PORT=5432 + ./zarf tools kubectl patch deployment "$CLUSTER_NAME-pooler" -n postgres -p \ + '{"spec":{"template":{"metadata":{"labels":{"uds/user":"70","uds/group":"70","uds/fsgroup":"70"}}}}}' + ./zarf tools wait-for deployment "${CLUSTER_NAME}-pooler" available -n postgres --timeout=120s From c212a729a2999a8b25ab8b41193ce51967f83caf Mon Sep 17 00:00:00 2001 From: cross-du Date: Tue, 24 Feb 2026 16:23:11 -0500 Subject: [PATCH 2/4] feat: add 'enableConnectionPooler' var to deploy pgbouncer --- chart/templates/postgres-minimal.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/chart/templates/postgres-minimal.yaml b/chart/templates/postgres-minimal.yaml index e3f3cad..355f81d 100644 --- a/chart/templates/postgres-minimal.yaml +++ b/chart/templates/postgres-minimal.yaml @@ -97,4 +97,5 @@ spec: secretKeyRef: name: postgres.pg-cluster.credentials.postgresql.acid.zalan.do key: password + enableConnectionPooler: false {{- end }} From 891d0ff35f551d4d8104e8032a979f917dd7c702 Mon Sep 17 00:00:00 2001 From: cross-du Date: Tue, 24 Feb 2026 16:38:41 -0500 Subject: [PATCH 3/4] chore: make conditional statement POSIX compliant --- tasks/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/test.yaml b/tasks/test.yaml index cb46055..9568a96 100644 --- a/tasks/test.yaml +++ b/tasks/test.yaml @@ -33,7 +33,7 @@ tasks: - name: POOLER_ENABLED - description: Check status and apply fix cmd: | - if [[ "${POOLER_ENABLED}" == "false" ]]; then + if [ "${POOLER_ENABLED}" == "false" ]; then echo "PgBouncer was not deployed." && exit 0 fi CLUSTER_NAME=$(./zarf tools kubectl get postgresql -n postgres -o jsonpath='{.items[0].metadata.name}') From e580c2dd5c485818e88d31d8b4802621fea695f0 Mon Sep 17 00:00:00 2001 From: cross-du Date: Wed, 25 Feb 2026 10:12:51 -0500 Subject: [PATCH 4/4] chore: lint shell script --- tasks/test.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks/test.yaml b/tasks/test.yaml index 9568a96..811f184 100644 --- a/tasks/test.yaml +++ b/tasks/test.yaml @@ -26,17 +26,17 @@ tasks: condition: Ready - name: configure-pgbouncer - description: Prove pgbouncer deployment isn't working, then configure and verify. + description: "Prove pgbouncer deployment isn't working, then configure and verify." actions: - - cmd: ./zarf tools kubectl get postgresql -n postgres -o jsonpath='{.items[0].spec.enableConnectionPooler}' + - cmd: ./zarf tools kubectl get postgresql -n postgres -o jsonpath="{.items[0].spec.enableConnectionPooler}" setVariables: - name: POOLER_ENABLED - description: Check status and apply fix cmd: | - if [ "${POOLER_ENABLED}" == "false" ]; then + if [ "${POOLER_ENABLED}" = "false" ]; then echo "PgBouncer was not deployed." && exit 0 fi - CLUSTER_NAME=$(./zarf tools kubectl get postgresql -n postgres -o jsonpath='{.items[0].metadata.name}') + CLUSTER_NAME=$(./zarf tools kubectl get postgresql -n postgres -o jsonpath="{.items[0].metadata.name}") if ./zarf tools kubectl rollout status deployment/"$CLUSTER_NAME-pooler" -n postgres --timeout=5s; then echo "PgBouncer already healthy!" && exit 0 else @@ -47,5 +47,5 @@ tasks: ./zarf tools wait-for deployment "$CLUSTER_NAME-pooler" exists -n postgres ./zarf tools kubectl set env -n postgres deployment "$CLUSTER_NAME-pooler" DATABASES_HOST="$CLUSTER_NAME" PGBOUNCER_LISTEN_PORT=5432 ./zarf tools kubectl patch deployment "$CLUSTER_NAME-pooler" -n postgres -p \ - '{"spec":{"template":{"metadata":{"labels":{"uds/user":"70","uds/group":"70","uds/fsgroup":"70"}}}}}' + "\{"spec":\{"template":\{"metadata":\{"labels":\{"uds/user":"70","uds/group":"70","uds/fsgroup":"70"\}\}\}\}\}" ./zarf tools wait-for deployment "${CLUSTER_NAME}-pooler" available -n postgres --timeout=120s