Add the ability to configure klog from VK (#595)

All of Kubernetes logging is based on klog. Klog currently does
not output any logging information to logrus, so you're flying
somewhat blind to Kubernetes internals.

This exposes the full set of configurables that klog offers,
but decorates (prefixes) the klog configuration with "klog".
This commit is contained in:
Sargun Dhillon
2019-05-08 03:37:04 -07:00
committed by Pires
parent 8eb6a5bcc5
commit 2497028659

View File

@@ -15,6 +15,7 @@
package root
import (
"flag"
"fmt"
"os"
"strings"
@@ -22,6 +23,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/pflag"
"github.com/virtual-kubelet/virtual-kubelet/trace/opencensus"
"k8s.io/klog"
)
type mapVar map[string]string
@@ -79,6 +81,13 @@ func installFlags(flags *pflag.FlagSet, c *Opts) {
flags.DurationVar(&c.InformerResyncPeriod, "full-resync-period", c.InformerResyncPeriod, "how often to perform a full resync of pods between kubernetes and the provider")
flags.DurationVar(&c.StartupTimeout, "startup-timeout", c.StartupTimeout, "How long to wait for the virtual-kubelet to start")
flagset := flag.NewFlagSet("klog", flag.PanicOnError)
klog.InitFlags(flagset)
flagset.VisitAll(func(f *flag.Flag) {
f.Name = "klog." + f.Name
flags.AddGoFlag(f)
})
}
func getEnv(key, defaultValue string) string {