Skip to content

Commit

Permalink
Ensure kubexit does not hang when watched pod is ready when started (#7)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
RemcodM authored Aug 1, 2020
1 parent a1a6f55 commit 4e1c0c9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/kubexit/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ func onReadyOfAll(birthDeps []string, callback func()) kubernetes.EventHandler {

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

Expand Down

0 comments on commit 4e1c0c9

Please sign in to comment.