|
62 | 62 | retryIntervalStart = flag.Duration("retry-interval-start", time.Second, "Initial retry interval of failed create volume or deletion. It doubles with each failure, up to retry-interval-max.")
|
63 | 63 | retryIntervalMax = flag.Duration("retry-interval-max", 5*time.Minute, "Maximum retry interval of failed create volume or deletion.")
|
64 | 64 |
|
65 |
| - enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.") |
66 |
| - leaderElectionNamespace = flag.String("leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set.") |
| 65 | + enableLeaderElection = flag.Bool("leader-election", false, "Enable leader election.") |
| 66 | + leaderElectionNamespace = flag.String("leader-election-namespace", "", "Namespace where the leader election resource lives. Defaults to the pod namespace if not set.") |
| 67 | + leaderElectionLeaseDuration = flag.Duration("leader-election-lease-duration", 15*time.Second, "Duration, in seconds, that non-leader candidates will wait to force acquire leadership. Defaults to 15 seconds.") |
| 68 | + leaderElectionRenewDeadline = flag.Duration("leader-election-renew-deadline", 10*time.Second, "Duration, in seconds, that the acting leader will retry refreshing leadership before giving up. Defaults to 10 seconds.") |
| 69 | + leaderElectionRetryPeriod = flag.Duration("leader-election-retry-period", 5*time.Second, "Duration, in seconds, the LeaderElector clients should wait between tries of actions. Defaults to 5 seconds.") |
67 | 70 |
|
68 | 71 | reconcileSync = flag.Duration("reconcile-sync", 1*time.Minute, "Resync interval of the VolumeAttachment reconciler.")
|
69 | 72 |
|
@@ -261,6 +264,10 @@ func main() {
|
261 | 264 | le.WithNamespace(*leaderElectionNamespace)
|
262 | 265 | }
|
263 | 266 |
|
| 267 | + le.WithLeaseDuration(*leaderElectionLeaseDuration) |
| 268 | + le.WithRenewDeadline(*leaderElectionRenewDeadline) |
| 269 | + le.WithRetryPeriod(*leaderElectionRetryPeriod) |
| 270 | + |
264 | 271 | if err := le.Run(); err != nil {
|
265 | 272 | klog.Fatalf("failed to initialize leader election: %v", err)
|
266 | 273 | }
|
|
0 commit comments