Skip to content

Commit a2dbe30

Browse files
authored
K8SPG-708 replace ready/live probe http check with custom command, change pg entrypoint (#1099)
1 parent c6aef45 commit a2dbe30

29 files changed

+3052
-51
lines changed

build/crd/crunchy/generated/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

build/postgres-operator/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ COPY --from=go_builder /usr/local/bin/pgbackrest /usr/local/bin/
6363
COPY --from=go_builder /licenses /licenses
6464
COPY build/postgres-operator/install-extensions.sh /usr/local/bin
6565
COPY build/postgres-operator/init-entrypoint.sh /usr/local/bin
66+
COPY build/postgres-operator/postgres-entrypoint.sh /usr/local/bin
67+
COPY build/postgres-operator/postgres-liveness-check.sh /usr/local/bin
68+
COPY build/postgres-operator/postgres-readiness-check.sh /usr/local/bin
6669
COPY hack/tools/queries /opt/crunchy/conf
6770

6871
RUN chgrp -R 0 /opt/crunchy/conf && chmod -R g=u opt/crunchy/conf

build/postgres-operator/init-entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ set -o xtrace
66
CRUNCHY_BINDIR="/opt/crunchy"
77

88
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/pgbackrest" "${CRUNCHY_BINDIR}/bin/pgbackrest"
9+
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-entrypoint.sh" "${CRUNCHY_BINDIR}/bin/postgres-entrypoint.sh"
10+
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-liveness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-liveness-check.sh"
11+
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-readiness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-readiness-check.sh"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# /pgdata/ is already mounted to the pg database container with rw permissions
4+
recovery_file='/pgdata/sleep-forever'
5+
if [[ -f ${recovery_file} ]]; then
6+
set +o xtrace
7+
echo "The $recovery_file file is detected, node entered an infinite sleep"
8+
echo "If you want to exit from the infinite sleep, remove the $recovery_file file"
9+
10+
if [[ ! -d /tmp/postgres ]]; then
11+
mkdir -p /tmp/postgres
12+
fi
13+
14+
while [ -f "${recovery_file}" ]; do
15+
sleep 3
16+
done
17+
exit 0
18+
fi
19+
20+
exec "$@"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
PATRONI_PORT=8008
4+
PATRONI_HOST=localhost
5+
6+
# /pgdata/ is already mounted to the pg database container with rw permissions
7+
recovery_file='/pgdata/sleep-forever'
8+
if [ -f "${recovery_file}" ]; then
9+
set +o xtrace
10+
echo "The $recovery_file file is detected, node entered an infinite sleep"
11+
echo "If you want to exit from the infinite sleep, remove the $recovery_file file"
12+
exit 0
13+
fi
14+
15+
response=$(curl -s -o /dev/null -w "%{http_code}" -k "https://${PATRONI_HOST}:${PATRONI_PORT}/liveness")
16+
17+
if [[ $response -eq 200 ]]; then
18+
exit 0
19+
fi
20+
exit 1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
PATRONI_PORT=8008
4+
PATRONI_HOST=localhost
5+
6+
response=$(curl -s -o /dev/null -w "%{http_code}" -k "https://${PATRONI_HOST}:${PATRONI_PORT}/readiness")
7+
8+
if [[ $response -eq 200 ]]; then
9+
exit 0
10+
fi
11+
exit 1

config/crd/bases/pgv2.percona.com_perconapgclusters.yaml

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

config/crd/bases/postgres-operator.crunchydata.com_postgresclusters.yaml

Lines changed: 264 additions & 0 deletions
Large diffs are not rendered by default.

deploy/bundle.yaml

Lines changed: 528 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)