Repository navigation
[Draft] CHK Raft safety planner: observation, admission, and disruption - #2114
Draft
alex-zaitsev wants to merge 32 commits into
Draft
alex-zaitsev wants to merge 32 commits into
alex-zaitsev wants to merge 32 commits into
Conversation
alex-zaitsev
added a commit
that referenced
this pull request
Oct 23, 2026
[Draft] Enable authoritative CHK Raft planner for e2e
…knowledging abort
alex-zaitsev
force-pushed
the
refactor/chk-raftplan-shadow-20261022
branch
from
October 25, 2026 09:21
a5b78bd to
106f7d6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Incrementally introduce an Observe → Decide → Act Raft safety planner for CHK.
raftplan.PlanAdmissionandraftplan.CheckDisruption, with unit and parity tests.raft_configurationbefore staged admissions.0.28.0).How to test
Build the operator from this PR's head branch
refactor/chk-raftplan-shadow-20261022and run the usual e2e suite; the planner is on by default. To run unit tests:go test -mod=vendor -race -count=1 ./pkg/controller/chk/...Prioritize staged 1→3 admission, intermediate unready joiner, interrupted Create/operator restart, 2→3, 3→5, degraded quorum during rollout, stop/resume, and scale-down.
The staged-join and readiness changes passed the owner's local suite, but CI for the later cleanup exposed a separate intermittent watcher test failure and a unit-test fixture panic. Commit
a5b78bdcorrects the fixture, tests the watcher using its recorded no-endpoint-change event and unchanged CHI ZooKeeper XML instead of an unrelated live session timestamp, and adds failure diagnostics for a distinct 0-2 scale-up stall. Re-run CI before marking the PR ready.Not in this change
Review notes
The authoritative implementation was developed as stacked PR #2115 and merged into this branch for a single end-to-end review. This PR still targets
0.28.0; it has not been merged into the release branch.Broken-image scale-up regression
The uncommitted
test_020003_4scenario found that a 1→3 scale-up with a broken image could remain indefinitelyInProgressrather than reportingAborted. Two startup paths were corrected:PodHasAllContainersStartednow requires reportedStarted=truestatus for every declared container; empty/partial container statuses are not successful startup.ObjectStatusSame), unready staged joiner on a later reconciliation, the StatefulSet reconciler performs the normal bounded Started, not Ready, wait and uses CHK's existingErrCRUDAbortfallback on timeout.The regression motivated a two-phase join flow: boot with host-local membership, wait for Pod Started, publish the new peer to the leader, then verify the leader's live Raft membership and the joiner's fresh StatefulSet/Pod readiness. A failed startup may abort and resume after a spec edit. No existing Keeper needs to restart for admission.
Cross-reconcile stalled-joiner timeout
After the initial broken-image startup fix, e2e still remained
InProgress: the next joiner was repeatedly returning a softErrCRUDDeferredfor a previously published, unready member. The admission executor now inspects the blocking member's live Pod: if all containers never started and its Pod age exceedsreconcile.statefulSet.update.timeout, it returns hardErrCRUDAbortinstead of repeating the deferral. This deadline is based on Kubernetes timestamps and survives reconcile retries/operator restarts; Pods that have started but are not yet Keeper Ready continue to defer safely. A missing Pod uses the blocking StatefulSet's age. Failed API observations remain errors, not absence.Regression tests cover pure deadline cases, abort propagation, resume, staged Raft publication after Pod Started, and the final committed-but-not-Ready join state. The owner previously confirmed the targeted join scenario passed. The broader e2e watch/scale-up scenario is not yet fully green on CI: two retries stalled creating the final Keeper Pod. The latest patch adds StatefulSet and Kubernetes event diagnostics to investigate any recurrence; no admission logic has been changed.
Cleanup after the working refactor
Removed the unused
rollbackStagedRaftAdmitpath and its obsolete tests, the emptyincludeAllHostsIntoClusterhook, the duplicate staged-join verification branch, and the unused boolean return frompublishStagedAdmit. Replaced pre-create publication test coverage with a test of the current Started → publish ordering. Updated stale inline comments. Legacy decision fallback, shadow diagnostics, quorum safety, and settle delays remain intentionally intact.