diff --git a/server/options.go b/server/options.go index 120ed69e2..debbcc0b5 100644 --- a/server/options.go +++ b/server/options.go @@ -6,6 +6,7 @@ import ( stringz "github.com/appscode/go/strings" v "github.com/appscode/go/version" + api "github.com/appscode/stash/apis/stash/v1alpha1" cs "github.com/appscode/stash/client/clientset/versioned" "github.com/appscode/stash/pkg/controller" "github.com/appscode/stash/pkg/docker" @@ -15,15 +16,17 @@ import ( ) type ExtraOptions struct { - EnableRBAC bool - StashImageTag string - DockerRegistry string - MaxNumRequeues int - NumThreads int - ScratchDir string - QPS float64 - Burst int - ResyncPeriod time.Duration + EnableRBAC bool + StashImageTag string + DockerRegistry string + MaxNumRequeues int + NumThreads int + ScratchDir string + QPS float64 + Burst int + ResyncPeriod time.Duration + EnableValidatingWebhook bool + EnableMutatingWebhook bool } func NewExtraOptions() *ExtraOptions { @@ -48,6 +51,11 @@ func (s *ExtraOptions) AddGoFlags(fs *flag.FlagSet) { fs.Float64Var(&s.QPS, "qps", s.QPS, "The maximum QPS to the master from this client") fs.IntVar(&s.Burst, "burst", s.Burst, "The maximum burst for throttle") fs.DurationVar(&s.ResyncPeriod, "resync-period", s.ResyncPeriod, "If non-zero, will re-list this often. Otherwise, re-list will be delayed aslong as possible (until the upstream source closes the watch or times out.") + + fs.BoolVar(&s.EnableMutatingWebhook, "enable-mutating-webhook", s.EnableMutatingWebhook, "If true, enables mutating webhooks for KubeDB CRDs.") + fs.BoolVar(&s.EnableValidatingWebhook, "enable-validating-webhook", s.EnableValidatingWebhook, "If true, enables validating webhooks for KubeDB CRDs.") + fs.BoolVar(&api.EnableStatusSubresource, "enable-status-subresource", api.EnableStatusSubresource, "If true, uses sub resource for KubeDB crds.") + } func (s *ExtraOptions) AddFlags(fs *pflag.FlagSet) { @@ -65,9 +73,10 @@ func (s *ExtraOptions) ApplyTo(cfg *controller.Config) error { cfg.MaxNumRequeues = s.MaxNumRequeues cfg.NumThreads = s.NumThreads cfg.ResyncPeriod = s.ResyncPeriod - cfg.ClientConfig.QPS = float32(s.QPS) cfg.ClientConfig.Burst = s.Burst + cfg.EnableMutatingWebhook = s.EnableMutatingWebhook + cfg.EnableValidatingWebhook = s.EnableValidatingWebhook if cfg.KubeClient, err = kubernetes.NewForConfig(cfg.ClientConfig); err != nil { return err diff --git a/server/start.go b/server/start.go index 3278e82c6..c791b92cf 100644 --- a/server/start.go +++ b/server/start.go @@ -5,6 +5,7 @@ import ( "io" "net" + "github.com/appscode/kutil/tools/clientcmd" "github.com/appscode/stash/apis/repositories/v1alpha1" "github.com/appscode/stash/pkg/controller" "github.com/appscode/stash/pkg/server" @@ -62,6 +63,9 @@ func (o StashOptions) Config() (*server.StashConfig, error) { if err := o.RecommendedOptions.ApplyTo(serverConfig, server.Scheme); err != nil { return nil, err } + // Fixes https://github.com/Azure/AKS/issues/522 + clientcmd.Fix(serverConfig.ClientConfig) + serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(v1alpha1.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(server.Scheme)) serverConfig.OpenAPIConfig.Info.Title = "stash-server" serverConfig.OpenAPIConfig.Info.Version = v1alpha1.SchemeGroupVersion.Version