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 authored and elmiko committed Aug 26, 2020
1 parent e4373cc commit 3621226
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmd/manager/main.go
Expand Up @@ -34,6 +34,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 @@ -61,7 +68,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 @@ -90,6 +97,9 @@ func main() {
SyncPeriod: &syncPeriod,
// Disable metrics serving
MetricsBindAddress: "0",
// 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 3621226

Please sign in to comment.