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:
1
Gopkg.lock
generated
1
Gopkg.lock
generated
@@ -1397,6 +1397,7 @@
|
||||
"k8s.io/client-go/tools/remotecommand",
|
||||
"k8s.io/client-go/tools/watch",
|
||||
"k8s.io/client-go/util/workqueue",
|
||||
"k8s.io/klog",
|
||||
"k8s.io/kubernetes/pkg/api/v1/pod",
|
||||
"k8s.io/kubernetes/pkg/apis/core",
|
||||
"k8s.io/kubernetes/pkg/apis/core/pods",
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user