zalando / zalando/postgres-operator
Bug Report: enable_pod_antiaffinity not applied to pooler Deployment
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.2k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 3
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the configKubernetes enable_pod_antiaffinity change and compare the PostgreSQL StatefulSet with the pooler Deployment. Trace how each resource is reconciled and verify that the pooler Deployment removes podAntiAffinity when the setting is false, without requiring manual deletion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100