1
0
Fork 0
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:
Charles-Edouard Brétéché 2023-04-03 17:17:44 +02:00 committed by GitHub
parent 9ac141fcb9
commit 75280aad28
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 27 deletions

View file

@ -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()
}

View file

@ -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)
}

View file

@ -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()
}