From 9a9aef576e7f42d21541ea8ea79cdc8a9168c669 Mon Sep 17 00:00:00 2001 From: bells17 Date: Thu, 17 Aug 2023 23:08:23 +0900 Subject: [PATCH] Remove settings of logtostderr flag value --- cmd/livenessprobe/main.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/cmd/livenessprobe/main.go b/cmd/livenessprobe/main.go index db22434f..4ef36ef3 100644 --- a/cmd/livenessprobe/main.go +++ b/cmd/livenessprobe/main.go @@ -124,28 +124,11 @@ func acquireConnection(ctx context.Context, metricsManager metrics.CSIMetricsMan } func main() { - // We run `klog.InitFlags` to configure the `logtostderr` option. - // Due to a conflict with `logsapi.AddGoFlags`, we set only - // the `logtostderr` option in `flag.CommandLine` using the `fs` variable - // to avoid errors. - // - // For options set by klog and component-base logs, see the links below: - // https://github.com/kubernetes/component-base/blob/v0.28.0-rc.0/logs/api/v1/options.go#L337-L355 - // https://github.com/kubernetes/klog/blob/v2.100.1/klog.go#L400-L424 - var fs flag.FlagSet - klog.InitFlags(&fs) - fs.VisitAll(func(f *flag.Flag) { - switch f.Name { - case "logtostderr": - flag.CommandLine.Var(f.Value, f.Name, f.Usage) - } - }) fg := featuregate.NewFeatureGate() logsapi.AddFeatureGates(fg) c := logsapi.NewLoggingConfiguration() logsapi.AddGoFlags(c, flag.CommandLine) logs.InitLogs() - flag.Set("logtostderr", "true") flag.Parse() if err := logsapi.ValidateAndApply(c, fg); err != nil { klog.ErrorS(err, "LoggingConfiguration is invalid")