fix: clean up deleting restore PVCs - #10605
Conversation
|
Auto Cherry-pick Instructions CLA Recheck Instructions |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10605 +/- ##
==========================================
- Coverage 63.97% 63.94% -0.03%
==========================================
Files 520 520
Lines 62887 62942 +55
==========================================
+ Hits 40229 40249 +20
- Misses 19071 19101 +30
- Partials 3587 3592 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Handle deletion before source validation so a missing backup cannot strand the data protection finalizer. Keep the target finalizer until owned populate jobs and the helper PVC are confirmed absent on a fresh reconcile.
0e627e7 to
abef483
Compare
Return transient cleanup failures through the outer reconcile handler even when the deleting PVC already has a Populating condition. Exercise every cleanup API failure through Reconcile so the finalizer cannot become stranded. Refs #10606
|
Closing this PR as superseded by #10777. #10605 established several useful cleanup invariants: stop the execution Restore before dependent cleanup, observe Restore/helper absence before releasing the target PVC finalizer, and keep cleanup API failures retryable. Those invariants should be retained, but the cleanup must be coordinated by the Cluster restore lifecycle rather than by a parallel PVC-local deletion workflow. #10777 provides the stronger ownership model: a Cluster restore finalizer, Cluster UID identity, verified owner references, direct API-server reads, ordered Cluster-wide teardown, and legacy-resource adoption. It is now the authoritative implementation path. Direct deletion of an active restore target PVC is treated as an unsupported/destructive management operation and should remain fail-closed instead of triggering autonomous DP cleanup. Any remaining safety checks and failure-path tests from this PR should be carried into #10777 where they apply. No commits from this PR need to be merged directly. |
Summary
Fixes #10606.
Retry contract
A deleting PVC is still owned by the volume-populator controller until cleanup converges. Ordinary API errors from execution-Restore cleanup, Job cleanup, helper-PVC cleanup, or target-finalizer removal must therefore reach controller-runtime and be retried. The outer handler keys this rule from
deletionTimestamp; it deliberately does not re-check the in-memory finalizer because Cleanup removes that local value before attempting the final Patch, and a failed Patch means the persisted finalizer still exists.The existing Populating-condition suppression remains limited to non-deleting PVCs whose external controller owns subsequent progress.
Tests
Reconcilepath, asserts the injected error reaches controller-runtime, and proves the persisted target finalizer remainsKUBEBUILDER_ASSETS='<envtest 1.26.1 assets>' go test ./controllers/dataprotection -count=1go test -racefor deletion and outer-handler casesgo vet ./controllers/dataprotectiongit diff --checkValidation on exact head
35f7f55c14e6c76208aab161d11c3ad35313e359is green. Runtime environment coverage remains N=0.Supersedes #10604, which was closed when its non-conforming source branch was renamed.