@@ -91,20 +91,23 @@ func init() {
91
91
}
92
92
93
93
var (
94
- enableLeaderElection bool
95
- leaderElectionNamespace string
96
- watchNamespace string
97
- watchFilterValue string
98
- profilerAddress string
99
- awsClusterConcurrency int
100
- instanceStateConcurrency int
101
- awsMachineConcurrency int
102
- waitInfraPeriod time.Duration
103
- syncPeriod time.Duration
104
- webhookPort int
105
- webhookCertDir string
106
- healthAddr string
107
- serviceEndpoints string
94
+ enableLeaderElection bool
95
+ leaderElectionLeaseDuration time.Duration
96
+ leaderElectionRenewDeadline time.Duration
97
+ leaderElectionRetryPeriod time.Duration
98
+ leaderElectionNamespace string
99
+ watchNamespace string
100
+ watchFilterValue string
101
+ profilerAddress string
102
+ awsClusterConcurrency int
103
+ instanceStateConcurrency int
104
+ awsMachineConcurrency int
105
+ waitInfraPeriod time.Duration
106
+ syncPeriod time.Duration
107
+ webhookPort int
108
+ webhookCertDir string
109
+ healthAddr string
110
+ serviceEndpoints string
108
111
109
112
// maxEKSSyncPeriod is the maximum allowed duration for the sync-period flag when using EKS. It is set to 10 minutes
110
113
// because during resync it will create a new AWS auth token which can a maximum life of 15 minutes and this ensures
@@ -170,6 +173,9 @@ func main() {
170
173
Scheme : scheme ,
171
174
Metrics : diagnosticsOpts ,
172
175
LeaderElection : enableLeaderElection ,
176
+ LeaseDuration : & leaderElectionLeaseDuration ,
177
+ RenewDeadline : & leaderElectionRenewDeadline ,
178
+ RetryPeriod : & leaderElectionRetryPeriod ,
173
179
LeaderElectionResourceLock : resourcelock .LeasesResourceLock ,
174
180
LeaderElectionID : "controller-leader-elect-capa" ,
175
181
LeaderElectionNamespace : leaderElectionNamespace ,
@@ -494,6 +500,27 @@ func initFlags(fs *pflag.FlagSet) {
494
500
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager." ,
495
501
)
496
502
503
+ fs .DurationVar (
504
+ & leaderElectionLeaseDuration ,
505
+ "leader-elect-lease-duration" ,
506
+ 15 * time .Second ,
507
+ "Interval at which non-leader candidates will wait to force acquire leadership (duration string)" ,
508
+ )
509
+
510
+ fs .DurationVar (
511
+ & leaderElectionRenewDeadline ,
512
+ "leader-elect-renew-deadline" ,
513
+ 10 * time .Second ,
514
+ "Duration that the leading controller manager will retry refreshing leadership before giving up (duration string)" ,
515
+ )
516
+
517
+ fs .DurationVar (
518
+ & leaderElectionRetryPeriod ,
519
+ "leader-elect-retry-period" ,
520
+ 2 * time .Second ,
521
+ "Duration the LeaderElector clients should wait between tries of actions (duration string)" ,
522
+ )
523
+
497
524
fs .StringVar (
498
525
& watchNamespace ,
499
526
"namespace" ,
0 commit comments