From ebaf3554780f685bc79fbbea97be407637de0934 Mon Sep 17 00:00:00 2001 From: Youn Jae Kim Date: Fri, 15 Sep 2023 14:35:56 -0700 Subject: [PATCH] add elect-leader flag to the pflag --- cluster-autoscaler/main.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 6942cfdc72c..c5725acba39 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -486,6 +486,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() @@ -503,10 +508,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)