From f7d95bba63ba24016f16aae1cf702cebb23049de Mon Sep 17 00:00:00 2001 From: Mikhail Mazurskiy Date: Tue, 28 Jun 2022 13:26:02 +1000 Subject: [PATCH] Do not mutate the global warning handler Only configure the local warning handler. --- pkg/client/client.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/client/client.go b/pkg/client/client.go index d56e6fe79c..730e0ba910 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -88,13 +88,12 @@ func newClient(config *rest.Config, options Options) (*client, error) { // is log.KubeAPIWarningLogger with deduplication enabled. // See log.KubeAPIWarningLoggerOptions for considerations // regarding deduplication. - rest.SetDefaultWarningHandler( - log.NewKubeAPIWarningLogger( - logger, - log.KubeAPIWarningLoggerOptions{ - Deduplicate: !options.Opts.AllowDuplicateLogs, - }, - ), + config = rest.CopyConfig(config) + config.WarningHandler = log.NewKubeAPIWarningLogger( + logger, + log.KubeAPIWarningLoggerOptions{ + Deduplicate: !options.Opts.AllowDuplicateLogs, + }, ) }