-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
#1468 introduced warning handling. Unfortunately, the code makes an assumption that it's the place in a program that has the authority to set global warning handlers. It's simply not true.
controller-runtime/pkg/client/client.go
Lines 91 to 98 in 0c2effb
rest.SetDefaultWarningHandler( | |
log.NewKubeAPIWarningLogger( | |
logger, | |
log.KubeAPIWarningLoggerOptions{ | |
Deduplicate: !options.Opts.AllowDuplicateLogs, | |
}, | |
), | |
) |
The code above shouldn't mess with globals, it should be done by the program's author in main()
or something like that. The above code should only set warning handler on the provided config. And even that is questionable - if the caller wants, they can just configure that by themself, right? In the config they are providing and/or via the mentioned global. controller-runtime simply doesn't need to do anything, this code should be removed.
In my concrete situation I set warning handler in main()
and it's overwritten by controller-runtime somewhere deep in the call stack.