diff --git a/cmd/hepto/config.go b/cmd/hepto/config.go index 9676792450cb22971362c407f9548f0541b611af..6bbaf080a08ee35e30bed38f0cae98331a98aecf 100644 --- a/cmd/hepto/config.go +++ b/cmd/hepto/config.go @@ -29,7 +29,8 @@ type Config struct { var config Config func (c *Config) Complete() error { - // Print version if requested + // Print version if requested, verflag flags are declared + // by init() functions deep in k8s code verflag.PrintAndExitIfRequested() // Mount a shell if required if c.Shell != "" { @@ -70,10 +71,8 @@ func (c *Config) Complete() error { } func init() { - verflag.AddFlags(Hepto.Flags()) // Expose k8s version directly - // Force-reinit pflag global cli object, because k8s has a nasty habit of - // globally registering flags in init() - pflag.CommandLine = pflag.NewFlagSet("hepto", pflag.ExitOnError) + // Hide unwanted flags declared inside k8s init() directly + pflag.CommandLine.MarkHidden("azure-container-registry-config") cobra.OnInitialize(viper.AutomaticEnv) // General config