-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Allow user env vars to override operator-generated ones #2983
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
base: master
Are you sure you want to change the base?
Conversation
This change modifies appendEnvVars() to allow environment variables defined in the PostgreSQL CRD spec.env to override operator-generated environment variables (like SPILO_CONFIGURATION) instead of being silently ignored. Previously, if an env var already existed in the list, user-provided values were skipped. Now, user values take precedence and replace the operator-generated ones. This enables users to customize SPILO_CONFIGURATION and other operator-managed env vars through the CRD, which is useful for adding custom Patroni DCS configuration like ignore_slots.
|
Cannot start a pipeline due to: Click on pipeline status check Details link below for more information. |
|
Please add a test case covering this change |
|
Cannot start a pipeline due to: Click on pipeline status check Details link below for more information. |
This test verifies that user-provided environment variables from spec.env can override operator-generated ones (like SPILO_CONFIGURATION), which is useful for customizing Patroni DCS configuration such as ignore_slots.
|
Cannot start a pipeline due to: Click on pipeline status check Details link below for more information. |
|
Cannot start a pipeline due to: Click on pipeline status check Details link below for more information. |
|
@mikkeloscar I have added the test case |
This change modifies appendEnvVars() to allow environment variables defined in the PostgreSQL CRD spec.env to override operator-generated environment variables (like SPILO_CONFIGURATION) instead of being silently ignored.
Previously, if an env var already existed in the list, user-provided values were skipped. Now, user values take precedence and replace the operator-generated ones.
This enables users to customize SPILO_CONFIGURATION and other operator-managed env vars through the CRD, which is useful for adding custom Patroni DCS configuration like ignore_slots.
Testing
Tested with:
SPILO_CONFIGURATIONignore_slotsconfiguration works correctly with native PostgreSQL 17 slot synchronizationExample working configuration:
Result: Patroni config includes both operator settings (ttl, loop_wait, etc.) and user's ignore_slots configuration.