From e34caf9f163eabc084151032e70a2c69687d5ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20K=C5=82obuszewski?= Date: Thu, 23 Jan 2025 20:37:09 +0100 Subject: [PATCH] Revert https://github.com/kubernetes/autoscaler/pull/7233 https://github.com/kubernetes/autoscaler/pull/7233 broke `--leader-elect` flag by introducing `--lease-resource-name` that is redundant with `--leader-elect-resource-name` --- cluster-autoscaler/main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index a1f816a4cf8..269af1c8453 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -114,7 +114,6 @@ func multiStringFlag(name string, usage string) *MultiStringFlag { } var ( - leaseResourceName = flag.String("lease-resource-name", "cluster-autoscaler", "The lease resource to use in leader election.") clusterName = flag.String("cluster-name", "", "Autoscaled cluster name, if available") address = flag.String("address", ":8085", "The address to expose prometheus metrics.") kubernetes = flag.String("kubernetes", "", "Kubernetes master location. Leave blank for default") @@ -712,8 +711,7 @@ func main() { } } - leaderElection := defaultLeaderElectionConfiguration() - leaderElection.LeaderElect = true + leaderElection := leaderElectionConfiguration() componentopts.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine) logs.InitLogs() @@ -795,14 +793,14 @@ func main() { } } -func defaultLeaderElectionConfiguration() componentbaseconfig.LeaderElectionConfiguration { +func leaderElectionConfiguration() componentbaseconfig.LeaderElectionConfiguration { return componentbaseconfig.LeaderElectionConfiguration{ - LeaderElect: false, + LeaderElect: true, LeaseDuration: metav1.Duration{Duration: defaultLeaseDuration}, RenewDeadline: metav1.Duration{Duration: defaultRenewDeadline}, RetryPeriod: metav1.Duration{Duration: defaultRetryPeriod}, ResourceLock: resourcelock.LeasesResourceLock, - ResourceName: *leaseResourceName, + ResourceName: "cluster-autoscaler", } }