Skip to content

Commit 365ae09

Browse files
authored
Merge pull request #1944 from ash2k/no-global-warning-mutation
⚠️ Do not mutate the global warning handler
2 parents 17893a8 + f7d95bb commit 365ae09

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

pkg/client/client.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,12 @@ func newClient(config *rest.Config, options Options) (*client, error) {
8888
// is log.KubeAPIWarningLogger with deduplication enabled.
8989
// See log.KubeAPIWarningLoggerOptions for considerations
9090
// regarding deduplication.
91-
rest.SetDefaultWarningHandler(
92-
log.NewKubeAPIWarningLogger(
93-
logger,
94-
log.KubeAPIWarningLoggerOptions{
95-
Deduplicate: !options.Opts.AllowDuplicateLogs,
96-
},
97-
),
91+
config = rest.CopyConfig(config)
92+
config.WarningHandler = log.NewKubeAPIWarningLogger(
93+
logger,
94+
log.KubeAPIWarningLoggerOptions{
95+
Deduplicate: !options.Opts.AllowDuplicateLogs,
96+
},
9897
)
9998
}
10099

0 commit comments

Comments
 (0)