APIServer: Use options pattern in standalone mode (#82760)

use options
This commit is contained in:
Ryan McKinley
2024-02-15 12:00:20 -08:00
committed by GitHub
parent ba63e62311
commit c879588332
4 changed files with 23 additions and 5 deletions
+1 -1
View File
@@ -62,7 +62,7 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{}
}
cmd.Flags().StringVar(&runtimeConfig, "runtime-config", "", "A set of key=value pairs that enable or disable built-in APIs.")
o.factory.InitFlags(cmd.Flags())
o.factory.GetOptions().AddFlags(cmd.Flags())
// Register standard k8s flags with the command line
o.RecommendedOptions = options.NewRecommendedOptions(
+2
View File
@@ -110,6 +110,7 @@ func (o *APIServerOptions) ModifiedApplyTo(config *genericapiserver.RecommendedC
if err != nil {
return err
}
return nil
}
@@ -160,6 +161,7 @@ func (o *APIServerOptions) Config() (*genericapiserver.RecommendedConfig, error)
func (o *APIServerOptions) Validate(args []string) error {
errors := []error{}
errors = append(errors, o.RecommendedOptions.Validate()...)
errors = append(errors, o.factory.GetOptions().ValidateOptions()...)
return utilerrors.NewAggregate(errors)
}