Unverified Commit 10fd3330 authored by 张祖建's avatar 张祖建 Committed by GitHub
Browse files

fix duplicate logs for leader election (#1886)

parent 13ebb855
Showing with 6 additions and 2 deletions
+6 -2
......@@ -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)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment