Skip to content

Commit 4e1c0c9

Browse files
authored
Ensure kubexit does not hang when watched pod is ready when started (#7)
If kubexit is started after a birth dependency has already become ready, kubexit never finds out about the ready status of the dependency. This is because kubexit only re-evaluates the ready status on an modified event, while such an event never occurs if the birth dependency is ready before kubexit started watching. I fixed this bug by also taking the `Added` event into consideration. This event is always emitted when kubexit starts watching the birth dependencies. If the dependencies are already ready, it will immediatly continue.
1 parent a1a6f55 commit 4e1c0c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmd/kubexit/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,8 @@ func onReadyOfAll(birthDeps []string, callback func()) kubernetes.EventHandler {
281281

282282
return func(event watch.Event) {
283283
fmt.Printf("Event Type: %v\n", event.Type)
284-
// ignore Added & Deleted (Watch will auto-stop on delete)
285-
if event.Type != watch.Modified {
284+
// ignore Deleted (Watch will auto-stop on delete)
285+
if event.Type == watch.Deleted {
286286
return
287287
}
288288

0 commit comments

Comments
 (0)