Skip to main content

Module condition

Module condition 

Source
Expand description

T2.5 — one condition, set by its type, carried at most once.

★ THE DEFECT. A controller that reports a condition by writing it every tick wakes itself: the write fires a watch event, the event re-ticks the controller, and the controller writes again. The scheduler did this to an unschedulable pod, about 19 times a second (38 ticks in 2 s, measured 2026-09-18). Two ways into that loop:

  • proposing a condition the object already carries, and
  • re-stamping lastTransitionTime on every write, so that each write differs from the last one even when nothing about the condition did.

★ THE SHAPE. upsert_condition is the whole rule, as a pure function of the object read and the condition asserted:

  • a condition of the same type, status, reason and message is ConditionUpsert::Unchanged: there is nothing to write;
  • otherwise the condition is set in place, at the position the type already holds, or appended; every other condition is left as it was;
  • lastTransitionTime moves only when status does. A write that only rewords the message carries the recorded time forward, so “how long has this been False” keeps its answer. When there is no recorded time to carry, now is the honest fallback (the rule crate::node_lease::ready_condition already follows for a Node);
  • the result holds exactly one condition of the type: duplicates are collapsed into the first.

crate::status::upsert_condition_cas reads the object, applies this and writes the result at the revision it read. This mirrors upstream’s meta.SetStatusCondition (apimachinery pkg/api/meta/conditions.go).

Structs§

DesiredCondition
One condition as the controller that owns its type asserts it.

Enums§

ConditionStatus
A condition’s status: upstream’s closed set.
ConditionUpsert
What upsert_condition makes of the conditions an object carries.

Functions§

upsert_condition
Set desired on the conditions object carries, by type.