Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPG-708 replace ready/live probe http check with custom command, change pg entrypoint #1099

Open
wants to merge 41 commits into
base: K8SPG-613
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7f5625f
K8SPG-708 replace ready/live probe http check with custom command
gkech Mar 20, 2025
9be2645
use bash -c for the probes to work properly
gkech Mar 24, 2025
e618bd7
fix imports
gkech Mar 24, 2025
85aada5
cr check and improve unit test
gkech Mar 24, 2025
27d6db0
fix linter
gkech Mar 24, 2025
7eaae86
e2e test use the K8SPG-708-ppg image for now
gkech Mar 24, 2025
b759611
revert experiment
gkech Mar 24, 2025
4c6b426
cr: add comments on the upstream code
gkech Mar 26, 2025
84350e5
add new entrypoint script and fix unit tests
gkech Mar 28, 2025
41132e6
utilize init container for the new .sh
gkech Apr 3, 2025
cdd7e32
fix references to op paths
gkech Apr 3, 2025
8e5f5c0
create /tmp/postgres
gkech Apr 3, 2025
e410638
fix paths again
gkech Apr 3, 2025
dcb5531
add init container to db pod
gkech Apr 3, 2025
c1f48de
fix imports
gkech Apr 3, 2025
38369c3
add crunchy bin volume to init container
gkech Apr 3, 2025
6c02b69
use the correct init image
gkech Apr 3, 2025
0a6cfff
always enable cr init image
gkech Apr 3, 2025
96ce741
fix mounts
gkech Apr 3, 2025
41afaf7
fix imports ordering
gkech Apr 3, 2025
df5ca7f
revert library check
gkech Apr 3, 2025
9300084
introduce func for instance init
gkech Apr 3, 2025
523038d
temp commit for e2e tests
gkech Apr 4, 2025
dd584de
set ppg image to main
gkech Apr 4, 2025
3a53a41
Merge branch 'main' into K8SPG-708
gkech Apr 4, 2025
61d225b
append init container
gkech Apr 4, 2025
dd07386
use K8SPG-708-12
gkech Apr 4, 2025
75a381d
fix imports
gkech Apr 4, 2025
2258101
K8SPG-613: replace initImage with initContainer
pooknull Apr 3, 2025
04b4eec
fix unit-tests
pooknull Apr 3, 2025
867e656
use inticontainer
gkech Apr 6, 2025
9291383
generate main
gkech Apr 6, 2025
041febb
remove unused ctx
gkech Apr 6, 2025
3843fd2
generate main
gkech Apr 6, 2025
3510a25
fix imports
gkech Apr 6, 2025
62ce7e2
remove ctx from caller
gkech Apr 7, 2025
61f19f6
controller test init image details
gkech Apr 7, 2025
dbe5f09
add image to missing controller test
gkech Apr 7, 2025
bcc09c7
add init container to readTestCR
gkech Apr 7, 2025
a96b148
add init image
gkech Apr 7, 2025
2ea0968
fix TestCustomLabels and TestCustomAnnotations tests
gkech Apr 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

789 changes: 785 additions & 4 deletions build/crd/percona/generated/pgv2.percona.com_perconapgclusters.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions build/postgres-operator/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ COPY --from=go_builder /usr/local/bin/pgbackrest /usr/local/bin/
COPY --from=go_builder /licenses /licenses
COPY build/postgres-operator/install-extensions.sh /usr/local/bin
COPY build/postgres-operator/init-entrypoint.sh /usr/local/bin
COPY build/postgres-operator/postgres-entrypoint.sh /usr/local/bin
COPY build/postgres-operator/postgres-liveness-check.sh /usr/local/bin
COPY build/postgres-operator/postgres-readiness-check.sh /usr/local/bin
COPY hack/tools/queries /opt/crunchy/conf

RUN chgrp -R 0 /opt/crunchy/conf && chmod -R g=u opt/crunchy/conf
Expand Down
3 changes: 3 additions & 0 deletions build/postgres-operator/init-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ set -o xtrace
CRUNCHY_BINDIR="/opt/crunchy"

install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/pgbackrest" "${CRUNCHY_BINDIR}/bin/pgbackrest"
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-entrypoint.sh" "${CRUNCHY_BINDIR}/bin/postgres-entrypoint.sh"
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-liveness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-liveness-check.sh"
install -o "$(id -u)" -g "$(id -g)" -m 0755 -D "/usr/local/bin/postgres-readiness-check.sh" "${CRUNCHY_BINDIR}/bin/postgres-readiness-check.sh"
20 changes: 20 additions & 0 deletions build/postgres-operator/postgres-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# /pgdata/ is already mounted to the pg database container with rw permissions
recovery_file='/pgdata/sleep-forever'
if [[ -f ${recovery_file} ]]; then
set +o xtrace
echo "The $recovery_file file is detected, node entered an infinite sleep"
echo "If you want to exit from the infinite sleep, remove the $recovery_file file"

if [[ ! -d /tmp/postgres ]]; then
mkdir -p /tmp/postgres
fi

while [ -f "${recovery_file}" ]; do
sleep 3
done
exit 0
fi

exec "$@"
20 changes: 20 additions & 0 deletions build/postgres-operator/postgres-liveness-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

PATRONI_PORT=8008
PATRONI_HOST=localhost

# /pgdata/ is already mounted to the pg database container with rw permissions
recovery_file='/pgdata/sleep-forever'
if [ -f "${recovery_file}" ]; then
set +o xtrace
echo "The $recovery_file file is detected, node entered an infinite sleep"
echo "If you want to exit from the infinite sleep, remove the $recovery_file file"
exit 0
fi

response=$(curl -s -o /dev/null -w "%{http_code}" -k "https://${PATRONI_HOST}:${PATRONI_PORT}/liveness")

if [[ $response -eq 200 ]]; then
exit 0
fi
exit 1
11 changes: 11 additions & 0 deletions build/postgres-operator/postgres-readiness-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

PATRONI_PORT=8008
PATRONI_HOST=localhost

response=$(curl -s -o /dev/null -w "%{http_code}" -k "https://${PATRONI_HOST}:${PATRONI_PORT}/readiness")

if [[ $response -eq 200 ]]; then
exit 0
fi
exit 1
789 changes: 785 additions & 4 deletions config/crd/bases/pgv2.percona.com_perconapgclusters.yaml

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,730 changes: 1,646 additions & 84 deletions deploy/bundle.yaml

Large diffs are not rendered by default.

78 changes: 75 additions & 3 deletions deploy/cr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,31 @@ metadata:
# - percona.com/delete-backups
spec:
crVersion: 2.7.0
# initImage: perconalab/percona-postgresql-operator:main
# initContainer:
# image: perconalab/percona-postgresql-operator:main
# resources:
# limits:
# cpu: 2.0
# memory: 4Gi
# containerSecurityContext:
# fsGroup: 1001
# runAsUser: 1001
# runAsNonRoot: true
# fsGroupChangePolicy: "OnRootMismatch"
# runAsGroup: 1001
# seLinuxOptions:
# type: spc_t
# level: s0:c123,c456
# seccompProfile:
# type: Localhost
# localhostProfile: localhost/profile.json
# supplementalGroups:
# - 1001
# sysctls:
# - name: net.ipv4.tcp_keepalive_time
# value: "600"
# - name: net.ipv4.tcp_keepalive_intvl
# value: "60"
# metadata:
# annotations:
# example-annotation: value
Expand Down Expand Up @@ -150,6 +174,31 @@ spec:
instances:
- name: instance1
replicas: 3
# initContainer:
# image: perconalab/percona-postgresql-operator:main
# resources:
# limits:
# cpu: 2.0
# memory: 4Gi
# containerSecurityContext:
# fsGroup: 1001
# runAsUser: 1001
# runAsNonRoot: true
# fsGroupChangePolicy: "OnRootMismatch"
# runAsGroup: 1001
# seLinuxOptions:
# type: spc_t
# level: s0:c123,c456
# seccompProfile:
# type: Localhost
# localhostProfile: localhost/profile.json
# supplementalGroups:
# - 1001
# sysctls:
# - name: net.ipv4.tcp_keepalive_time
# value: "600"
# - name: net.ipv4.tcp_keepalive_intvl
# value: "60"

affinity:
podAntiAffinity:
Expand Down Expand Up @@ -324,8 +373,31 @@ spec:
# metadata:
# labels:
image: perconalab/percona-postgresql-operator:main-pgbackrest17
# initImage: perconalab/percona-postgresql-operator:main
#
# initContainer:
# image: perconalab/percona-postgresql-operator:main
# resources:
# limits:
# cpu: 2.0
# memory: 4Gi
# containerSecurityContext:
# fsGroup: 1001
# runAsUser: 1001
# runAsNonRoot: true
# fsGroupChangePolicy: "OnRootMismatch"
# runAsGroup: 1001
# seLinuxOptions:
# type: spc_t
# level: s0:c123,c456
# seccompProfile:
# type: Localhost
# localhostProfile: localhost/profile.json
# supplementalGroups:
# - 1001
# sysctls:
# - name: net.ipv4.tcp_keepalive_time
# value: "600"
# - name: net.ipv4.tcp_keepalive_intvl
# value: "60"
# containers:
# pgbackrest:
# resources:
Expand Down
Loading
Loading