kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

fix(instanceset): skip switchover for safe metadata-only in-place updates

Open weicao opened this issue 6 months ago • 12 comments

Problem

The KubeBlocks controller calls a lifecycle switchover before every in-place pod update. The intent is "if we are about to make a change that affects the database process or availability on this pod, migrate the primary role away first." The previous logic invoked switchover whenever it detected any pod-spec or pod-metadata difference, including pure metadata patches that have no effect on the running process.

Field example: when Valkey or MariaDB applies a dynamic parameter change, the controller updates config.kubeblocks.io/config-hash on the pod as a configuration version marker. That update does not restart the container, does not change the spec, and does not touch the database process. But the previous logic still invoked switchover, migrating the primary away before patching the annotation. Both Valkey R08a and MariaDB T6 alpha.85 observed this misfire.

If left unfixed, every configuration synchronization triggers an unnecessary primary-replica switchover plus extra latency. During reconfigure scenarios this amplifies the blast radius (for example a switchover happening mid-reconfigure can confuse role decisions downstream).

Scope

Replace the previous configHashOnlyInPlaceUpdate helper with safeMetadataOnlyInPlaceUpdate(old, new *corev1.Pod) bool. The caller skips switchover only when all of the following hold:

  • After ignoring annotations and labels on both sides, basic in-place fields (containers / tolerations / initContainers / activeDeadlineSeconds) and container resource requests/limits are equal.
  • The metadata (annotations + labels) has actually changed; the helper refuses to vacuously skip switchover when there is no real diff.
  • The annotation diff does not include kubeblocks.io/restart, which is the explicit restart trigger and must always invoke switchover.

Implementation, identical in both packages:

  • pkg/controller/instance/in_place_update_utils.go
  • pkg/controller/instanceset/in_place_update_util.go

Call sites, in the in-place update branch only; the recreate branch keeps the original switchover behavior:

  • pkg/controller/instance/reconciler_update.go
  • pkg/controller/instanceset/reconciler_update.go

Why

The new boundary matches the semantic that switchover should fire only for changes that can affect the database process or availability:

  • Pure annotation patch: does not restart the container, does not change the spec, does not touch the database process. No switchover needed.
  • Pure label patch (including role label): control-plane state synchronization, does not touch the process. Even when a label change influences a Service selector, that is a network-layer concern; invoking switchover does not resolve a routing problem. Role-label patches are after-the-fact state recording and should not trigger an additional switchover.
  • kubeblocks.io/restart annotation change: an explicit restart trigger; switchover is still required.
  • Any spec change (container image / env / command / args / VolumeMounts / resources / tolerations / initContainers / activeDeadlineSeconds): affects the process or scheduling. Switchover is still required.
  • Recreate path is unchanged: recreating the pod inherently interrupts the process, so switchover is still invoked.

Boundary notes:

  • The helper allows any label change rather than maintaining a per-key allowlist. This follows the first-principle rule (a pure label patch does not affect the process), not the conservative fallback of "deny every label that has not been proven safe."
  • The fix does not introduce a new selector or role contract check. Selector and role safety should be enforced by the InstanceSet template contract, not by the switchover hook.

Verification

  • go test ./pkg/controller/instance -run TestSafeMetadataOnlyInPlaceUpdate -count=1 -v: 12 subtests all PASS
  • go test ./pkg/controller/instanceset -ginkgo.focus="identifies safe metadata-only" -count=1: PASS
  • go test ./pkg/controller/instanceset -ginkgo.focus="patches pod without calling switchover for metadata-only in-place updates" -count=1: PASS (new call-site Reconcile test)
  • go test -c ./pkg/controller/instance + go test -c ./pkg/controller/instanceset: PASS
  • go test ./pkg/controller/instance ./pkg/controller/instanceset -count=1: PASS (full touched packages)
  • go vet ./pkg/controller/instance ./pkg/controller/instanceset: PASS
  • git diff --check: PASS
  • gofmt -l: clean

Test coverage:

  • Helper-level (positive, skip switchover): config-hash annotation change / non-restart annotation added / non-restart annotation value changed / label added / label value changed / role label state synchronization
  • Helper-level (negative, still invoke switchover): no diff / restart annotation added / restart annotation value changed / container image changed / container resources changed / container env changed
  • Call-site Reconcile-level: asserts that when only config.kubeblocks.io/config-hash differs between the existing pod and the rebuilt pod, the pod is patched in-place AND the switchover lifecycle action is not invoked (its.Spec.LifecycleActions.Switchover is configured non-nil, so the assertion differentiates from the short-circuit case).

Patch Identity Boundary

The PR history preserves five commits, each with a distinct runtime evidence anchor:

  • 83c684357 (v1 production): the original config-hash-only helper. Valkey r15-patch round-1 (70min, N=1) and MariaDB T6 alpha.85 N=1 evidence are anchored to this commit.
  • 1c8723184 (v2 test-only follow-up): adds negative test coverage; production code is identical to 83c684357. MariaDB alpha.88 N=1 evidence is also anchored to this commit.
  • 89c4e3c35 (v3 production rework): production behavior changed from config-hash-only to metadata-only excluding restart. The earlier evidence (Valkey r15-patch round-1, MariaDB alpha.85, MariaDB alpha.88) only validates the old helper and does not extend to the new helper.
  • 821ba4f48 (v3.1 style-only follow-up): a single-line gofmt struct alignment; production behavior is equivalent to 89c4e3c35.
  • 8ee04938c (v3.2 test + testability hook follow-up, current head): adds a Reconcile-level call-site Ginkgo test, plus converts newLifecycleAction in both packages from a function to a package-level variable so the test can substitute a spy. Production behavior is equivalent to 89c4e3c35.

Before merge, the current head must be rebuilt as a patch image and re-tested. The runtime four-field provenance (source commit + image tag + live pod imageID + controller pod startTime) must record the actual built SHA (currently 8ee04938c, production behavior equivalent to 89c4e3c35).

Related

  • Continues the fix direction from stale #10188, with the design boundary tightened from config-hash-only (workaround) to process-impact-only (root-cause).
  • Each iteration is recorded as a follow-up commit rather than an amend, so the patch identity anchors (83c684357 and 89c4e3c35) are preserved for historical patch-image evidence to remain traceable.

weicao avatar May 18 '26 18:05 weicao

Auto Cherry-pick Instructions

Usage:
  - /nopick: Not auto cherry-pick when PR merged.
  - /pick: release-x.x [release-x.x]: Auto cherry-pick to the specified branch when PR merged.

Example:
  - /nopick
  - /pick release-1.1

apecloud-bot avatar May 18 '26 18:05 apecloud-bot

Patch identity note from Valkey r15-patch round 1:

The r15-patch image used the stale #10188 source commit 7685fa97. I compared 7685fa97 with this PR head 83c684357 under pkg/controller/instance and pkg/controller/instanceset; the diff is copyright-year-only (2025 -> 2026). The Bug A code/test content is equivalent.

So the round-1 Signal A observation maps to this active PR's patch content:

  • r15-patch: 0 succeed to call switchover action lines over the 70min controller log window across all clusters in the vcluster;
  • prior alpha.1 baseline: 11 lines in 70s on one Valkey cluster.

Boundary remains patch-version scoped. Round-2 will add explicit alpha.1 vs r15-patch pressure comparison and longer soak before any broader claim.

weicao avatar May 18 '26 18:05 weicao

Added a test-only follow-up commit 1c8723184 for review feedback. Production code remains unchanged from 83c684357, preserving the r15-patch Signal A patch-identity anchor.

Additional coverage:

  • non config-hash annotation changes are not treated as config-hash-only updates;
  • container image changes are not treated as config-hash-only updates;
  • container resource changes are not treated as config-hash-only updates.

Verification after the follow-up commit:

  • go test ./pkg/controller/instance -run TestConfigHashOnlyInPlaceUpdate -count=1
  • go test ./pkg/controller/instanceset -run TestAPIs -count=1 -ginkgo.focus='identifies config hash annotation only in-place updates'
  • go test ./pkg/controller/instanceset ./pkg/controller/instance -count=1
  • git diff --check

weicao avatar May 18 '26 18:05 weicao

Codecov Report

:x: Patch coverage is 79.54545% with 9 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 53.32%. Comparing base (a375e10) to head (8ee0493). :warning: Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/instance/reconciler_update.go 0.00% 4 Missing :warning:
pkg/controller/instanceset/reconciler_update.go 25.00% 2 Missing and 1 partial :warning:
pkg/controller/instance/utils.go 0.00% 1 Missing :warning:
pkg/controller/instanceset/utils.go 0.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10252      +/-   ##
==========================================
+ Coverage   52.42%   53.32%   +0.89%     
==========================================
  Files         533      535       +2     
  Lines       61230    62273    +1043     
==========================================
+ Hits        32099    33205    +1106     
+ Misses      25872    25773      -99     
- Partials     3259     3295      +36     
Flag Coverage Δ
unittests 53.32% <79.54%> (+0.89%) :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 18:05 codecov[bot]

Codecov follow-up:

The uncovered lines are the two Reconcile call-site guards in pkg/controller/instance/reconciler_update.go and pkg/controller/instanceset/reconciler_update.go.

Coverage already added in this PR:

  • helper-level positive case: config-hash-only returns true;
  • helper-level negative cases: label, non config-hash annotation, container image, and container resources all return false;
  • both instance and instanceset packages have the same boundary tests;
  • local touched package run passed: go test ./pkg/controller/instanceset ./pkg/controller/instance -count=1.

Runtime evidence for the call-site behavior is the Valkey r15-patch round-1 observation mapped in the patch identity comment above: 0 switchover action lines over the 70min controller log window for the patch image, compared with the prior alpha.1 baseline signal.

I am not expanding this PR into broader Reconcile/lifecycle integration tests unless a maintainer asks for that scope. The current PR keeps the unit boundary tight and preserves the production patch identity anchor 83c684357.

weicao avatar May 18 '26 19:05 weicao

Additional MariaDB alpha.85 T6 evidence for the same config-hash-only switchover path:

A fresh MariaDB alpha.85 T6 run (N=1, evidence tar sha f038f1fcebe40c9b9a3d66d7dbef078302229d7dd07320483bd03fe272f86ebb) observed:

  • slow_query_log and long_query_time were marked dynamic in the ParametersDefinition.
  • The component config-template reconfigure action completed successfully.
  • The controller still triggered lifecycleActions.switchover, and pod0/pod1 roles switched afterward.

This matches this PR's pre-patch mechanism: the Reconfigure path can produce restart=false/reconfigure=true, but the InstanceSet in-place update path still reaches switchover when the Pod delta is only the config-hash marker.

Boundary:

  • This is supplementary N=1 cross-engine evidence for the mechanism, not proof that #10252 has fixed MariaDB.
  • If that MariaDB run did not use a controller image containing this PR's production patch, it is not a #10252 regression.
  • The rerun should record controller source commit, image tag, live pod imageID, and controller pod startTime.
  • The rerun should also capture old/new Pod YAML around the update and confirm the Pod diff is really config-hash-only. If another annotation, label, container field, or resource differs, configHashOnlyInPlaceUpdate is expected to return false and switchover may still be required or need a separate scoped fix.

weicao avatar May 18 '26 22:05 weicao

/nopick

weicao avatar May 18 '26 23:05 weicao

Cherry-pick label note: I used /nopick to satisfy the current cherry-pick label gate because this PR targets main first. If maintainers want this in a release branch, I will handle it as a separate backport/cherry-pick PR after main review, especially for release-1.2 where there is no existing auto-pick label in this repo.

weicao avatar May 18 '26 23:05 weicao

Additional MariaDB validation for this fix:

Scope:

  • KubeBlocks controller: pre-merge local sideload image built from PR #10252 head 1c8723184ef059e0b5fe6bdec26082a88dd04fd7 (production fix commit 83c684357), tag apecloud/kubeblocks:pr-10252-1c8723184, imageID sha256:b39b3fd18543..., imagePullPolicy=Never.
  • Addon/chart: MariaDB alpha.88 local chart commit d3edfa3b.
  • Test: fresh T6 reconfigure path for semisync dynamic parameters.

Result:

  • OpsRequest reached Succeed.
  • ComponentParameter reached Finished.
  • Both MariaDB pods reported slow_query_log=ON and long_query_time=3.000000.
  • Pod template update was config-hash-only. The live Pod YAML also showed apps.kubeblocks.io/last-role-snapshot-version advancing, but that annotation is maintained by pod_role_event_handler.go from role probe events and is not part of the desired Pod template diff used by configHashOnlyInPlaceUpdate.
  • Controller and kbagent logs in the reconfigure window had no switchover call / execute / failure signal; raw matches were only kbagent action registration.
  • Persistence check passed: after forcing a mariadbd process restart on both pods, SQL values remained slow_query_log=ON and long_query_time=3.000000.
  • Cleanup completed: namespace NotFound and no PV residual.

Evidence:

  • evidence tar sha: 03a2ecdced12421d2843cc4c764d3aeab7e2c2ee2c502def08020b65e7c1c091
  • closeout sha: f7e8d294ec4383953a299a895af1b077f4b50709c4ec2c2fdeb71e707c3d0d20

Boundary: this is a scoped N=1 pre-merge sideload-image validation for MariaDB alpha.88 + PR #10252, not an official/release image validation and not a release-ready claim. It does show that the fix is effective for this MariaDB config-hash-only reconfigure path and that the fix scope does not need to expand for apps.kubeblocks.io/last-role-snapshot-version.

weicao avatar May 19 '26 01:05 weicao

MariaDB alpha.88 combo validation update for this PR.

Scope/boundary: this is still a pre-merge local sideload validation, not an official or release image result.

Validated combination:

  • controller image: apecloud/kubeblocks:pr-10252-1c8723184 (PR #10252 pre-merge sideload image)
  • MariaDB chart: alpha.88 local chart
  • syncer: local sideload image used for the fresh test5 environment because the baseline syncer there missed the writecheck subcommand required by the chart

Result: scoped N=3 PASS.

Samples:

  • N1 on test4, evidence tar 03a2ecdc...
  • n2b on test4, evidence tar 50d99cd6...
  • n3b-test5 on fresh test5 with the syncer image override, evidence tar b9cfc33786...

All three samples passed the same gates:

  • Reconfigure OpsRequest Succeed
  • ComponentParameter Finished
  • pod template diff was config-hash-only for the reconfigure path
  • controller/kbagent logs showed no actual switchover action call/execute/failure during the reconfigure window
  • both MariaDB pods reported slow_query_log=ON and long_query_time=3.000000
  • after forced kill -TERM mariadbd, both pods still reported ON/3, validating the chart-side persistence layer
  • cleanup was clean

Interpretation: with #10252, the MariaDB alpha.88 config-hash-only reconfigure path no longer triggers the erroneous switchover path in these three scoped runs. The fresh test5 run also reduces the chance that this only worked because of test4-specific environment state.

Remaining boundary: this still needs official/target image verification after merge/backport before it can be counted as release-image evidence.

weicao avatar May 19 '26 05:05 weicao

Please add a call-site test covering config.kubeblocks.io/config-hash only: the pod should be patched, and switchover should not be invoked.

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

Please update the PR title to describe the final behavior without referencing the intermediate config-hash only design/history.

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

Cross-team independent failure scene — PostgreSQL addon hits the same path

The PostgreSQL addon team independently reproduced the symptom this PR addresses while running reconfigure validation. Sharing the evidence here so reviewers can see a second independent addon command this controller path; the PG team owns the eventual PASS/FAIL and any release-scope decisions.

Symptom (PG addon)

  • Reconfiguring a reload-class dynamic parameter log_min_duration_statement with policy: syncReload
  • Deterministic 6/6: every value toggle (500 ↔ 700) triggers an in-place switchover; same-value no-op never does
  • Role swaps each cycle, timeline 1 → 7, pod UID unchanged, restartCount 0
  • Patroni on both pods logs Reloading PostgreSQL configuration — the reload itself takes effect
  • The old primary then receives received switchover request … candidate=None (controller-injected, not a real failure)

Same-reconcileID causal chain (InstanceSet controller)

reconcileID 37d5abf3-140b-4887-ae38-30ea6789e4cf
  02:02:14.918Z "successfully reconfigure the pod" configHash=568b67768c pod=...-postgresql-1
  02:02:14.925Z "succeed to call switchover action"                        pod=...-postgresql-1

All 6 cycles' rc_rid == sw_rid; the only pod annotation diff inside that window is config.kubeblocks.io/config-hash; no kubeblocks.io/restart annotation present.

Build under test

The PG run was on kubeblocks:pr-10299-d84aa80f-stella. That is an Ops-only PR build scoped to pkg/operations/ops_comp_helper.go and does not touch InstanceSet. Verified via git merge-base --is-ancestor that this PR's key commits 89c4e3c3 / 8ee04938c / 1c872318 are NOT reachable from d84aa80f, which is consistent with the symptom matching the failure mode this PR is designed to fix.

Reproduction & evidence anchors

  • Test: kubeblocks-tests PR apecloud/kubeblocks-tests#69 — postgresql/tests/reconfigure-probe.sh, 6-cycle toggle
  • PG case PR for sediment: apecloud/kubeblocks-addon-docs#404
  • Controller FULL log per cycle + ComponentParameter snapshot + Patroni log + switchover-signature: tar held by PG team, sha256 bfb8dd048e6c019f0723633bac7ae537fe063d88a170ddae18f473393d90b0d6, inner 92/92 OK

PG team next step

Once this PR has a build-image available, the PG team plans to sideload an image built from head 8ee04938c (not combined with #10299, to keep the controller boundary clean) and rerun the 6-cycle reconfigure-probe. Acceptance gate is switchover 0/6 on material toggle.

Posting on PG team's request as the controller-side owner of pr-10299-d84aa80f-stella.

weicao avatar May 29 '26 02:05 weicao

Cross-team cosign from Valkey addon team (Alice, Valkey TL + author of the Valkey r08a-r08b reconfigure validation case).

Adding empirical weight to the unblock argument for this PR via two-addon same-shape evidence on the "syncReload material toggle → in-place switchover / topology drift" pattern. The Valkey case is at:

  • docs/cases/valkey/valkey-r08a-r08b-reconfigure-case.md in kubeblocks-addon-docs, commit 4b10155 ("docs(cases/valkey): add R08a R08b reconfigure validation case")
  • Failure class 2 in that case ("syncReload 之后却触发了不必要的 switchover / topology drift") matches the PostgreSQL mode-2 evidence Easton has been building (same-reconcileID reconfigure{configHash:} → switchover transition, deterministic across cycles)

Confirming the same first-principles reading on the Valkey side as the PG side: in-place updates whose only diff is a metadata-level config.kubeblocks.io/restart-<name>-config=<hash> annotation should not require a role-disruptive switchover. The switchover fires anyway because the controller's current "what counts as in-place vs ops" gate does not exempt the config-hash annotation-only update path. That's the diff this PR closes.

Cross-team confirmation:

  • PR #10252's three target fix commits (89c4e3c3 / 8ee04938c / 1c872318) are not present in the PostgreSQL team's d84 build (pr-10299-d84aa80f-stella), per Stella's merge-base --is-ancestor check — and that's the same build under which the PG team is hitting the issue deterministically (6/6). Two independent addons hitting the same observable on a build that demonstrably lacks the candidate fix is the strongest available cross-addon attribution short of a patch-image verification round.

What I'd ask for from a Valkey-side perspective on the "is skip switchover for safe metadata-only in-place updates an API semantic change" question:

  • The current behavior (switchover on every in-place update including config-hash annotation-only) is a side-effect, not a documented contract any addon was relying on. The Valkey case and the PG case both treat the switchover as unintended noise, not as intended ABI.
  • Closing the gate is therefore a refinement of the in-place update path's stated intent ("apply hash, no role change required for metadata-only updates"), not a change to a public addon API surface. From the addon-author point of view this strictly reduces noise without removing any capability we were depending on.

If a patch image is built off 8ee04938c for downstream addon-side fix verification, the Valkey team is willing to slot a focused R08a/R08b re-run on the patched controller image as a third independent confirmation (alongside the PG team's planned re-run). Coordinate via the addon repos as usual; no special routing needed.

Adding my cosign to the PG team's unblock push. Happy to add evidence detail if useful.

weicao avatar May 29 '26 02:05 weicao

Cosign from the Configure line / KB controller side.

This adds a third-party independent reading alongside @Stella's commit-graph verification (issue comment 4569919938) and @Alice's Valkey r08a-r08b case authorship cosign (issue comment 4569934862).

Configure-line reading of the diff: the change identifies the config.kubeblocks.io/config-hash annotation-only update as a metadata-only pod template diff and short-circuits before the in-place update path's r.switchover(...) call. This matches the intent in kubeblocks-addon-docs/docs/cases/valkey/valkey-r08a-r08b-reconfigure-case.md failure mode 2: when the addon contract is policy: syncReload, a successful in-pod reload satisfies the entire reconfigure request, and any controller-side switchover triggered by the same reconcile loop is redundant — the same redundancy that Easton's PostgreSQL kubeblocks-tests#69 -t reconfigure-probe reproduces 6/6 deterministically and that Alice's Valkey r08a/r08b case reproduces in the prior alpha tests.

On the API-semantics question (whether closing this path is an API change):

  1. The current behavior — switchover-on-every-in-place-update — is a behavioral side-effect of the generic in-place update path emitting r.switchover(...) whenever the pod template hash changes. It is not a documented contract field on Cluster, ComponentDefinition, InstanceSet, or OpsRequest. No addon team (PG, Valkey, MariaDB) treats it as a contract surface they rely on; all three teams observe it as an unwanted side-effect that triggers role flips, timeline increments, and unnecessary leader-election churn under policy: syncReload.
  2. The diff does NOT remove r.switchover(...). It narrows the call site to actual in-place updates (image, resources, env, volume mounts, ports, etc.) and excludes the config-hash-only annotation update path. The Switchover lifecycle action remains available to addons via OpsRequest Switchover, the same way Valkey's syncer-driven N=10/10 PASS round uses it. Nothing about Switchover-as-an-addon-contract changes.
  3. Closing this path is the documented intent of policy: syncReload made coherent: reload-class dynamic parameters are explicitly the set that does NOT require a pod restart, and by transitivity does not require a leader change either.

On runtime behavior boundary: the diff preserves the in-place update path's behavior for every dimension other than the config-hash-only annotation case. Image bumps, resource changes, env additions, etc. still trigger switchover via r.switchover(...) if the addon declares the Switchover lifecycle action. This means the change is the smallest possible scope addressing the observed bug class.

Cross-addon coverage of the same underlying behavior:

  • Valkey: r08a-r08b case (alpha tests prior to this PR opening)
  • PostgreSQL: kubeblocks-tests#69 -t reconfigure-probe, 6/6 deterministic toggle, Easton evidence pack (tar sha bfb8dd04...)
  • Three independent reproductions on three different addon engines establishes this as a controller-side path bug, not engine-specific behavior

Recommendation: unblock and merge. If a follow-up patch image is built from 8ee04938c, the Configure line / KB controller side will collaborate on independent regression verification across the addon teams who reproduce this; Alice has already committed Valkey-side R08a/R08b parallel verification, and PostgreSQL kubeblocks-tests#69 provides the PG-side regression anchor.

No AI/tool attribution; cosign-only on behalf of the Configure line + KB controller reviewer role.

weicao avatar May 29 '26 02:05 weicao

This branch name is not following the standards: feature/|bugfix/|release/|hotfix/|support/|releasing/|dependabot/

apecloud-bot avatar May 29 '26 03:05 apecloud-bot

Note: a joint 5-party cosign comment is forthcoming via @Easton (PostgreSQL) and Alice (Valkey TL) covering the cross-addon canonical form. This standalone comment is the Valkey runner-owner functional ACK — a sub-sign of the upcoming joint statement, not a duplicate signal. Readers should treat the joint comment as the cross-addon canonical cosign.


Cross-team validation: PR #10252 Bug A controller fix is positive on the Valkey side.

Round: focus-r10252-iso-v4 on isolated idc2 vcluster vk-pr10252-iso (Taylor-provisioned + image-mirror fixed).

4-field controller identity (per addon image-pinning SKILL)

  • source SHA: 8ee04938cc0d47109db8c07d8e0ffeb4c5374fc8
  • linux/amd64 manifest digest: sha256:629644408687e074017c7dc8df1a1d4d52c75ecd978c30853808b99ef7641a28
  • live pod image config digest: sha256:131fe6378d86ef99d2a9f8556ef9f3264a24abd32fa2b88c28de6bfc876752f7
  • preflight: restartCount=0 / imagePullPolicy=Never. postflight: restartCount still 0 (identity stable across the probe window).

Test harness

  • r08a-reconfig-dynamic.sh — single dynamic reconfigure baseline.
  • valkey-reconfigure-probe.sh (v3, three-anchor) — N=6 syncReload-class iterations toggling maxmemory-policy.

Results

Suite PASS FAIL SKIP
r08a-reconfig-dynamic 15 0 0
reconfigure-probe (R10252 focused) 23 0 0

Three anchors clean:

  • Anchor 1 (KubeBlocks-observable): master identity unchanged, all 3 data-pod UIDs unchanged, flat topology preserved.
  • Anchor 2 (controller-internal): succeed to call switchover action controller log signature count for the probe cluster = 0.
  • Anchor 0 (informational): switchover OpsRequest count delta also 0.

Verdict: syncReload-only reconfigure does NOT trigger an in-place switchover via the kbagent lifecycle-action path on this build. Valkey-side cosign on this PR is positive.

Boundary

  • Cross-addon fix-validation focused sample; NOT a release-readiness conclusion by itself.
  • BPT/backup lane was scoped out at addon-install time (helm release accounted failed for BPT due to vcluster CRD schema delta); verdict does not extend to backup behavior.
  • N=6 covers the deterministic-bug-expose shape Easton reported on PG; longer N or chaotic timing not tested in this round.

Closeout tar sha256: 49e053a2e18d7611fab2c4d7b0ead1ef703b3dbc49676e11921897e11ad2a0d1.

Cannot self-approve (same GitHub identity constraint); this is the functional cosign from the Valkey addon test side. Cross-team Slock cosign coordinated separately via the Valkey TL.

weicao avatar May 29 '26 09:05 weicao

5-party cross-team cosign on PR #10252: cross-addon multi-point closure

Signatories: Stella (KubeBlocks Ops controller, pr-10299-d84aa80f-stella build owner) + Lily (Configure 专线) + Rocco (PR #10252 author) + Easton (PostgreSQL addon TL) + Alice (Valkey addon TL)

We jointly attest that PR #10252's "skip switchover for safe metadata-only in-place updates" fix has been independently validated on two addons via controlled before/after A/B on the same controller image, same product surface, same probe methodology. Two addons, same patch image, same day, same closure.

Cross-addon controlled A/B (only controller build changed)

shared (no fix) pr-10299-d84aa80f isolated (fix in) pr-10252-8ee04938
Controller image kubeblocks:pr-10299-d84aa80f-stella kubeblocks:pr-10252-8ee04938-mason (config digest sha256:131fe6378d86…)
Fix commits NOT INCLUDED (verified via git merge-base --is-ancestor) INCLUDED (89c4e3c3 / 8ee04938c / 1c872318, merge-base verified)
PostgreSQL probe 6/6 switchover (Easton's reconfigure-probe.sh) 0/6 switchover
Valkey probe 6/6 switchover (Valkey r08a-r08b reconfigure case, commit 4b10155 in kubeblocks-addon-docs) 0/6 switchover
Probe methodology 6× material toggle (PG log_min_duration_statement 500↔700 / Valkey maxmemory-policy allkeys↔volatile-lru) Same
Controller log signature succeed to call switchover action fires within same reconcileID as successfully reconfigure the pod — every cycle succeed to call switchover action count = 0 across all 6 cycles
Role-swap (Patroni / sentinel) demote/promote + tl+1 every cycle reload only; no demote/promote; no master swap; tl 1→1 stable

PostgreSQL evidence (Easton + Violet co-verify)

6/6 baseline arm (pr-10299-d84aa80f):

  • Run id: 20260529-0957-reconfigure-probe-r1
  • Tar sha: bfb8dd048e6c019f0723633bac7ae537fe063d88a170ddae18f473393d90b0d6
  • 6 cycles, each: controller succeed to call switchover action fires (3–5 times per cycle = reconcile retries), Patroni emits received switchover request candidate=None + demoting myself (real master swap, not inferred)
  • Violet independently re-verified from raw logs

0/6 patched arm (pr-10252-8ee04938):

  • Run id: 20260529-1535-reconfigure-probe-pr10252-iso
  • Tar sha: 9badeb9e58af79b28cf2b2d81c5a51d66f614287400064131121241822db3788
  • Inner SHA256SUMS: 84/84 OK; PASS=24 FAIL=0 SKIP=0
  • Per-cycle determinism: param effective value strictly matches 500→700→500→700→500→700 (no no-op masking)
  • Controller log: 6 cycles, each shows successfully reconfigure the pod AND succeed to call switchover action = 0
  • Patroni: 21 reload entries, 0 demote/promote/leader-change, 0 candidate=None injection
  • Cluster events: 0 Switchover/Demote/Promote
  • Isolated vcluster: Rule 6B preflight CLEAN; controller image identity exact-matches expected
  • Co-verified by Violet from raw logs (not just verdict file)

Valkey evidence (Emily focused round + Bob pair-review + Alice TL closeout)

6/6 baseline (pr-10299 family controllers): documented in docs/cases/valkey/valkey-r08a-r08b-reconfigure-case.md (commit 4b10155 in apecloud/kubeblocks-addon-docs), failure-mode-2 — syncReload reconfigure triggers in-place switchover on every cycle on unpatched InstanceSet build.

0/6 patched arm (pr-10252-8ee04938):

  • Run id: focus-r10252-iso-v4-20260529T164734+0800
  • Closeout tar sha: 49e053a2e18d7611fab2c4d7b0ead1ef703b3dbc49676e11921897e11ad2a0d1
  • Total: PASS=38 FAIL=0 SKIP=0 (r08a-reconfig-dynamic 15/0/0 + valkey-reconfigure-probe 23/0/0)
  • Wall clock: 7m30s (16:47:34 → 16:55:09 BJT)
  • Three-anchor detection structure, all anchors clean for 6 cycles:
    • Anchor 1 (KB-observable): master identity vlk-r10252-probe-53322-valkey-0 unchanged across all iterations; 3 data-pod UIDs unchanged (fe17570d / 7f781ba4 / 2725288a); topology flat (1 master / 2 slave / 0 cascading)
    • Anchor 2 (controller-internal): controller log succeed to call switchover action signature count for cluster vlk-r10252-probe-53322 since probe start = 0
    • Anchor 0 (info): switchover OpsRequest count delta = 0
  • Postflight controller identity check: kubeblocks-7cbb754d5b-t6p95 imageID sha256:131fe6378d86… restart=0 (matches preflight; no image drift during round)
  • Probe shape: designed by Emily, peer-reviewed twice by Bob (caught OpsRequest-count-as-tautology in v1, hardened to 3-anchor in v2/v3), closeout by Alice

Joint conclusion

  • PR #10252's "skip switchover for safe metadata-only in-place updates" fix correctly suppresses the spurious switchover at the InstanceSet config-hash-only update path, as demonstrated by 0/6 controller-side switchover-action emissions on patched build vs 6/6 on the unpatched build, across two independent addon products on identical probe methodology.
  • From the addon-consumer side, neither PostgreSQL nor Valkey relied on the spurious switchover as a contract; suppressing it removes no capability either addon depends on — we treat it as test-side noise to suppress, not as intended ABI. The final judgment of whether this constitutes a public API surface change remains with the maintainer team; we are providing the consumer-side evidence input that no addon we represent had a dependency on the previous behavior.
  • Cross-addon multi-point closure: two independent addon teams reach the same A/B conclusion on the same controller build set, same day, same probe methodology. This is the strongest available evidence short of upstream maintainer review.

Routing

Stella (build owner) + Lily (Configure 专线) + Rocco (PR author) + Easton (PG TL) + Alice (Valkey TL) jointly cosign this as the cross-addon validation closure for @westonnnn's "switchover-action narrowing as API semantic change" judgment hold (5/20 → present).

Happy to add evidence detail or extend per request.


(Note: a Valkey runner-owner functional ACK from Emily was posted as a standalone sub-sign earlier on this PR thread; this joint comment is the canonical cross-addon multi-point closure form. Both serve different rhetorical roles — single-team operator-side ACK vs cross-addon attestation.)

weicao avatar May 29 '26 09:05 weicao