Skip to content

Commit 4db8229

Browse files
authored
Merge pull request #1047 from jdef/patch-2
✨ optionally override leader election client config
2 parents f98ea97 + 32a79b6 commit 4db8229

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
@@ -140,6 +140,10 @@ type Options struct {
140140
// will use for holding the leader lock.
141141
LeaderElectionID string
142142

143+
// LeaderElectionConfig can be specified to override the default configuration
144+
// that is used to build the leader election client.
145+
LeaderElectionConfig *rest.Config
146+
143147
// LeaseDuration is the duration that non-leader candidates will
144148
// wait to force acquire leadership. This is measured against time of
145149
// last observed ack. Default is 15 seconds.
@@ -288,7 +292,11 @@ func New(config *rest.Config, options Options) (Manager, error) {
288292
}
289293

290294
// Create the resource lock to enable leader election)
291-
resourceLock, err := options.newResourceLock(config, recorderProvider, leaderelection.Options{
295+
leaderConfig := config
296+
if options.LeaderElectionConfig != nil {
297+
leaderConfig = options.LeaderElectionConfig
298+
}
299+
resourceLock, err := options.newResourceLock(leaderConfig, recorderProvider, leaderelection.Options{
292300
LeaderElection: options.LeaderElection,
293301
LeaderElectionID: options.LeaderElectionID,
294302
LeaderElectionNamespace: options.LeaderElectionNamespace,

0 commit comments

Comments
 (0)