fix log initialization

InitLogs unconditionally disables contextual logging, while ValidateAndApply
checks the feature gate for that. InitLogs must come first, otherwise

    --feature-gates=ContextualLogging=true

doesn't work.
This commit is contained in:
Patrick Ohly 2023-09-29 14:33:46 +02:00
parent f9a7c7f73f
commit b9c0d91da7
1 changed files with 1 additions and 2 deletions

View File

@ -569,12 +569,11 @@ func main() {
featureGate.AddFlag(pflag.CommandLine)
kube_flag.InitFlags()
logs.InitLogs()
if err := logsapi.ValidateAndApply(loggingConfig, featureGate); err != nil {
klog.Fatalf("Failed to validate and apply logging configuration: %v", err)
}
logs.InitLogs()
healthCheck := metrics.NewHealthCheck(*maxInactivityTimeFlag, *maxFailingTimeFlag)
klog.V(1).Infof("Cluster Autoscaler %s", version.ClusterAutoscalerVersion)