Skip to content

Commit 0f822e6

Browse files
committed
Fix Node NotReady intervals being left open when a node is deleted
Some tests stand up nodes, if they are deleted while not ready, the not ready intervals stay open until the end of the job, causing a misleading chart.
1 parent 77d41e0 commit 0f822e6

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

pkg/monitor/monitorapi/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ const (
223223
NodeFailedLeaseBackoff IntervalReason = "FailedToUpdateLeaseInBackoff"
224224
NodeDiskPressure IntervalReason = "NodeDiskPressure"
225225
NodeNoDiskPressure IntervalReason = "NodeNoDiskPressure"
226+
NodeDeleted IntervalReason = "Deleted"
226227

227228
MachineConfigChangeReason IntervalReason = "MachineConfigChange"
228229
MachineConfigReachedReason IntervalReason = "MachineConfigReached"

pkg/monitortests/node/nodestateanalyzer/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func intervalsFromEvents_NodeChanges(events monitorapi.Intervals, _ monitorapi.R
6161
if event.Source == monitorapi.SourceNodeMonitor {
6262
nodeStateTracker.OpenInterval(nodeLocator, notReadyState, event.From)
6363
}
64-
case "Ready":
64+
case "Ready", monitorapi.NodeDeleted:
6565
if event.Source == monitorapi.SourceNodeMonitor {
6666
mb := monitorapi.NewMessage().Reason(monitorapi.NodeNotReadyReason).
6767
HumanMessage("node is not ready").

pkg/monitortests/node/watchnodes/node.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ func startNodeMonitoring(ctx context.Context, m monitorapi.RecorderWriter, clien
278278
WithAnnotations(map[monitorapi.AnnotationKey]string{
279279
monitorapi.AnnotationRoles: nodeRoles(node),
280280
}).
281+
Reason(monitorapi.NodeDeleted).
281282
HumanMessage("deleted")).
282283
Build(now, now)
283284
m.AddIntervals(i)

0 commit comments

Comments
 (0)