feat(replica): clean up Pending PVCs with deleted VolumeSnapshot dataSource by leonardoce · Pull Request #10223 · cloudnative-pg/cloudnative-pg

and others added 2 commits

March 9, 2026 11:40
…ge source (#10029)

When a cluster is bootstrapped from a VolumeSnapshot that is later
deleted, adding replicas would fail because the operator referenced
the deleted snapshot as data source for new PVCs, leaving them stuck
in Pending state indefinitely.

Add VolumeSnapshot existence validation in GetCandidateStorageSourceForReplica
and getCandidateSourceFromBackupList. When a referenced snapshot no longer
exists, the operator now skips it and tries the next candidate or falls
back to pg_basebackup for replica creation.

Co-Authored-By: simonapencea <simona@xata.io>
Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
…ource

When a VolumeSnapshot is deleted after a PVC has already been created
with it as dataSource, the PVC stays in Pending state indefinitely
and the associated restore Job blocks the reconciliation loop.

Add DeletePVCsWithMissingVolumeSnapshots to detect Pending PVCs whose
VolumeSnapshot dataSource no longer exists and delete them along with
any associated Job, allowing the operator to retry replica creation
via pg_basebackup on the next reconciliation.

Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>

@dosubot dosubot bot added size:L

This PR changes 100-499 lines, ignoring generated files.

bug 🐛

Something isn't working

labels

Mar 9, 2026

@leonardoce leonardoce changed the title fix(replica): clean up Pending PVCs with deleted VolumeSnapshot dataSource feat(replica): clean up Pending PVCs with deleted VolumeSnapshot dataSource

Mar 9, 2026

Base automatically changed from dev/10029 to main

March 11, 2026 01:07

@dosubot dosubot bot added size:XL

This PR changes 500-999 lines, ignoring generated files.

and removed size:L

This PR changes 100-499 lines, ignoring generated files.

labels

Mar 11, 2026