Use context.TODO() to be explicit that cancellation is not implemented

This commit is contained in:
Mikhail Mazurskiy
2018-06-07 14:33:03 +10:00
parent 3252beb02b
commit 102090d1f1
4 changed files with 10 additions and 17 deletions

View File

@@ -157,11 +157,8 @@ func Run(c *cloudcontrollerconfig.CompletedConfig) error {
}
}
runCtx, cancel := context.WithCancel(context.Background())
defer cancel()
if !c.ComponentConfig.GenericComponent.LeaderElection.LeaderElect {
run(runCtx)
run(context.TODO())
panic("unreachable")
}
@@ -187,7 +184,7 @@ func Run(c *cloudcontrollerconfig.CompletedConfig) error {
}
// Try and become the leader and start cloud controller manager loops
leaderelection.RunOrDie(runCtx, leaderelection.LeaderElectionConfig{
leaderelection.RunOrDie(context.TODO(), leaderelection.LeaderElectionConfig{
Lock: rl,
LeaseDuration: c.ComponentConfig.GenericComponent.LeaderElection.LeaseDuration.Duration,
RenewDeadline: c.ComponentConfig.GenericComponent.LeaderElection.RenewDeadline.Duration,