Skip to content
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