fix(operations): use resolved component for switchover runtime#10568
fix(operations): use resolved component for switchover runtime#10568weicao wants to merge 4 commits into
Conversation
|
Auto Cherry-pick Instructions CLA Recheck Instructions |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #10568 +/- ##
==========================================
+ Coverage 63.98% 64.01% +0.03%
==========================================
Files 520 520
Lines 62995 62996 +1
==========================================
+ Hits 40305 40329 +24
+ Misses 19101 19072 -29
- Partials 3589 3595 +6
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:
|
|
PR #10568 patch-version runtime validation completed on the Valkey CT09 scene. Controller image gate:
Same frozen OpsRequest repair result:
Minimum clean CT09 contrast:
Evidence packet path on the test machine: Packet SHA256SUMS hash: Boundary: this validates PR #10568 patch-version CT09 scope only. It is not a full Valkey r9 or release-ready result. |
|
[P2] The functional fix removes the duplicate component resolution, but the replacement expands the OpsRuntime boundary to a controller-internal type. The merge base kept Passing the already resolved concrete shard is the correct direction, but please pass a minimal stable switchover/action context instead of exposing the complete synthesized controller model through the OpsRuntime interface. |
|
Addressed the runtime-boundary review on exact head The sharded target is still resolved once by the switchover handler, but TDD/gates:
The PR remains Draft pending exact-head CI and review verification. Runtime N=0; this is source/local contract evidence only. |
|
/nopick |
|
Scope disclosure added: this change intentionally fixes TemplateVars propagation as well as sharded target resolution. The handler resolves variables before dispatch; the old runtime rebuild skipped that resolver, while the new action context passes the resolved map into lifecycle.New. Runtime evidence is still N=0. |
|
Landing-order note: #10651 fixes an observed non-idempotent switchover replay window and touches the same |
984982c to
95b4972
Compare
Problem
Fixes #10567.
A sharded switchover can validate successfully with the correct API form:
componentName: shard(the sharding spec name)instanceNameandcandidateNameinside one generated shard componentOn a controller image containing #10360, Valkey CT09 still failed during execution with:
The frozen evidence shows the #10360 label preconditions are satisfied: the concrete Component and both pods carry
apps.kubeblocks.io/sharding-name=shardandapps.kubeblocks.io/component-name=shard-qwd. That rules out the old entry-resolution issue and leaves the runtime execution path.Root cause
handleSwitchoveralready resolves the concrete target throughbuildSynthesizedComp, including the sharding instance to generated Component mapping.opsRuntime.Switchoverthen rebuilt a synthesized component fromcompNameby callingGenerateClusterComponentName(clusterName, compName). For sharding inputcompName=shard, that second resolution composesvlk-cluster-57598-shard, which is not a real generated Component.Two review follow-ups exposed adjacent contract gaps:
main, stale identifiers left the combined branch unable to compile;Solution
Reuse the already resolved
SynthesizedComponentwhen entering the runtime switchover path.This keeps the boundary narrower than adding another sharding-aware resolver in runtime:
handleSwitchoverowns target resolution;The lifecycle merge now treats the five
KB_SWITCHOVER_*runtime parameters as authoritative. It overwrites conflicting TemplateVars while preserving unrelated variables. When no candidate is specified, both candidate parameters are still emitted with explicit empty values, matching the API contract and preventing template values from selecting a candidate.Tests
Validated at exact head
d46081b83dced6a0b3a677eb3bbe7010b112f1b9:go test -short ./pkg/controller/lifecycle ./pkg/operations -count=1with envtest assets: PASSgo test -racefor candidate and no-candidate collision cases: PASSgo vet ./pkg/controller/lifecycle ./pkg/operations: PASSgit diff --check: PASSTests cover all five conflicting runtime fields, unrelated TemplateVars remaining intact, and the no-candidate path overwriting both candidate fields with authoritative empty values. Runtime validation on a patched controller image remains pending (
N=0).