From b9c0d91da7d1107f8ee05f08bf304a5a470011c3 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Fri, 29 Sep 2023 14:33:46 +0200 Subject: [PATCH] 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. --- cluster-autoscaler/main.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cluster-autoscaler/main.go b/cluster-autoscaler/main.go index 61caae6f5f52..edf55091c3f5 100644 --- a/cluster-autoscaler/main.go +++ b/cluster-autoscaler/main.go @@ -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)