Skip to content

Check cluster UID#3019

Draft
mikkeloscar wants to merge 4 commits into
masterfrom
check-cluster-UID
Draft

Check cluster UID#3019
mikkeloscar wants to merge 4 commits into
masterfrom
check-cluster-UID

Conversation

@mikkeloscar

Copy link
Copy Markdown
Member

In situations where an existing Postgresql cluster is deleted and a new cluster, with the same name, is created, then the operator can get "confused" because it still holds the internal state of the previous cluster.

To avoid operating on the old state, check if the UID matches and mark the cluster as not found if it doesn't.

@mikkeloscar mikkeloscar force-pushed the check-cluster-UID branch 5 times, most recently from e0417c9 to 140f6be Compare January 13, 2026 16:25
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
@FxKu FxKu added this to the 2.0.0 milestone Jun 25, 2026
@FxKu FxKu moved this to WIP / currently reviewed in Postgres Operator Jun 25, 2026
c.clustersMu.RLock()
cl, clusterFound := c.clusters[clusterName]
if clusterFound && cl.UID != clusterUID {
clusterFound = false

@FxKu FxKu Jul 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will lead to an error during deletion, see

Must be the reason why e2e tests always fail with the cluster deletion test (if they even get there)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: WIP / currently reviewed

Development

Successfully merging this pull request may close these issues.

2 participants