Skip to content

[Bug]: alpha.cnpg.io/unrecoverable annotation has no effect on Terminating or Pending pods #10926

Closed

Description

@daanvinken

Is there an existing issue already for this bug?

  • 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.

Contact Details

[email protected]

Version

1.29 (latest patch)

What version of Kubernetes are you using?

1.36

What is your Kubernetes environment?

Other

How did you install the operator?

YAML manifest

What happened?

What happened

The alpha.cnpg.io/unrecoverable annotation is ineffective for pods in Terminating or Pending state. These are the two most common states during node maintenance with local storage (e.g., OpenEBS LVM):

  1. Unreachable node: pods get a DeletionTimestamp (Terminating) that the kubelet can't confirm, so they stay Terminating indefinitely.
  2. Drained node with local storage: pods get evicted and recreated, but the new pod can't be scheduled because the PVC is bound to the cordoned node. The pod sits in Pending.

In both cases, applying alpha.cnpg.io/unrecoverable=true has no effect because the reconciliation loop exits before reaching reconcileUnrecoverableInstances:

  1. getManagedInstances includes Terminating and Pending pods (no filter)
  2. allInstancesAreActive() returns false because IsPodActive rejects both DeletionTimestamp != nil and PodPending phase
  3. The reconciler returns early with a 1-second requeue, never reaching reconcilePods → reconcileUnrecoverableInstances

Relationship to #9947 / #9968

PR #9968 solved a related but different problem: pods that are not ready but still active (e.g., postgres not running, startup probe failing). That fix moved reconcileUnrecoverableInstances before the non-ready gate inside reconcilePods. However, the allInstancesAreActive() gate runs before reconcilePods is called, so Terminating and Pending pods are still blocked.

Expected behavior

Annotating a Terminating or Pending pod with alpha.cnpg.io/unrecoverable=true should cause the operator to delete the pod and its PVCs, allowing a new instance to be created on a healthy node. The PVCs will go Terminating but are already ignored by the instance counter due to DeletionTimestamp filtering.

For the Terminating variant, the pvc-protection finalizer holds PVC deletion while the pod object exists, so the implementation would also need to force-remove the pod (with appropriate safety checks if it was a primary).

Possible approaches

  1. Move reconcileUnrecoverableInstances before the allInstancesAreActive() gate (similar to what fix: allow unrecoverable annotation to work on non-ready pods #9968 did for the non-ready gate)
  2. Exclude pods annotated with alpha.cnpg.io/unrecoverable=true from the allInstancesAreActive() check

I'm happy to create/contribute myself once we settle on an approach.

Environment

  • CNPG 1.28.x, verified against latest main (946085b0b)
  • Bare-metal Kubernetes with OpenEBS LVM local storage (~200 clusters)

Related

Cluster resource

NA

Relevant log output

None, not triggered.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. daanvinken commented on Jun 18, 2026

    @daanvinken
    ContributorAuthor

    @mnencia @gbartolini any input from you guys here? We were directed by EDB to work through this via the CNPG project itself. I'm happy to contribute here, after an approach has been decided on.

  2. added
    bug 🐛
    and removed on Jun 21, 2026
  3. added a commit that references this issue on Aug 10, 2026
    611eedf
  4. added 3 commits that reference this issue on Aug 10, 2026
    b99f8e0
    da11e10
    d30fb22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug 🐛triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions