kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

chore: switch restore ops to cluster restore API

Open leon-ape opened this issue 6 months ago • 1 comments

Summary

Switch restore ops to the new Cluster restore API and remove the old annotation-based restore plumbing.

Changes

  • Make restore ops build target Clusters with spec.restore.
  • Make restore ops wait on apps restore condition plus final Cluster phase.
  • Stop writing kubeblocks.io/restore-from-backup.
  • Remove old restore annotation constants, backup source target bridge, and dead restore-manager annotation parsing.
  • Keep h-scale behavior conservative: single backup target can be inferred, multi-target backups fail fast with a TODO for explicit source target selection.
  • Update restore examples to use Cluster.spec.restore.

Not included

  • No new public API.
  • No apps restore intent projection changes.
  • No dataprotection Backup-kind PVC runtime changes.

Validation

  • make generate
  • make manifests
  • make doc
  • make fmt
  • make lint
  • KUBEBUILDER_ASSETS="/Users/leon/Library/Application Support/io.kubebuilder.envtest/k8s/1.26.1-darwin-arm64" go test ./pkg/operations -run TestAPIs
  • KUBEBUILDER_ASSETS="/Users/leon/Library/Application Support/io.kubebuilder.envtest/k8s/1.26.1-darwin-arm64" go test ./pkg/controller/plan
  • KUBEBUILDER_ASSETS="/Users/leon/Library/Application Support/io.kubebuilder.envtest/k8s/1.26.1-darwin-arm64" go test ./controllers/dataprotection ./controllers/apps/cluster/... ./controllers/apps/component/...

Diff audit

Compared with the original large branch, the stacked result only differs by generated InstanceSet CRD/API docs from make manifests/doc, a test-only removal of a DP constant import from pkg/controllerutil/volume_util_test.go, and deletion of the unused dataprotection.kubeblocks.io/volume-source parameter.

leon-ape avatar May 18 '26 09:05 leon-ape

Codecov Report

:x: Patch coverage is 67.34694% with 48 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 53.17%. Comparing base (7e2fd5a) to head (464c29f). :warning: Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/operations/restore.go 77.00% 15 Missing and 8 partials :warning:
pkg/controller/plan/restore.go 0.00% 13 Missing :warning:
...llers/dataprotection/volumepopulator_controller.go 75.00% 5 Missing and 1 partial :warning:
pkg/operations/horizontal_scaling.go 0.00% 3 Missing and 1 partial :warning:
...ps/cluster/transformer_cluster_sharding_account.go 0.00% 2 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10246      +/-   ##
==========================================
+ Coverage   53.00%   53.17%   +0.16%     
==========================================
  Files         533      532       -1     
  Lines       61423    62965    +1542     
==========================================
+ Hits        32560    33481     +921     
- Misses      25581    26081     +500     
- Partials     3282     3403     +121     
Flag Coverage Δ
unittests 53.17% <67.34%> (+0.16%) :arrow_up:

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

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

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

codecov[bot] avatar May 18 '26 09:05 codecov[bot]

/approve

leon-ape avatar Jun 02 '26 10:06 leon-ape