Skip to content

Commit

Permalink
Do not mutate the global warning handler
Browse files Browse the repository at this point in the history
Only configure the local warning handler.
  • Loading branch information
ash2k committed Jun 28, 2022
1 parent ffd9ec8 commit f7d95bb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pkg/client/client.go
Expand Up @@ -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,
},
)
}

Expand Down

0 comments on commit f7d95bb

Please sign in to comment.