diff --git a/pkg/controller/election.go b/pkg/controller/election.go index 3c3e402bfa5..2ed0631ddd6 100644 --- a/pkg/controller/election.go +++ b/pkg/controller/election.go @@ -44,13 +44,17 @@ func (c *Controller) leaderElection() { PodName: c.config.PodName, PodNamespace: c.config.PodNamespace, } - c.elector = setupLeaderElection(config) + + var flag bool for { if c.isLeader() { return } - klog.Info("waiting for becoming a leader") + if !flag { + klog.Info("waiting for becoming a leader") + flag = true + } time.Sleep(5 * time.Second) } }