From 6cf41290b6b025e089301ce353826fb5b73d588a 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 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)