Skip to content

Commit f7d95bb

Browse files
committed
Do not mutate the global warning handler
Only configure the local warning handler.
1 parent ffd9ec8 commit f7d95bb

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)