Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
fix flag include problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 30, 2018
1 parent a63dc48 commit aa0f99d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions cmd/controller-manager/app/controller-manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
extv1b1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
utilfeature "k8s.io/apiserver/pkg/util/feature"
utilflag "k8s.io/apiserver/pkg/util/flag"
"k8s.io/apiserver/pkg/util/logs"

"github.com/kubernetes-sigs/federation-v2/cmd/controller-manager/app/options"
Expand Down Expand Up @@ -58,7 +59,6 @@ member clusters and does the necessary reconciliation`,
if verFlag {
os.Exit(0)
}
PrintFlags(cmd.Flags())

if err := Run(opts); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
Expand All @@ -67,8 +67,11 @@ member clusters and does the necessary reconciliation`,
},
}

opts.AddFlags(cmd.Flags())
cmd.Flags().BoolVar(&verFlag, "version", false, "Prints the Version info of controller-manager")
opts.AddFlags(pflag.CommandLine)
pflag.CommandLine.BoolVar(&verFlag, "version", false, "Prints the Version info of controller-manager")

// parse the command line flags into the respective objects
utilflag.InitFlags()

return cmd
}
Expand Down Expand Up @@ -142,10 +145,3 @@ type InstallStrategy struct {
func (s *InstallStrategy) GetCRDs() []*extv1b1.CustomResourceDefinition {
return s.crds
}

// PrintFlags logs the flags in the flagset
func PrintFlags(flags *pflag.FlagSet) {
flags.VisitAll(func(flag *pflag.Flag) {
glog.V(1).Infof("FLAG: --%s=%q", flag.Name, flag.Value)
})
}

0 comments on commit aa0f99d

Please sign in to comment.