zalando / zalando/postgres-operator
Zalando operator switch postgresqls.acid.zalan.do state to Running while no one replica successfully started
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 5.2k
- Forks
- 1.1k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 3
Description
- Which image of the operator are you using? registry.opensource.zalan.do/acid/postgres-operator:v1.10.0
- **Where do you run it - cloud or metal? ### Kubernetes
- Are you running Postgres Operator in production? no
- Type of issue? Bug report
I've found some interesting behaviour with zalando-operator,
- When
postgresqls.acid.zalan.docreated with resource request (cpu/ram) or Node affinity with big/inappropriate values --> the goal is that Kubernetes Scheduler can not deploy no one replica and even first must get stuckPendingstate ). - So, then as we expect 1st replica get stuck in Pending bc of e.g. insufficient cpu in resource request.
- Thus during the cluster creation that https://github.com/zalando/postgres-operator/blob/af084a5a650527c43f0c0fc579551a741e77f5c8/pkg/cluster/cluster.go#L328 validation will fail and
postgresqls.acid.zalan.doCR is switched toCreateFailedstate. - However, after some time zalando-operator switch database to Running (after or during sync) state. So, there will be still 1 Pod getting stuck in Pending however status of whole
postgresqls.acid.zalan.doinstance will be Running.
Its actually confusing. Unfortunately I didn't find the reason in zalando-operator code and here is the question:
Was this implemented intentionally for some reasons or is this incorrect behaviour? Since I don't really understand why the zalando-operator marks it as Running state, when in fact no one replica has even started and Create method has not completed successfully.
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 in pkg/cluster/cluster.go at the Create method around line 244 and the validation around line 328. Reproduce a cluster with resource requests or node affinity that leaves its first replica Pending, then trace the sync behavior that changes the CR state. Done means the observed state transition is explained and the status accurately reflects whether a replica started.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes, postgresql
- Domain
- databases, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100