Skip to content

Commit

Permalink
Merge pull request #1354 from vincepri/close-channel-after-runnables
Browse files Browse the repository at this point in the history
🐛 Manager.Elected() should beclosed after runnables are started
  • Loading branch information
k8s-ci-robot committed Jan 21, 2021
2 parents ad68b43 + c9e1c10 commit e1dbc44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/manager/internal.go
Expand Up @@ -483,8 +483,8 @@ func (cm *controllerManager) Start(ctx context.Context) (err error) {
}
} else {
// Treat not having leader election enabled the same as being elected.
cm.startLeaderElectionRunnables()
close(cm.elected)
go cm.startLeaderElectionRunnables()
}
}()

Expand Down Expand Up @@ -640,8 +640,8 @@ func (cm *controllerManager) startLeaderElection() (err error) {
RetryPeriod: cm.retryPeriod,
Callbacks: leaderelection.LeaderCallbacks{
OnStartedLeading: func(_ context.Context) {
close(cm.elected)
cm.startLeaderElectionRunnables()
close(cm.elected)
},
OnStoppedLeading: cm.onStoppedLeading,
},
Expand Down

0 comments on commit e1dbc44

Please sign in to comment.