mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
fix: quit when loosing leadership (#6718)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: shuting <shuting@nirmata.com>
This commit is contained in:
parent
9ac141fcb9
commit
75280aad28
3 changed files with 6 additions and 27 deletions
|
@ -309,13 +309,6 @@ func main() {
|
|||
controller.Run(signalCtx, logger.WithName("controllers"), &wg)
|
||||
}
|
||||
// start leader election
|
||||
for {
|
||||
select {
|
||||
case <-signalCtx.Done():
|
||||
wg.Wait()
|
||||
return
|
||||
default:
|
||||
le.Run(signalCtx)
|
||||
}
|
||||
}
|
||||
le.Run(signalCtx)
|
||||
wg.Wait()
|
||||
}
|
||||
|
|
|
@ -229,13 +229,6 @@ func main() {
|
|||
)
|
||||
// start server
|
||||
server.Run(ctx.Done())
|
||||
// wait for termination signal and run leader election loop
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
default:
|
||||
le.Run(ctx)
|
||||
}
|
||||
}
|
||||
// start leader election
|
||||
le.Run(ctx)
|
||||
}
|
||||
|
|
|
@ -415,13 +415,6 @@ func main() {
|
|||
for _, controller := range nonLeaderControllers {
|
||||
controller.Run(ctx, logger.WithName("controllers"), &wg)
|
||||
}
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
wg.Wait()
|
||||
return
|
||||
default:
|
||||
le.Run(ctx)
|
||||
}
|
||||
}
|
||||
le.Run(ctx)
|
||||
wg.Wait()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue