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