Skip to content

Restored Cluster cannot adopt a leftover primary Lease #11737

Description

@gbartolini

A Cluster recreated over the resources it left behind, for example by a backup tool, finds its primary Lease already there with no owner. The operator adopts it by setting the ownerReference. With the OwnerReferencesPermissionEnforcement admission plugin, the API server only allows that for callers that can delete the object. The operator couldn't, so the restored Cluster stayed in "Unable to create required cluster objects" with cannot set an ownerRef on a resource you can't delete.

The fix has two parts:

  • Grant delete on leases to the operator.
  • When the Cluster is restored over orphan PVCs with no status, delete the ownerless Lease and create a fresh one. No instance is running yet, so the old holder is stale and adopting it would delay the new primary by a lease duration. Any other leftover Lease is still adopted.

This issue is being created after the PR (#11609), exceptionally, to group all the lease-related changes under the #11721 epic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions