Skip to content

Commit

Permalink
add node name to constructed machine lifecycle
Browse files Browse the repository at this point in the history
  • Loading branch information
kannon92 committed Nov 7, 2024
1 parent 8b023ce commit 44e19ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/monitortests/machines/watchmachines/monitortest.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ func (*machineWatcher) ConstructComputedIntervals(ctx context.Context, startingI
}

deletionTime := time.Time{}
nodeName := "unknown"
deletedIntervals := monitorapi.Intervals(allMachineChanges).Filter(func(eventInterval monitorapi.Interval) bool {
return eventInterval.Message.Reason == monitorapi.MachineDeletedInAPI
})
if len(deletedIntervals) > 0 {
deletionTime = deletedIntervals[0].To
nodeName = deletedIntervals[0].Message.Annotations[monitorapi.AnnotationNode]
}
if len(lastPhase) > 0 {
constructedIntervals = append(constructedIntervals,
Expand All @@ -99,6 +101,7 @@ func (*machineWatcher) ConstructComputedIntervals(ctx context.Context, startingI
Message(monitorapi.NewMessage().Reason(monitorapi.MachinePhase).
Constructed(monitorapi.ConstructionOwnerMachineLifecycle).
WithAnnotation(monitorapi.AnnotationPhase, lastPhase).
WithAnnotation(monitorapi.AnnotationNode, nodeName).
HumanMessage(fmt.Sprintf("Machine is in %q", lastPhase))).
Display().
Build(previousChangeTime, deletionTime),
Expand Down

0 comments on commit 44e19ca

Please sign in to comment.