diff --git a/test-env/postgres/statefulset.yaml b/test-env/postgres/statefulset.yaml index 76a5f5f..e399a52 100644 --- a/test-env/postgres/statefulset.yaml +++ b/test-env/postgres/statefulset.yaml @@ -38,7 +38,18 @@ spec: containers: - name: postgres image: benadis/pg-1c:18.1-2.1C - # Use the image's built-in entrypoint (configures 1C on first run) + # Override entrypoint to handle "role already exists" on PVC reuse. + # The image entrypoint uses `set -e` + CREATE USER without IF NOT EXISTS, + # causing crash when PVC already has the user from a previous init. + command: + - bash + - -c + - | + # Patch entrypoint: make CREATE USER idempotent. + # Image entrypoint uses `set -e` + bare CREATE USER which fails + # when PVC is reused and the role already exists. + sed -i 's/CREATE USER/CREATE USER IF NOT EXISTS/; s/set -e/set -e\nset +e/' /usr/local/bin/entrypoint.sh 2>/dev/null || true + exec /usr/local/bin/entrypoint.sh postgres env: - name: LANG value: "ru_RU.UTF-8"