fix(test-env): make PG entrypoint idempotent for PVC reuse
Image entrypoint uses set -e + CREATE USER without IF NOT EXISTS. On PVC reuse the role already exists → entrypoint exits with code 1. Patch: sed replaces CREATE USER with IF NOT EXISTS variant at startup.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user