Skip to content

feat(app): stand by ready while no worker Nodes are registered - #11

Merged
zijiren233 merged 1 commit into
labring-sigs:mainfrom
zijiren233:fix/zero-worker-readiness
Oct 27, 2026
Merged

zijiren233 merged 1 commit into
labring-sigs:mainfrom
zijiren233:fix/zero-worker-readiness

Conversation

@zijiren233

Copy link
Copy Markdown
Collaborator

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):

  1. Startup discovery exited fatally on an empty worker set (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.
  2. Even with explicit --interface/--router-cidr, a running controller with zero workers recorded no probe-healthy worker and served a red /readyz.

Change

  • discovery exports ErrNoWorkers (+ IsNoWorkers) so the empty-worker case is distinguishable from real misconfiguration, and adds HasWorkerNodes(ctx, reader).
  • app.Run: when resolve fails solely due to ErrNoWorkers, a prelude serves green /healthz, /readyz and a pending /status on 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.
  • Reconciler: zero observed workers now records a ready idle state (empty route set, routes pruned) instead of degraded. Workers existing but none probe-healthy keeps reporting degraded as before.

Tests

  • TestResolveReportsNoWorkersSentinel, TestHasWorkerNodes, TestReconcileStandsByWithZeroWorkers.

Signed-off-by: zijiren233 pyh1670605849@gmail.com

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
zijiren233 force-pushed the fix/zero-worker-readiness branch from fe2ba4c to 49a32c0 Compare October 27, 2026 08:08
@zijiren233
zijiren233 merged commit 5ba050c into labring-sigs:main Oct 27, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant