Expand description
Publishing a node’s Ready condition as a store write, WITHOUT undoing
anyone else’s write to the Node (T1.3b).
── ★ THE ONE WRITER OF Ready ───────────────────────────────────────────
The condition reaches a client only through a committed write: a write
bumps metadata.resourceVersion and fans a MODIFIED to every watcher,
so an informer keyed on the revision sees each transition. Two callers
share this module and nothing else writes the condition:
- the kubelet, for its own node, every tick (it also refreshes the
heartbeat every
REPORT_FREQUENCY, as upstream’s kubelet posts status at least everynodeStatusReportFrequency); - the node-lifecycle controller (
crate::node_lifecycle), for every Node, so a node whose kubelet wedged or whose process died is moved toUnknownby a process that is still running.
Until 2026-10-15 the apiserver re-derived the condition on every GET and
LIST instead. That served content that changed under one
resourceVersion (measured on ryn: three reads 12 s apart, one revision,
three heartbeats; a LIST reading NotReady and a GET reading Ready at
the same revision), so no watch cache ever saw a heartbeat or a Ready
transition.
── ★ THE DEFECT THE PRECONDITION CLOSES ──────────────────────────────────
The kubelet read the whole Node, merged its Ready condition in, and wrote
the whole Node back with no precondition. Anything that committed between
that read and that write — kubectl cordon setting spec.unschedulable,
a taint, a label — was replaced by the kubelet’s older copy. Nothing
errored: the write succeeded, the condition it carried was correct, and the
cordon was simply gone. The scheduler then placed onto a node an operator
had just drained.
── ★ THE SHAPE ───────────────────────────────────────────────────────────
The write is a Put whose precondition is the per-key revision the Node
carried when it was read. ObservedNode is the only thing the write
accepts, and it cannot be built without that revision, so this module has
no path to a Node write without a precondition. A lost race is refused by
the store (replicated CAS: no mutation, no revision, no watch event); the
Node is re-read, the condition is re-derived against the fresh copy, and
the write is tried ONCE more. A second loss is dropped: the next tick
recomputes from whatever is current then, so a busy concurrent writer can
delay a readiness publish by a tick but can never be overwritten by one.
The condition itself comes from
crate::node_lease::project_ready_condition, the one derivation of
Ready from a Lease, so the kubelet and the lifecycle controller cannot
compute it two ways.
── ★ TIER, STATED ────────────────────────────────────────────────────────
A stale write being refused is enforced by the store’s CAS, identically on
every replica. That this module always states a precondition is a
construction discipline local to this file (a value that carries its
revision), not a crate-wide type: another module holding the store can
still issue an unconditional Node Put.
Structs§
- Observed
Node - A Node as read from the store, paired with the revision it was read at.
Enums§
- Readiness
Publish - What one readiness publish did. Each arm is a fact the publish observed; none is inferred from another.
- Unobservable
- Why a Node could not be observed at a revision.
Constants§
Functions§
- publish_
ready - Read the Node at
key, derive itsReadycondition fromlease, and write it with a precondition — retrying once after a re-read if a concurrent write got there first. - publish_
ready_ onto publish_readyfrom a Node already read.