Skip to content

Conversation

@PavelZaytsev
Copy link

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:

  • PostgreSQL 17 cluster with custom SPILO_CONFIGURATION
  • Verified that user-provided env vars properly override operator-generated ones
  • Confirmed Patroni configuration contains both operator defaults and user customizations
  • Validated that ignore_slots configuration works correctly with native PostgreSQL 17 slot synchronization

Example working configuration:

apiVersion: "acid.zalan.do/v1"
kind: postgresql
spec:
  env:
    - name: SPILO_CONFIGURATION
      value: |
        bootstrap:
          dcs:
            ignore_slots:
              - type: logical

Result: Patroni config includes both operator settings (ttl, loop_wait, etc.) and user's ignore_slots configuration.

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.
@zalando-robot
Copy link

Cannot start a pipeline due to:

No accountable user for this pipeline: no Zalando employee associated to this GitHub username

Click on pipeline status check Details link below for more information.

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.

2 participants