Skip to content

fix(dataprotection): validate restored PV provenance before completion - #10778

Open
leon-ape wants to merge 11 commits into
mainfrom
bugfix/10755-validate-restore-rebind
Open

fix(dataprotection): validate restored PV provenance before completion#10778
leon-ape wants to merge 11 commits into
mainfrom
bugfix/10755-validate-restore-rebind

Conversation

@leon-ape

@leon-ape leon-ape commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Part 4 of 4 for #10755.

Problem

An already-bound target PVC was accepted as restore output without checking whether its PV was actually rebound by VolumePopulator.

Changes

  • validate an existing target binding before changing the helper PV
  • validate the target PV exists through the controller's cached client
  • validate ClaimRef namespace/name and UID identify the target PVC
  • validate the existing PV populate-from annotation matches the target dataSourceRef
  • requeue transient cache lookup gaps; reject definitively foreign bindings before helper cleanup
  • validate that a PV still belongs to the helper PVC immediately before rebinding it
  • use optimistic locking so a concurrent ClaimRef change is not overwritten

Scope

This is minimum rebind validation only. It does not add provisioner compatibility detection, attempt identity, legacy restore adoption, Cluster finalizers, cleanup refactoring, or workload changes. It performs no uncached reads.

Tests

  • full controllers/dataprotection suite
  • focused valid/foreign/missing-PV, cache-ordering, helper-preservation, rebind ownership, and concurrent-change tests

Fixes #10755

@leon-ape leon-ape added the nopick Not auto cherry-pick when PR merged label Aug 13, 2026
@apecloud-bot

Copy link
Copy Markdown
Collaborator

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

CLA Recheck Instructions

Usage:
  - /recheck-cla: Trigger a re-check of CLA status for this pull request.
Example:
  - /recheck-cla

@github-actions github-actions Bot added the size/L Denotes a PR that changes 100-499 lines. label Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 69.92481% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.92%. Comparing base (6d7846f) to head (237520f).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...llers/dataprotection/volumepopulator_controller.go 69.92% 27 Missing and 13 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10778      +/-   ##
==========================================
+ Coverage   64.86%   64.92%   +0.05%     
==========================================
  Files         506      506              
  Lines       63300    63428     +128     
==========================================
+ Hits        41058    41178     +120     
- Misses      18603    18604       +1     
- Partials     3639     3646       +7     
Flag Coverage Δ
unittests 64.92% <69.92%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leon-ape leon-ape changed the title fix: validate restored PV provenance before completion fix(dataprotection): validate restored PV provenance before completion Aug 13, 2026
@leon-ape
leon-ape marked this pull request as ready for review August 13, 2026 10:01
@leon-ape
leon-ape requested review from a team, ldming and wangyelei as code owners August 13, 2026 10:01
@github-actions github-actions Bot added size/XL Denotes a PR that changes 500-999 lines. and removed size/L Denotes a PR that changes 100-499 lines. labels Aug 14, 2026
@github-actions github-actions Bot added size/L Denotes a PR that changes 100-499 lines. and removed size/XL Denotes a PR that changes 500-999 lines. labels Sep 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nopick Not auto cherry-pick when PR merged size/L Denotes a PR that changes 100-499 lines.

Projects

None yet

2 participants