Skip to content

Commit

Permalink
Slow the default lease retry and renew rate for machine controller
Browse files Browse the repository at this point in the history
Prevent machine controllers from writing in etcd at idle too often
by setting 120s lease, 20s retry and 110s deadline on all renewals.
Higher values cause tests to flake.
BZ 1858403
  • Loading branch information
Danil-Grigorev committed Aug 19, 2020
1 parent 679ccd8 commit 7ccf749
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
)

// The default durations for the leader electrion operations.
var (
leaseDuration = 120 * time.Second
renewDealine = 110 * time.Second
retryPeriod = 20 * time.Second
)

func main() {
printVersion := flag.Bool(
"version",
Expand Down Expand Up @@ -70,7 +77,7 @@ func main() {

leaderElectLeaseDuration := flag.Duration(
"leader-elect-lease-duration",
90*time.Second,
leaseDuration,
"The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled.",
)

Expand Down Expand Up @@ -105,6 +112,9 @@ func main() {
HealthProbeBindAddress: *healthAddr,
SyncPeriod: &syncPeriod,
MetricsBindAddress: *metricsAddress,
// Slow the default retry and renew election rate to reduce etcd writes at idle: BZ 1858400
RetryPeriod: &retryPeriod,
RenewDeadline: &renewDealine,
}

if *watchNamespace != "" {
Expand Down

0 comments on commit 7ccf749

Please sign in to comment.