Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(RELEASE-1307): increases lease timeout #617

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ spec:
- /manager
args:
- --leader-elect
- --lease-duration
- 60
- --leader-renew-deadline
- 30
- --leader-elector-retry-period
- 10
image: controller:latest
name: manager
securityContext:
Expand Down
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"crypto/tls"
"flag"
"os"
"time"

"sigs.k8s.io/controller-runtime/pkg/metrics/server"
crwebhook "sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down Expand Up @@ -70,13 +71,23 @@
var metricsAddr string
var enableHttp2 bool
var enableLeaderElection bool
var leaderRenewDeadline time.Duration
var leaseDuration time.Duration
var leaderElectorRetryPeriod time.Duration

Check warning on line 76 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L74-L76

Added lines #L74 - L76 were not covered by tests
var probeAddr string
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableHttp2, "enable-http2", false, "Enable HTTP/2 for the metrics and webhook servers.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.DurationVar(&leaderRenewDeadline, "leader-renew-deadline", 10*time.Second,
"Leader RenewDeadline is the duration that the acting controlplane "+
"will retry refreshing leadership before giving up.")
flag.DurationVar(&leaseDuration, "lease-duration", 15*time.Second,
"Lease Duration is the duration that non-leader candidates will wait to force acquire leadership.")
flag.DurationVar(&leaderElectorRetryPeriod, "leader-elector-retry-period", 2*time.Second, "RetryPeriod is the duration the "+
"LeaderElector clients should wait between tries of actions.")

Check warning on line 90 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L84-L90

Added lines #L84 - L90 were not covered by tests
opts := zap.Options{
Development: true,
TimeEncoder: zapcore.ISO8601TimeEncoder,
Expand All @@ -90,6 +101,9 @@
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "f3d4c01a.redhat.com",
RenewDeadline: &leaderRenewDeadline,
LeaseDuration: &leaseDuration,
RetryPeriod: &leaderElectorRetryPeriod,

Check warning on line 106 in main.go

View check run for this annotation

Codecov / codecov/patch

main.go#L104-L106

Added lines #L104 - L106 were not covered by tests
Metrics: server.Options{
BindAddress: metricsAddr,
},
Expand Down
Loading