Skip to content

fix(operator): let the sidecar env override the inherited one - #1251

Open
AdzerKI wants to merge 1 commit into
cloudnative-pg:mainfrom
AdzerKI:sidecar-env-precedence
Open

AdzerKI wants to merge 1 commit into
cloudnative-pg:mainfrom
AdzerKI:sidecar-env-precedence

Conversation

@AdzerKI

@AdzerKI AdzerKI commented Nov 19, 2026 •

Copy link
Copy Markdown

reconcilePodSpec copied the postgres container env into the sidecar first and added instanceSidecarConfiguration.env only for names not already present, so a variable the instance defines (TMPDIR, PGHOST, ...) could not be set for the sidecar.

The configured env is now merged first, then the main container env, then the defaults. The "append if the name is missing" loop, needed a third time now, moves into appendMissingEnvs.

Closes #1250

The sidecar env was built from the postgres container env first, and
the defaults and `instanceSidecarConfiguration.env` were added only for
names not already there. A variable the instance already defines, such
as `TMPDIR` or `PGHOST`, could not be changed for the sidecar.

Merge the configured env first, then the main container env and the
defaults, so the explicit configuration takes precedence.

Closes cloudnative-pg#1250

Signed-off-by: AdzerKI <silver_cat@list.ru>
@AdzerKI
AdzerKI requested a review from a team as a code owner November 19, 2026 08:22

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: instanceSidecarConfiguration.env can't override env inherited from the postgres container

1 participant