vendor: revendor

This commit is contained in:
Sergiusz Urbaniak 2020-12-14 12:43:28 +01:00
parent 269295a414
commit 9f0440be0f
No known key found for this signature in database
GPG key ID: 44E6612519E13C39
669 changed files with 58447 additions and 20021 deletions

View file

@ -24,6 +24,7 @@ import (
"github.com/go-logr/logr"
"github.com/spf13/pflag"
"k8s.io/component-base/logs/sanitization"
"k8s.io/klog/v2"
)
@ -40,7 +41,8 @@ var supportedLogsFlags = map[string]struct{}{
// Options has klog format parameters
type Options struct {
LogFormat string
LogFormat string
LogSanitization bool
}
// NewOptions return new klog options
@ -88,6 +90,8 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) {
// No new log formats should be added after generation is of flag options
logRegistry.Freeze()
fs.BoolVar(&o.LogSanitization, "experimental-logging-sanitization", o.LogSanitization, `[Experimental] When enabled prevents logging of fields tagged as sensitive (passwords, keys, tokens).
Runtime log sanitization may introduce significant computation overhead and therefore should not be enabled in production.`)
}
// Apply set klog logger from LogFormat type
@ -95,6 +99,9 @@ func (o *Options) Apply() {
// if log format not exists, use nil loggr
loggr, _ := o.Get()
klog.SetLogger(loggr)
if o.LogSanitization {
klog.SetLogFilter(&sanitization.SanitizingFilter{})
}
}
// Get logger with LogFormat field