fix(operations): use resolved component for switchover runtime - #10568
fix(operations): use resolved component for switchover runtime#10568weicao wants to merge 5 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 that the concrete Component and both Pods carry the expected sharding and component labels. 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 from the user-facingcompName. For sharding inputcompName=shard, that second resolution composesvlk-cluster-57598-shard, which is not a real generated Component.Review also exposed a parameter-composition gap. Switchover runtime values are authoritative, but a later shell-safe alias pass could refill an intentionally empty value from a lowercase/raw TemplateVar. For example,
kb_switchover_candidate_name=pod-xcould replace an authoritative emptyKB_SWITCHOVER_CANDIDATE_NAMEand turn automatic candidate selection into an explicit-candidate request.Solution
Reuse the already resolved
SynthesizedComponentwhen entering the runtime switchover path:handleSwitchoverowns target resolution;For the five
KB_SWITCHOVER_*runtime parameters, lifecycle composition now expands TemplateVar aliases first and then applies the runtime-owned canonical values and their shell-safe aliases. This preserves unrelated TemplateVars while ensuring that explicit empty candidate and role values stay authoritative through the complete pipeline.Rejected alternatives
Tests
Validated locally on exact head
0ed1fa42cee46ff9fb12a49388c2a96fdf366621: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 lowercase/raw aliases being unable to refill authoritative empty candidate name, candidate FQDN, or role values. Runtime validation on a patched controller image remains pending (
N=0).