fix: Ensure we keep observing

This commit is contained in:
Dries De Peuter 2023-04-27 09:56:31 +02:00
parent 01946451cb
commit f17f8acfef
No known key found for this signature in database

View file

@ -108,7 +108,10 @@ func main() {
RetryPeriod: 5 * time.Second,
Callbacks: leaderelection.LeaderCallbacks{
OnStartedLeading: func(ctx context.Context) {
loop(ctx, clientset)
for {
// ensure that we keep observing
loop(ctx, clientset)
}
},
OnStoppedLeading: func() {
klog.Infof("leader lost: %s", id)
@ -155,7 +158,6 @@ func loop(ctx context.Context, clientset *kubernetes.Clientset) {
klog.Error(err)
}
})
}
}