diff --git a/cmd/acmesolver/app/app.go b/cmd/acmesolver/app/app.go index f2e6856d1..9a5dda0c2 100644 --- a/cmd/acmesolver/app/app.go +++ b/cmd/acmesolver/app/app.go @@ -32,7 +32,7 @@ func NewACMESolverCommand(ctx context.Context) *cobra.Command { ) cmd := &cobra.Command{ - Use: "acme-solver", + Use: "cert-manager-acme-solver", Short: "HTTP server used to solver ACME challenges.", RunE: func(cmd *cobra.Command, args []string) error { s := &solver.HTTP01Solver{ diff --git a/cmd/webhook/app/options/options.go b/cmd/webhook/app/options/options.go index 487396e0a..b72a4ac85 100644 --- a/cmd/webhook/app/options/options.go +++ b/cmd/webhook/app/options/options.go @@ -79,14 +79,14 @@ func (o *WebhookOptions) AddFlags(fs *pflag.FlagSet) { "Possible values: "+strings.Join(tlsPossibleVersions, ", ")) } -func FileTLSSourceEnabled(o WebhookOptions) bool { +func FileTLSSourceEnabled(o *WebhookOptions) bool { if o.TLSCertFile != "" || o.TLSKeyFile != "" { return true } return false } -func DynamicTLSSourceEnabled(o WebhookOptions) bool { +func DynamicTLSSourceEnabled(o *WebhookOptions) bool { if o.DynamicServingCASecretNamespace != "" || o.DynamicServingCASecretName != "" { return true } diff --git a/cmd/webhook/app/testing/testwebhook.go b/cmd/webhook/app/testing/testwebhook.go index bb6274330..ca0935938 100644 --- a/cmd/webhook/app/testing/testwebhook.go +++ b/cmd/webhook/app/testing/testwebhook.go @@ -56,7 +56,7 @@ type ServerOptions struct { func StartWebhookServer(t *testing.T, args []string) (ServerOptions, StopFunc) { // Allow user to override options using flags - opts := options.WebhookOptions{} + opts := new(options.WebhookOptions) fs := pflag.NewFlagSet("testset", pflag.ExitOnError) opts.AddFlags(fs) // Parse the arguments passed in into the WebhookOptions struct diff --git a/cmd/webhook/app/webhook.go b/cmd/webhook/app/webhook.go index 5ff72690b..e0e3eeca8 100644 --- a/cmd/webhook/app/webhook.go +++ b/cmd/webhook/app/webhook.go @@ -18,7 +18,6 @@ package app import ( "context" - "flag" "fmt" "github.com/spf13/cobra" @@ -39,7 +38,7 @@ var validationHook handlers.ValidatingAdmissionHook = handlers.NewRegistryBacked var mutationHook handlers.MutatingAdmissionHook = handlers.NewSchemeBackedDefaulter(logs.Log, webhook.Scheme) var conversionHook handlers.ConversionHook = handlers.NewSchemeBackedConverter(logs.Log, webhook.Scheme) -func NewServer(opts options.WebhookOptions, stopCh <-chan struct{}) (*server.Server, error) { +func NewServer(opts *options.WebhookOptions, stopCh <-chan struct{}) (*server.Server, error) { rootCtx := util.ContextWithStopCh(context.Background(), stopCh) rootCtx = logf.NewContext(rootCtx, nil, "webhook") log := logf.FromContext(rootCtx) @@ -89,7 +88,7 @@ func NewServer(opts options.WebhookOptions, stopCh <-chan struct{}) (*server.Ser } func NewServerCommand(stopCh <-chan struct{}) *cobra.Command { - opts := options.WebhookOptions{} + opts := new(options.WebhookOptions) cmd := &cobra.Command{ Use: "cert-manager-webhook", @@ -104,7 +103,7 @@ func NewServerCommand(stopCh <-chan struct{}) *cobra.Command { }, } - cmd.Flags().AddGoFlagSet(flag.CommandLine) + opts.AddFlags(cmd.Flags()) return cmd }