Skip to content

Commit 55338a5

Browse files
authored
Extend lease duration (#81)
1 parent 5a44069 commit 55338a5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package main
1919
import (
2020
"flag"
2121
"os"
22+
"time"
2223

2324
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
2425
// to ensure that exec-entrypoint and run can make use of them.
@@ -65,13 +66,21 @@ func main() {
6566

6667
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
6768

69+
// we extend these because the API server is often unavailable during reconciliation for this operator
70+
leaseDuration := 60 * time.Second
71+
renewDeadline := 50 * time.Second
72+
retryPeriod := 10 * time.Second
73+
6874
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
6975
Scheme: scheme,
7076
MetricsBindAddress: metricsAddr,
7177
Port: 9443,
7278
HealthProbeBindAddress: probeAddr,
7379
LeaderElection: enableLeaderElection,
7480
LeaderElectionID: "f4de3632.rhsyseng.github.io",
81+
LeaseDuration: &leaseDuration,
82+
RenewDeadline: &renewDeadline,
83+
RetryPeriod: &retryPeriod,
7584
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
7685
// when the Manager ends. This requires the binary to immediately end when the
7786
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly

0 commit comments

Comments
 (0)