pub fn ready_condition(
state: NodeReadiness,
now: &str,
previous: Option<&ResourceValue>,
) -> ResourceValueExpand description
The Ready condition to publish on Node.status.
previous is the condition currently on the Node, when there is one.
── ★ THE TWO TIMESTAMPS ARE NOT THE SAME TIMESTAMP ───────────────────────
This function used to stamp both with now unconditionally, which makes
lastTransitionTime a synonym for lastHeartbeatTime and destroys the only
question either field exists to answer: how long has the node been in this
state? With both moving every tick, a node that went unreachable an hour
ago reports a transition time of now, forever.
That is load-bearing rather than cosmetic. Upstream’s pod-eviction path is
driven by how long Ready has been non-True (--pod-eviction-timeout
against lastTransitionTime), so a transition time that always reads
“just now” is a timer that never fires. It is also what kubectl describe node prints, so an operator reading it is told every outage is fresh.
Hence:
lastHeartbeatTime— alwaysnow. It records that we looked.lastTransitionTime—nowONLY when the status string differs fromprevious; otherwise the previous value is carried forward verbatim.
A previous with no readable lastTransitionTime (a hand-written Node, or
the boot-time literal this replaces) falls back to now, which is the
honest answer: we genuinely do not know when it transitioned.