diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 3395b26ac6e7..1ef390ba5b5f 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -694,6 +694,10 @@ func main() { klog.Fatalf("Failed to add logging feature flags: %v", err) } + leaderElection := defaultLeaderElectionConfiguration() + leaderElection.LeaderElect = true + componentopts.BindLeaderElectionFlags(&leaderElection, pflag.CommandLine) + logsapi.AddFlags(loggingConfig, pflag.CommandLine) featureGate.AddFlag(pflag.CommandLine) kube_flag.InitFlags() @@ -707,10 +711,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)