Repository navigation
feat(app): stand by ready while no worker Nodes are registered - #11
Merged
zijiren233 merged 1 commit intoOct 27, 2026
Merged
Conversation
Initial installs of a standalone control plane join masters before any worker exists. Discovery previously exited fatally on an empty worker set, so kubelet crash-looped the static pod while orchestrators that gate joins on this controller's readiness deadlocked. Startup now recognizes the empty-worker failure through the exported ErrNoWorkers sentinel and enters a prelude: /healthz, /readyz and a pending /status are served green on the health probe address while a 10s poll waits for the first non-control-plane Node, after which the normal resolve-and-run path continues unchanged. Configuration errors still fail fast because the prelude is only entered when discovery failed solely due to the missing workers. A running controller that later observes zero workers (all deleted) reconciles to an empty route set and records a ready idle state instead of degraded, since there is nothing left to serve.
zijiren233
force-pushed
the
fix/zero-worker-readiness
branch
from
October 27, 2026 08:08
fe2ba4c to
49a32c0
Compare
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.
Problem
Standalone control planes are installed master-first: during bootstrap no worker Node exists yet. Two behaviors made that window a deadlock for installers that gate joins on this controller's readiness (e.g. sealos waits for the controller container and its HTTP probe before joining further masters, then joins workers last):
discover worker routes: no worker Nodes are registered), so kubelet crash-looped the static pod — auto-discovery of interface/router CIDR requires at least one worker IP as input.--interface/--router-cidr, a running controller with zero workers recordedno probe-healthy workerand served a red/readyz.Change
discoveryexportsErrNoWorkers(+IsNoWorkers) so the empty-worker case is distinguishable from real misconfiguration, and addsHasWorkerNodes(ctx, reader).app.Run: when resolve fails solely due toErrNoWorkers, a prelude serves green/healthz,/readyzand a pending/statuson the health probe address while polling every 10s for the first non-control-plane Node; the normal resolve-and-run path then continues unchanged (banner semantics preserved). Real configuration errors still fail fast — the prelude is never entered for them.idlestate (empty route set, routes pruned) instead ofdegraded. Workers existing but none probe-healthy keeps reporting degraded as before.Tests
TestResolveReportsNoWorkersSentinel,TestHasWorkerNodes,TestReconcileStandsByWithZeroWorkers.Signed-off-by: zijiren233 pyh1670605849@gmail.com