Skip to content

Commit a148298

Browse files
jdefvincepri
authored andcommitted
optionally override leader election client config
1 parent e781fa5 commit a148298

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/manager/manager.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ type Options struct {
127127
// will use for holding the leader lock.
128128
LeaderElectionID string
129129

130+
// LeaderElectionConfig can be specified to override the default configuration
131+
// that is used to build the leader election client.
132+
LeaderElectionConfig *rest.Config
133+
130134
// LeaseDuration is the duration that non-leader candidates will
131135
// wait to force acquire leadership. This is measured against time of
132136
// last observed ack. Default is 15 seconds.
@@ -266,7 +270,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
266270
}
267271

268272
// Create the resource lock to enable leader election)
269-
resourceLock, err := options.newResourceLock(config, recorderProvider, leaderelection.Options{
273+
leaderConfig := config
274+
if options.LeaderElectionConfig != nil {
275+
leaderConfig = options.LeaderElectionConfig
276+
}
277+
resourceLock, err := options.newResourceLock(leaderConfig, recorderProvider, leaderelection.Options{
270278
LeaderElection: options.LeaderElection,
271279
LeaderElectionID: options.LeaderElectionID,
272280
LeaderElectionNamespace: options.LeaderElectionNamespace,

0 commit comments

Comments
 (0)