aboutsummaryrefslogtreecommitdiff
path: root/plugin/kubernetes/setup.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/kubernetes/setup.go')
-rw-r--r--plugin/kubernetes/setup.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugin/kubernetes/setup.go b/plugin/kubernetes/setup.go
index faf0f8ca3..ae32a904e 100644
--- a/plugin/kubernetes/setup.go
+++ b/plugin/kubernetes/setup.go
@@ -20,6 +20,9 @@ import (
"github.com/miekg/dns"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+ // Pull this in for logtostderr flag parsing
+ "k8s.io/klog"
+
// Excluding azure because it is failing to compile
// pull this in here, because we want it excluded if plugin.cfg doesn't have k8s
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
@@ -33,12 +36,15 @@ import (
var log = clog.NewWithPlugin("kubernetes")
func init() {
- // Kubernetes plugin uses the kubernetes library, which uses glog (ugh), we must set this *flag*,
+ // Kubernetes plugin uses the kubernetes library, which now uses klog, we must set and parse this flag
// so we don't log to the filesystem, which can fill up and crash CoreDNS indirectly by calling os.Exit().
// We also set: os.Stderr = os.Stdout in the setup function below so we output to standard out; as we do for
// all CoreDNS logging. We can't do *that* in the init function, because we, when starting, also barf some
// things to stderr.
- flag.Set("logtostderr", "true")
+ klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
+ klog.InitFlags(klogFlags)
+ logtostderr := klogFlags.Lookup("logtostderr")
+ logtostderr.Value.Set("true")
caddy.RegisterPlugin("kubernetes", caddy.Plugin{
ServerType: "dns",