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 }} 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..811f184 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