fix: set drain-succeeded when a custom drain completes or is skipped #2561
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2561"
general
weight: 0.35
KaivalyaMDabhadkar
Summary
Fixes #2539.
When a custom drain completed, node-drainer marked the event
AlreadyDrainedbut left the node'sdgxc.nvidia.com/nvsentinel-statelabel atdraining. fault-remediation then failed its first attempt ondraining -> remediatingand created no maintenance CR on that attempt.DrainOverrides.Skiphad the same gap fromquarantined.drain-succeededwhen a custom drain CR completes (the event's own CR, or the completed CR of another event of the node) and forDrainOverrides.Skip. The write is conditional. A completed CR replacesquarantinedordraining. Skip replaces onlyquarantined, because adraininglabel then belongs to the drain of another event. A label that another module has moved on (for exampleremediating) or removed is never overwritten or added back. Healthy events and events covered by an earlier drain leave the label alone. A completed custom drain also takes the node out of the draining queue priority, as the built-in drain does. A deleted node has no label to move, so its event is still markedAlreadyDrained.StateManager.UpdateNVSentinelStateNodeLabelIfMatch, the set counterpart ofRemoveNVSentinelStateNodeLabelIfMatch. The check and the write share one conflict-retried read and update.remediatingwrite lands but reports an unexpected transition,performRemediationgoes on if the node's quarantine annotation still lists the event. If the annotation no longer lists it, the attempt fails as before. fault-quarantine removes the label when a quarantine ends, and that failure is what stops a never-attempted event of an ended session, becauseeventResolvedInStorechecks the live quarantine only after a failed attempt. The write after the CR is created fails the attempt only when the label was not written.drain-succeededrows indocs/state-manager.md, the skip row indocs/health-event-data-model.md, the state list indocs/runbooks/cordoned-nodes.mdand the label table indocs/tutorials/requesting-node-maintenance.md.TestPerformRemediationWithUpdateNodeStateLabelFailuresasserted that a written but unexpected label fails the attempt, which is the behaviour this issue reports (its own comment said the remediation should still succeed).TestPerformRemediation_LabelUpdateError_ContinuesOnlyWhenLabelWrittenAndEventQuarantinedreplaces it and keeps the failing cases: label not written, quarantine ended, live node read error.Not in this change:
drainingwith a terminal event are not repaired.HealthEvent.Id(lifecycle-manager) do not match the quarantine annotation by ID. That is #2540, fixed separately. With this change, their first attempt no longer fails on the label. A retry after any other failure still hits #2540.UpdateNVSentinelStateNodeLabelIfMatchwith the same signature that also validates the transition. node-drainer only uses valid transitions (quarantinedordrainingtodrain-succeeded), so it works with either version. Whichever PR merges second keeps one copy. Oncedrain-stoppedexists, the two lists of replaceable values here need a decision on it.Testing
Manual test on the custom drain demo (
demos/local-slinky-drain-demo, chart v1.33.0, slinky-drainer completing theDrainRequest, XID 95 injected on the fake DCGM). The kind node runs Kubernetes 1.32, where node-drainer from main does not start (it needsresource.k8s.io/v1), so this change was applied to v1.33.0 for the run. The ConfigMap and RBAC were the v1.33.0 rendering in both runs.Drain CR completed, thenDeleted custom drain CR, with no label write. The label stayeddrainingfor the 7 minutes observed.Drain CR completed, thenLabel conditionally updated ... previousValue=draining value=drain-succeeded9 ms later, thenDeleted custom drain CR. The demo's recovery then uncordoned the node and removed the label, and node-drainer wrote no label for the recovery events.fault-remediation is disabled in the demo, so its first attempt was not part of the manual run.
go vet, golangci-lint v2.15.0 andgo test -race ./...pass for commons, node-drainer and fault-remediation. The regression tests below fail against main b0e0132d9:TestReconciler_CustomDrainCRCompleted_MovesDrainingLabelToDrainSucceeded: the event's own CR, or an earlier event's CR, completes and the label moves fromdraining(orquarantined) todrain-succeeded. A label set toremediatingor removed during the drain stays as it is. The node's next event is queued at high priority.TestReconciler_HealthyAndSkip_OnlySkipMovesQuarantinedToDrainSucceeded: Skip movesquarantinedtodrain-succeededand keeps another drain'sdraininglabel and queue priority. A healthy event never moves the label.DrainSucceededFromfor every result of the custom drain, skip, healthy and covered paths.TestUpdateNVSentinelStateNodeLabelIfMatch_: matching value, value not expected, missing label, a newer value written during a conflict, update error, node not found.TestReconcile_AlreadyDrainedEventWithStaleStateLabel_RemediatesOnlyActiveUnhealthyEvent: with the label atdrainingorquarantinedand the event in the quarantine annotation, the first attempt creates the CR. An event whose quarantine ended before its first attempt fails without a CR. A healthy event creates no CR.TestPerformRemediation_LabelUpdateError_ContinuesOnlyWhenLabelWrittenAndEventQuarantined.Type of Change
Component(s) Affected
Testing
Checklist
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->
Summary by CodeRabbit
Bug Fixes
Skipped drains and completed custom drains now set a node to
drain-succeededonly from eligible states, preserving unrelated or newer states.Remediation now verifies that quarantine is still active before proceeding and handles state-update errors when the update took effect.
Events whose quarantine has ended are closed without starting remediation. Events already covered by a maintenance request wait for that request or close with it.
Documentation
* Clarified when skipped drains and completed custom drains result in the
drain-succeededstate.<!-- end of auto-generated comment: release notes by coderabbit.ai -->