feat(ops): select backup source target for scale-out restore - #10594
Conversation
|
Auto Cherry-pick Instructions CLA Recheck Instructions |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10594 +/- ##
==========================================
+ Coverage 65.61% 65.76% +0.15%
==========================================
Files 510 510
Lines 64400 64405 +5
==========================================
+ Hits 42254 42357 +103
+ Misses 18388 18314 -74
+ Partials 3758 3734 -24
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:
|
|
This change has a data-safety blocker and also duplicates the DataProtection owner's resolution contract. [P0] The generated Restore points at the wrong namespace for cross-namespace Backups. [P1] Source-target resolution belongs to the DataProtection Restore path, not Ops/plan. This PR adds |
|
Addressed the P0/P1 blockers in exact head
RED before implementation reproduced both failures: the generated Restore used the Cluster namespace, and the plan rejected the explicit selector before DataProtection could observe it. GREEN on the exact head:
The PR remains Draft until exact-head CI and review verification close. |
|
/nopick |
6ba5a87 to
1cd4d06
Compare
Use restore template ordinals when selecting source pods for snapshot and prepare-data paths. Propagate explicit backup targets without resolving them in Ops so DataProtection remains the validation owner.
…-source-target # Conflicts: # cmd/dataprotection/main.go # cmd/manager/main.go # pkg/dataprotection/restore/manager.go # pkg/operations/horizontal_scaling_test.go
|
/approve |
Fixes #10595.
Problem
scaleOut.fromBackupcan restore new replicas from a Backup, but the Ops API did not expose a source-target selector even thoughRestore.spec.backup.sourceTargetNamealready supports one.For a Backup with multiple source targets, horizontal scale-out had no way to choose the target whose data should be restored.
What changed
scaleOut.fromBackup.sourceTargetNameto the Ops API, generated CRDs, and API documentation.Restore.spec.backup.sourceTargetNamefor the PrepareData/PVC scale-out restore path.main.Scope
DataProtection already supports selecting a Backup target through
Restore.spec.backup.sourceTargetName. Annotation-based restore is one existing producer of that field.This PR does not add or change DataProtection target-selection capability. It only exposes the existing selector on
OpsRequest.scaleOut.fromBackupand passes the OpsRequest value to the generated PrepareData Restore.The two correctness/safety fixes originally developed here were split into:
Validation
scripts/codex-go-test.sh ./pkg/controller/plan -count=1scripts/codex-go-test.sh ./pkg/operations -count=1scripts/codex-go-test.sh ./controllers/dataprotection -count=1git diff --checkAll three affected packages pass on the exact branch tree after synchronizing with
main. This includes the VolumePopulator case that failed on the previous head.Backport analysis
DataProtection in
release-1.1already supportsRestore.spec.backup.sourceTargetName. The annotation-based restore flow also already populates this field fromkubeblocks.io/backup-source-target, including automatic target allocation for sharded restores.The 1.1 gap is specifically in Operations:
OpsRequest.scaleOut.fromBackuphas nosourceTargetNamefield;Recommendation: backport only if explicit per-OpsRequest source-target selection is required in 1.1. That requires an independent 1.1 PR because the direct cherry-pick conflicts with the release-specific annotation-based plan implementation. No DataProtection capability backport is needed.
As a feature extension,
release-1.0was intentionally not evaluated.