Skip to content

fix(dataprotection): preserve backup namespace for cross-namespace restores - #10834

Merged
leon-ape merged 4 commits into
release-1.0from
bugfix/cross-namespace-backup-restore-release-1.0
Sep 1, 2026
Merged

fix(dataprotection): preserve backup namespace for cross-namespace restores#10834
leon-ape merged 4 commits into
release-1.0from
bugfix/cross-namespace-backup-restore-release-1.0

Conversation

@leon-ape

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

Copy link
Copy Markdown
Collaborator

Backport of #10827 for release-1.0; related issue: #10829.

The final #10827 diff cannot be cherry-picked cleanly onto this branch: it conflicts in pkg/controller/plan/restore_test.go, and pkg/dataprotection/restore/utils_test.go is absent from the original release base. This PR applies the same behavior to the release-specific controller layout and keeps tests in the standard restore_test.go, utils_test.go, and manager_test.go files.

What changed

  • Preserve the referenced Backup namespace in the release-specific preview, prepare-data, and post-ready Restore paths.
  • Keep the existing default support for non-VolumeSnapshot cross-namespace Backup references; do not introduce ReferenceGrant or a new authorization contract.
  • Keep the existing TODO for a future general cross-namespace permission check.
  • Resolve the complete restore dependency chain before rejecting cross-namespace VolumeSnapshot Backups, including PITR-selected base snapshots.
  • Preserve the VolumeSnapshot marker on continuous restore base Backup sets.
  • Reject a PITR-selected base Backup without status.backupMethod with a fatal error instead of panicking while reading snapshotVolumes.
  • Explicitly document cross-namespace VolumeSnapshot restore as NOT supported and regenerate CRDs and API reference docs.
  • Keep the focused tests aligned with fix(dataprotection): preserve backup namespace for cross-namespace restores #10827 and place them in the standard test files.
  • Synchronize the branch with the latest release-1.0, retaining both sides of the utils_test.go additions.

Validation

  • scripts/codex-go-test.sh ./pkg/dataprotection/restore ./pkg/controller/plan ./controllers/dataprotection ./pkg/operations -count=1
  • make manifests
  • make doc
  • git diff --check

All targeted tests pass.

@leon-ape
leon-ape requested review from a team, ldming and wangyelei as code owners August 31, 2026 10:15
@github-actions github-actions Bot added the size/L Denotes a PR that changes 100-499 lines. label Aug 31, 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

@leon-ape leon-ape changed the title fix: preserve cross-namespace backup restores (release-1.0) chore(dataprotection): backport cross-namespace restore fix to 1.0 Aug 31, 2026
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.31%. Comparing base (1d97fb1) to head (580d55b).
⚠️ Report is 1 commits behind head on release-1.0.

Files with missing lines Patch % Lines
pkg/dataprotection/restore/utils.go 70.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@               Coverage Diff               @@
##           release-1.0   #10834      +/-   ##
===============================================
+ Coverage        54.14%   54.31%   +0.16%     
===============================================
  Files              495      495              
  Lines            55950    56066     +116     
===============================================
+ Hits             30296    30450     +154     
+ Misses           22647    22589      -58     
- Partials          3007     3027      +20     
Flag Coverage Δ
unittests 54.31% <87.50%> (+0.16%) ⬆️

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 added the nopick Not auto cherry-pick when PR merged label Aug 31, 2026
@leon-ape

Copy link
Copy Markdown
Collaborator Author

/approve

@apecloud-bot apecloud-bot added the approved PR Approved Test label Aug 31, 2026
@leon-ape leon-ape changed the title chore(dataprotection): backport cross-namespace restore fix to 1.0 fix(dataprotection): preserve backup namespace for cross-namespace restores Aug 31, 2026
@apecloud-bot apecloud-bot removed the approved PR Approved Test label Sep 1, 2026
…amespace-backup-restore-release-1.0

# Conflicts:
#	pkg/dataprotection/restore/utils_test.go
@leon-ape
leon-ape merged commit 1530e91 into release-1.0 Sep 1, 2026
25 checks passed
@leon-ape
leon-ape deleted the bugfix/cross-namespace-backup-restore-release-1.0 branch September 1, 2026 04:09
@github-actions github-actions Bot added this to the Release 1.2.0 milestone 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

Development

Successfully merging this pull request may close these issues.

Cross-namespace Backup restores need correct namespace and authorization

2 participants