Skip to content

Commit

Permalink
feat(mgr) load klog flags into Cobra flags
Browse files Browse the repository at this point in the history
  • Loading branch information
rainest committed May 18, 2021
1 parent ba0e0d1 commit 852a8f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions railgun/manager/config.go
@@ -1,13 +1,15 @@
package manager

import (
goflag "flag"
"fmt"

"github.com/kong/kubernetes-ingress-controller/pkg/adminapi"
"github.com/kong/kubernetes-ingress-controller/pkg/annotations"
"github.com/kong/kubernetes-ingress-controller/pkg/util"
"github.com/spf13/pflag"
corev1 "k8s.io/api/core/v1"
"k8s.io/klog"
)

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -80,6 +82,11 @@ func (c *Config) FlagSet() *pflag.FlagSet {

flagSet := flagSet{*pflag.NewFlagSet("", pflag.ExitOnError)}

// Add Go flags for klog
klog.InitFlags(nil)
goflag.Parse()
flagSet.AddGoFlagSet(goflag.CommandLine)

// Logging configurations
flagSet.StringVar(&c.LogLevel, "log-level", "info", `Level of logging for the controller. Allowed values are trace, debug, info, warn, error, fatal and panic.`)
flagSet.StringVar(&c.LogFormat, "log-format", "text", `Format of logs of the controller. Allowed values are text and json.`)
Expand Down

0 comments on commit 852a8f5

Please sign in to comment.