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

BUG 1858400: [Performance] Lease refresh period for machine-api-controllers is too high, causes heavy writes to etcd at idle #114

Merged
merged 1 commit into from
Aug 25, 2020
Merged
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
12 changes: 11 additions & 1 deletion cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ import (
"sigs.k8s.io/controller-runtime/pkg/runtime/signals"
)

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

func main() {

flag.Set("logtostderr", "true")
Expand Down Expand Up @@ -62,7 +69,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.",
)
metricsAddress := flag.String(
Expand All @@ -88,6 +95,9 @@ func main() {
LeaderElectionID: "cluster-api-provider-openstack-leader",
LeaseDuration: leaderElectLeaseDuration,
MetricsBindAddress: *metricsAddress,
// Slow the default retry and renew election rate to reduce etcd writes at idle: BZ 1858400
RetryPeriod: &retryPeriod,
RenewDeadline: &renewDeadline,
}
if *watchNamespace != "" {
opts.Namespace = *watchNamespace
Expand Down