fix: Ensure we keep observing
This commit is contained in:
parent
01946451cb
commit
f17f8acfef
1 changed files with 4 additions and 2 deletions
|
@ -108,7 +108,10 @@ func main() {
|
||||||
RetryPeriod: 5 * time.Second,
|
RetryPeriod: 5 * time.Second,
|
||||||
Callbacks: leaderelection.LeaderCallbacks{
|
Callbacks: leaderelection.LeaderCallbacks{
|
||||||
OnStartedLeading: func(ctx context.Context) {
|
OnStartedLeading: func(ctx context.Context) {
|
||||||
|
for {
|
||||||
|
// ensure that we keep observing
|
||||||
loop(ctx, clientset)
|
loop(ctx, clientset)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
OnStoppedLeading: func() {
|
OnStoppedLeading: func() {
|
||||||
klog.Infof("leader lost: %s", id)
|
klog.Infof("leader lost: %s", id)
|
||||||
|
@ -155,7 +158,6 @@ func loop(ctx context.Context, clientset *kubernetes.Clientset) {
|
||||||
klog.Error(err)
|
klog.Error(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue