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

Revert https://github.com/kubernetes/autoscaler/pull/7233 #7759

Closed
wants to merge 2 commits into from
Closed
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
14 changes: 6 additions & 8 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 @@ -692,6 +691,9 @@ func run(healthCheck *metrics.HealthCheck, debuggingSnapshotter debuggingsnapsho
func main() {
klog.InitFlags(nil)

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

featureGate := utilfeature.DefaultMutableFeatureGate
loggingConfig := logsapi.NewLoggingConfiguration()

Expand All @@ -712,10 +714,6 @@ func main() {
}
}

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

logs.InitLogs()
if err := logsapi.ValidateAndApply(loggingConfig, featureGate); err != nil {
klog.Fatalf("Failed to validate and apply logging configuration: %v", err)
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
Loading