Skip to content

Commit

Permalink
fix: operator/flags remove viper.BindPFlags
Browse files Browse the repository at this point in the history
viper.BindPFlags has a ISSUE spf13/viper#233
replace all viper.BindPFlags

Signed-off-by: Jack-R-lantern <tjdfkr2421@gmail.com>
  • Loading branch information
Jack-R-lantern committed Jul 11, 2023
1 parent 508fa8f commit a5d84ad
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions operator/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ import (
"github.com/spf13/viper"
)

var (
CmdRef string
SkipCRDCreation bool
KubeCfgPath string
)

func init() {
initializeFlags()
}
Expand All @@ -37,14 +43,12 @@ func initializeFlags() {

flags := rootCmd.Flags()

flags.String(operatorOption.CMDRef, "", "Path to cmdref output directory")
flags.StringVarP(&CmdRef, operatorOption.CMDRef, "", "", "Path to cmdref output directory")
flags.MarkHidden(operatorOption.CMDRef)

flags.Bool(operatorOption.SkipCRDCreation, false, "When true, Kubernetes Custom Resource Definitions (CRDs) will not be created")

flags.String(operatorOption.KubeCfgPath, "", "Kubeconfig filepath to connect to k8s")
flags.BoolVarP(&SkipCRDCreation, operatorOption.SkipCRDCreation, "", false, "When true, Kubernetes Custom Resource Definitions (CRDs) will not be created")

viper.BindPFlags(flags)
flags.StringVarP(&KubeCfgPath, operatorOption.KubeCfgPath, "", "", "Kubeconfig filepath to connect to k8s")
}

// Populate sets all options with the values from viper.
Expand Down

0 comments on commit a5d84ad

Please sign in to comment.