Skip to content

Commit

Permalink
Merge pull request #1047 from jdef/patch-2
Browse files Browse the repository at this point in the history
✨ optionally override leader election client config
  • Loading branch information
k8s-ci-robot committed Jul 16, 2020
2 parents f98ea97 + 32a79b6 commit 4db8229
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ type Options struct {
// will use for holding the leader lock.
LeaderElectionID string

// LeaderElectionConfig can be specified to override the default configuration
// that is used to build the leader election client.
LeaderElectionConfig *rest.Config

// LeaseDuration is the duration that non-leader candidates will
// wait to force acquire leadership. This is measured against time of
// last observed ack. Default is 15 seconds.
Expand Down Expand Up @@ -288,7 +292,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
}

// Create the resource lock to enable leader election)
resourceLock, err := options.newResourceLock(config, recorderProvider, leaderelection.Options{
leaderConfig := config
if options.LeaderElectionConfig != nil {
leaderConfig = options.LeaderElectionConfig
}
resourceLock, err := options.newResourceLock(leaderConfig, recorderProvider, leaderelection.Options{
LeaderElection: options.LeaderElection,
LeaderElectionID: options.LeaderElectionID,
LeaderElectionNamespace: options.LeaderElectionNamespace,
Expand Down

0 comments on commit 4db8229

Please sign in to comment.