Emit a pod event when WatchConditions are completed

This commit is contained in:
Tim Allclair 2024-11-04 16:51:26 -08:00
parent da9c2c553b
commit 35bd1e6831
2 changed files with 6 additions and 1 deletions

View File

@ -317,7 +317,10 @@ func (g *GenericPLEG) Relist() {
completedConditions = append(completedConditions, condition)
}
}
g.completeWatchConditions(pid, completedConditions)
if len(completedConditions) > 0 {
g.completeWatchConditions(pid, completedConditions)
events = append(events, &PodLifecycleEvent{ID: pid, Type: ConditionMet})
}
// Update the internal storage and send out the events.
g.podRecords.update(pid)

View File

@ -47,6 +47,8 @@ const (
PodSync PodLifeCycleEventType = "PodSync"
// ContainerChanged - event type when the new state of container is unknown.
ContainerChanged PodLifeCycleEventType = "ContainerChanged"
// ConditionMet - event type triggered when any number of watch conditions are met.
ConditionMet PodLifeCycleEventType = "ConditionMet"
)
// PodLifecycleEvent is an event that reflects the change of the pod state.