Skip to content

Bug Report: enable_pod_antiaffinity not applied to pooler DeploymentΒ #2930

@s-kopachev

Description

@s-kopachev

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? e.g. ghcr.io/zalando/postgres-operator:v1.13.0c / 1.14.0
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? [AWS K8s]
  • Are you running Postgres Operator in production? [yes]
  • Type of issue? [Bug report]
    Bug Report: enable_pod_antiaffinity not applied to pooler Deployment
    We are encountering an issue with the PostgreSQL Operator.

When we change the following configuration:

configKubernetes:
  enable_pod_antiaffinity: false

the change is correctly applied to the StatefulSet of the PostgreSQL cluster, but it is ignored for the pooler Deployment.

To apply the change to the pooler, we have to manually delete the Deployment, which triggers the operator to re-create it. After recreation, the Deployment has the correct affinity settings.

There is no relevant information in the operator logs during this process.

This behavior has been confirmed on both v1.13 and v1.14 of the PostgreSQL Operator.

Steps to Reproduce
Change the config:

configKubernetes:
  enable_pod_antiaffinity: false

Observe the affinity sections of the StatefulSet and the pooler Deployment.
Example Output
StatefulSet (expected):

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
        - matchExpressions:
            - key: node-role.kubernetes.io/postgresql
              operator: Exists

Deployment (unexpected):

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
        - matchExpressions:
            - key: node-role.kubernetes.io/postgresql
              operator: Exists
  podAntiAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      - labelSelector:
          matchLabels:
            application: db-connection-pooler
            connection-pooler: test-db-pooler
            dev: test-db
        topologyKey: kubernetes.io/hostname

As shown above, podAntiAffinity is still present in the pooler Deployment, even though enable_pod_antiaffinity is set to false.

This issue may potentially affect other parameters under configKubernetes, but so far we have only encountered the problem with enable_pod_antiaffinity. Other settings seem to behave as expected in our environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions