diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 975094311b44..c7eac74de112 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -550,6 +550,11 @@ func run(healthCheck *metrics.HealthCheck, debuggingSnapshotter debuggingsnapsho func main() { klog.InitFlags(nil) + + leaderElection := defaultLeaderElectionConfiguration() + leaderElection.LeaderElect = true + options.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine) + featureGate := utilfeature.DefaultMutableFeatureGate loggingConfig := logsapi.NewLoggingConfiguration() @@ -567,10 +572,6 @@ func main() { logs.InitLogs() - leaderElection := defaultLeaderElectionConfiguration() - leaderElection.LeaderElect = true - options.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine) - healthCheck := metrics.NewHealthCheck(*maxInactivityTimeFlag, *maxFailingTimeFlag) klog.V(1).Infof("Cluster Autoscaler %s", version.ClusterAutoscalerVersion)