Repository navigation
fix(restore): clean up the orphan primary Lease and grant delete on leases - #11609
Conversation
|
❗ By default, the pull request is configured to backport to all release branches.
|
|
/test |
|
@armru, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/37308287515 |
135c9cb to
ca245b7
Compare
8864db5 to
a45d1de
Compare
|
/test |
|
@leonardoce, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/38566769955 |
a45d1de to
9c46f7a
Compare
|
A single combination didn't start because of a network error. Approving. |
A Cluster recreated over the resources it left behind, for example by a backup tool, finds its primary Lease already there without an owner. The operator adopts it by setting the ownerReference, but with the `OwnerReferencesPermissionEnforcement` admission plugin the API server only allows that to callers that can delete the object. The operator could not, so the restored Cluster stayed in "Unable to create required cluster objects" with `cannot set an ownerRef on a resource you can't delete`. Grant `delete` on leases. The operator never deletes a Lease; the verb is only there to satisfy that admission check. An e2e test deletes a Cluster with orphan propagation, recreates it, and checks that it gets ready and owns the old Lease. Signed-off-by: Armando Ruocco <[email protected]>
Signed-off-by: Leonardo Cecchi <[email protected]>
The restore cleanup deletes a Lease without owner, while any other leftover is adopted. Say so in the doc comment and in the upgrade notes, and drop the word that needed a wordlist entry. Signed-off-by: Marco Nenciarini <[email protected]>
9c46f7a to
4af6ab4
Compare
|
/test |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/39640212368 |
Signed-off-by: Marco Nenciarini <[email protected]>
The operator can adopt the Lease again while the Cluster is being deleted, after the garbage collector orphaned it, and the Lease is then lost. The spec failed before reaching the code it covers. Build the orphan Lease after the Cluster and its Pods are gone instead. Signed-off-by: Marco Nenciarini <[email protected]>
34ed2cb to
99ab7cf
Compare
|
/test depth=push ft=self-healing |
|
Related to #11721 |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/39745160180 |
|
/test depth=main ft=self-healing |
|
@mnencia, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/39745656452 |
…eases (#11609) A Cluster recreated over the resources it left behind, for example by a backup tool, finds its primary Lease already there without an owner. The operator adopts it by setting the ownerReference, but with the `OwnerReferencesPermissionEnforcement` admission plugin the API server only allows that to callers that can delete the object. The operator could not, so the restored Cluster stayed in "Unable to create required cluster objects" with `cannot set an ownerRef on a resource you can't delete`. Grant `delete` on leases. A leftover Lease is still adopted, except when the Cluster is restored over orphan PVCs with no status: no instance runs yet, so the old holder is stale and adopting it would delay the new primary by a lease duration. There the operator deletes the Lease without owner, as it does for orphan Pods, and creates a fresh one. An e2e test deletes a Cluster with orphan propagation, recreates it, and checks that it gets ready and owns a new Lease. Related to #11721 Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Leonardo Cecchi <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Leonardo Cecchi <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit 2a54673)
A Cluster recreated over the resources it left behind, for example by a backup tool, finds its primary Lease already there without an owner. The operator adopts it by setting the ownerReference, but with the
OwnerReferencesPermissionEnforcementadmission plugin the API server only allows that to callers that can delete the object. The operator could not, so the restored Cluster stayed in "Unable to create required cluster objects" withcannot set an ownerRef on a resource you can't delete.Grant
deleteon leases. A leftover Lease is still adopted, except when the Cluster is restored over orphan PVCs with no status: no instance runs yet, so the old holder is stale and adopting it would delay the new primary by a lease duration. There the operator deletes the Lease without owner, as it does for orphan Pods, and creates a fresh one. An e2e test deletes a Cluster with orphan propagation, recreates it, and checks that it gets ready and owns a new Lease.Closes #11737