Skip to content

Commit

Permalink
Extend lease duration (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
loganmc10 authored Jul 14, 2023
1 parent 5a44069 commit 55338a5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"flag"
"os"
"time"

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

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

// we extend these because the API server is often unavailable during reconciliation for this operator
leaseDuration := 60 * time.Second
renewDeadline := 50 * time.Second
retryPeriod := 10 * time.Second

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
Port: 9443,
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f4de3632.rhsyseng.github.io",
LeaseDuration: &leaseDuration,
RenewDeadline: &renewDeadline,
RetryPeriod: &retryPeriod,
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
// when the Manager ends. This requires the binary to immediately end when the
// Manager is stopped, otherwise, this setting is unsafe. Setting this significantly
Expand Down

0 comments on commit 55338a5

Please sign in to comment.