client-go
client-go copied to clipboard
client-go LeaderElector will execute the OnStoppedLeading callback even if it is not a leader
https://github.com/kubernetes/client-go/blob/1ac8d459351e21458fd1041f41e43403eadcbdba/tools/leaderelection/leaderelection.go#L197-L213
OnStopedLeading
and OnStopedElecting
are different, should we move the call of OnStopedLeading
back?
if !le.acquire(ctx) {
return // ctx signalled done
}
defer func() {
le.config.Callbacks.OnStoppedLeading()
}()