Fixes exited messages when leaderelection lost

This commit is contained in:
Kun Zhang
2022-03-24 17:33:16 +08:00
parent 56f45c5c81
commit 6f8e9aa05d
3 changed files with 9 additions and 5 deletions

View File

@@ -277,7 +277,8 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
run(ctx, startSATokenController, initializersFunc)
},
OnStoppedLeading: func() {
klog.Fatalf("leaderelection lost")
klog.ErrorS(nil, "leaderelection lost")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
},
})
@@ -300,7 +301,8 @@ func Run(c *config.CompletedConfig, stopCh <-chan struct{}) error {
run(ctx, nil, createInitializersFunc(leaderMigrator.FilterFunc, leadermigration.ControllerMigrated))
},
OnStoppedLeading: func() {
klog.Fatalf("migration leaderelection lost")
klog.ErrorS(nil, "migration leaderelection lost")
klog.FlushAndExit(klog.ExitFlushTimeout, 1)
},
})
}