kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

chore: project cluster restore intent in apps

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

Summary

This PR implements apps-side support for the new Cluster.spec.restore API.

It is intentionally additive: the existing kubeblocks.io/restore-from-backup annotation path remains untouched and continues to work until the later cleanup/switch PR.

Changes

  • Projects Cluster.spec.restore onto initial component, sharding, shard-template, and instance-template VCTs.
  • Propagates restore source, PITR, parameters, component, and volume-template metadata through VCT annotations.
  • Sets PVC template dataSourceRef from the restore source.
  • Cleans restore intent from downstream VCTs after apps observes restore completion, preventing scale-out PVCs from restoring again.
  • Aggregates restore progress through PVC condition -> InstanceSet condition -> Component condition -> Cluster condition.
  • Adds tests for restore intent projection, cleanup, instance-template VCT handling, PVC template propagation, and restore condition aggregation.

Out of Scope

  • DP Backup-kind PVC runtime implementation.
  • Restore ops switch to Cluster.spec.restore.
  • Removal of legacy restore annotation transformers, watches, constants, or utilities.
  • System account restore behavior changes.

Validation

  • make generate
  • make manifests
  • make doc
  • make fmt
  • make lint
  • go test ./controllers/apps/cluster/...
  • go test ./controllers/apps/component/...
  • go test ./pkg/controller/instanceset ./pkg/controller/component ./pkg/controllerutil

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

Codecov Report

:x: Patch coverage is 77.52294% with 98 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 53.36%. Comparing base (7e2fd5a) to head (ec95951). :warning: Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/instanceset/reconciler_status.go 66.01% 26 Missing and 9 partials :warning:
...rollers/apps/cluster/transformer_cluster_status.go 79.06% 20 Missing and 7 partials :warning:
...ers/apps/component/transformer_component_status.go 81.55% 15 Missing and 4 partials :warning:
controllers/apps/cluster/restore_intent.go 85.71% 11 Missing and 3 partials :warning:
.../apps/cluster/transformer_cluster_normalization.go 0.00% 2 Missing and 1 partial :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10244      +/-   ##
==========================================
+ Coverage   53.00%   53.36%   +0.35%     
==========================================
  Files         533      534       +1     
  Lines       61423    63313    +1890     
==========================================
+ Hits        32560    33789    +1229     
- Misses      25581    26088     +507     
- Partials     3282     3436     +154     
Flag Coverage Δ
unittests 53.36% <77.52%> (+0.35%) :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 07:06 leon-ape

/recheck-cla

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

Recheck CLA triggered.

github-actions[bot] avatar Jun 02 '26 07:06 github-actions[bot]