Add missing webhook flags and make options pointer
Signed-off-by: JoshVanL <vleeuwenjoshua@gmail.com>
This commit is contained in:
parent
1107390b23
commit
7c831c537e
@ -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{
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user