Skip to content

Commit 35bd1e6

Browse files
committed
Emit a pod event when WatchConditions are completed
1 parent da9c2c5 commit 35bd1e6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pkg/kubelet/pleg/generic.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ func (g *GenericPLEG) Relist() {
317317
completedConditions = append(completedConditions, condition)
318318
}
319319
}
320-
g.completeWatchConditions(pid, completedConditions)
320+
if len(completedConditions) > 0 {
321+
g.completeWatchConditions(pid, completedConditions)
322+
events = append(events, &PodLifecycleEvent{ID: pid, Type: ConditionMet})
323+
}
321324

322325
// Update the internal storage and send out the events.
323326
g.podRecords.update(pid)

pkg/kubelet/pleg/pleg.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const (
4747
PodSync PodLifeCycleEventType = "PodSync"
4848
// ContainerChanged - event type when the new state of container is unknown.
4949
ContainerChanged PodLifeCycleEventType = "ContainerChanged"
50+
// ConditionMet - event type triggered when any number of watch conditions are met.
51+
ConditionMet PodLifeCycleEventType = "ConditionMet"
5052
)
5153

5254
// PodLifecycleEvent is an event that reflects the change of the pod state.

0 commit comments

Comments
 (0)