Skip to content

Commit 65f8257

Browse files
committed
update resume to check pg_isready and ensure cluster is paused before resuming
Signed-off-by: Jesse Nelson <[email protected]>
1 parent 8e14843 commit 65f8257

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/runbook/scripts/utils.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,23 @@ function resumePatroni() {
448448

449449
log "Resuming Patroni cluster '${cluster}' via pod ${pod}"
450450

451-
until kubectl exec -n "${namespace}" "${pod}" -c patroni -- patronictl resume --wait >/dev/null 2>&1; do
452-
log "Resume failed in pod ${pod}. Retrying..."
451+
until kubectl exec -n "${namespace}" "${pod}" -c patroni -- pg_isready &>/dev/null; do
452+
log "PostgreSQL is not yet ready in pod ${pod}"
453+
454+
if (kubectl exec -n "${namespace}" "${pod}" -c patroni -- \
455+
patronictl show-config | yq eval '.pause' -e | grep -q true) &>/dev/null; then
456+
log "Cluster is paused in pod ${pod}. Attempting to resume..."
457+
if kubectl exec -n "${namespace}" "${pod}" -c patroni -- \
458+
patronictl resume --wait &>/dev/null; then
459+
log "Successfully resumed cluster in pod ${pod}"
460+
else
461+
log "Resume failed in pod ${pod}. Retrying"
462+
fi
463+
fi
453464
sleep 2
454465
done
466+
467+
log "Successfully resumed cluster in pod ${pod}"
455468
}
456469

457470
function waitForStatefulSetPodsStarted() {

0 commit comments

Comments
 (0)