You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: bootstrap-instance deadlocks with the operator on a multi-instance restore from orphaned PVCs #11491
I have searched for an existing issue, and could not find anything. I believe this is a new bug.
I have read the troubleshooting guide
I have read the troubleshooting guide and I think this is a new bug.
I am running a supported version of CloudNativePG
I have read the troubleshooting guide and I think this is a new bug.
Version
trunk (main). The fix that caused this (#11450) is not in any released version yet.
What version of Kubernetes are you using?
any. This is a control-flow bug, not tied to a Kubernetes version.
What is your Kubernetes environment?
Self-managed: kind (evaluation)
How did you install the operator?
Other
What happened?
Restore a Cluster from orphaned PVCs (PVCs and Cluster CR recreated, CR status empty, the normal state after any snapshot or backup-tool restore) with 2 or more instances. The cluster gets stuck for good, not just slow.
Two code paths wait on each other:
Reconcile runs reconcileRestoredCluster before createPostgresClusterObjects (internal/controller/cluster_controller.go:358 and :371). The restore path calls ensureInitContainersAreCompleted (internal/controller/cluster_restore.go:359), which requeues and returns early if any instance pod's init container is not Terminated yet.
That early return skips createPostgresClusterObjects too, so setupPostgresPKI never runs. That call is what writes Cluster.Status.Certificates.
Step 3 needs step 2 to run. Step 2 needs step 3's container to finish first. Neither happens.
WaitForClusterCertificates's own comment says the operator never waits on this pod before writing the status. In this restore path, it does.
Expected: the cluster comes up like any other restore.
Relevant log output
# operator, repeats every 5s, never moves past this:
found orphan pvcs, trying to restore the cluster
init container running, waiting for completion podName=<replica> initContainerName=bootstrap-instance
# replica's bootstrap-instance container, last line it ever logs:
Waiting for the operator to write the certificate status
Activity
fix(restore): break certificate-wait deadlock in orphan-PVC restore (#…
fix(restore): break certificate-wait deadlock in orphan-PVC restore (#…
fix(restore): break certificate-wait deadlock in orphan-PVC restore (#…
fix(restore): break certificate-wait deadlock in orphan-PVC restore (c…
fix(restore): break certificate-wait deadlock in orphan-PVC restore (c…
revert(restore): break certificate-wait deadlock in orphan-PVC restore
revert(restore): break certificate-wait deadlock in orphan-PVC restore (
revert(restore): break certificate-wait deadlock in orphan-PVC restore (
revert(restore): break certificate-wait deadlock in orphan-PVC restore (
revert(restore): break certificate-wait deadlock in orphan-PVC restore (
fix(restore): stop the orphan-PVC restore gate waiting on our own ini…