Skip to content

Commit

Permalink
Revert #7233
Browse files Browse the repository at this point in the history
#7233 broke `--leader-elect` flag by introducing `--lease-resource-name` that is redundant with `--leader-elect-resource-name`
  • Loading branch information
x13n authored Jan 23, 2025
1 parent f6064ee commit e34caf9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions cluster-autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -712,8 +711,7 @@ func main() {
}
}

leaderElection := defaultLeaderElectionConfiguration()
leaderElection.LeaderElect = true
leaderElection := leaderElectionConfiguration()
componentopts.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine)

logs.InitLogs()
Expand Down Expand Up @@ -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",
}
}

Expand Down

0 comments on commit e34caf9

Please # to comment.