diff --git a/pkg/services/apiserver/standalone/options/options.go b/pkg/services/apiserver/standalone/options/options.go index 696b4fe4956..35feedf4844 100644 --- a/pkg/services/apiserver/standalone/options/options.go +++ b/pkg/services/apiserver/standalone/options/options.go @@ -15,6 +15,7 @@ type Options struct { RecommendedOptions *genericoptions.RecommendedOptions TracingOptions *TracingOptions MetricsOptions *MetricsOptions + ServerRunOptions *genericoptions.ServerRunOptions } func New(logger log.Logger, codec runtime.Codec) *Options { @@ -24,6 +25,7 @@ func New(logger log.Logger, codec runtime.Codec) *Options { RecommendedOptions: options.NewRecommendedOptions(codec), TracingOptions: NewTracingOptions(logger), MetricsOptions: NewMetrcicsOptions(logger), + ServerRunOptions: genericoptions.NewServerRunOptions(), } } @@ -33,6 +35,7 @@ func (o *Options) AddFlags(fs *pflag.FlagSet) { o.RecommendedOptions.AddFlags(fs) o.TracingOptions.AddFlags(fs) o.MetricsOptions.AddFlags(fs) + o.ServerRunOptions.AddUniversalFlags(fs) } func (o *Options) Validate() []error { @@ -52,6 +55,10 @@ func (o *Options) Validate() []error { return errs } + if errs := o.ServerRunOptions.Validate(); len(errs) != 0 { + return errs + } + // NOTE: we don't call validate on the top level recommended options as it doesn't like skipping etcd-servers // the function is left here for troubleshooting any other config issues // errors = append(errors, o.RecommendedOptions.Validate()...) @@ -117,6 +124,10 @@ func (o *Options) ModifiedApplyTo(config *genericapiserver.RecommendedConfig) er return err } + if err := o.ServerRunOptions.ApplyTo(&config.Config); err != nil { + return err + } + return nil } @@ -155,5 +166,11 @@ func (o *Options) ApplyTo(serverConfig *genericapiserver.RecommendedConfig) erro } } + if o.ServerRunOptions != nil { + if err := o.ServerRunOptions.ApplyTo(&serverConfig.Config); err != nil { + return err + } + } + return nil }