add goflag to parse glog flags

This commit is contained in:
chenguoyan01 2017-09-15 23:27:39 +08:00
parent d316c013fa
commit 5483d5ef1f
1 changed files with 2 additions and 5 deletions

View File

@ -126,13 +126,10 @@ type options struct {
}
func main() {
// configure glog
flag.CommandLine.Parse([]string{})
flag.Lookup("logtostderr").Value.Set("true")
options := &options{collectors: make(collectorSet)}
flags := pflag.NewFlagSet("", pflag.ExitOnError)
// add glog flags
flags.AddGoFlagSet(flag.CommandLine)
flags.BoolVar(&options.inCluster, "in-cluster", true, `If true, use the built in kubernetes cluster for creating the client`)
flags.StringVar(&options.apiserver, "apiserver", "", `The URL of the apiserver to use as a master`)
flags.StringVar(&options.kubeconfig, "kubeconfig", "", "Absolute path to the kubeconfig file")