K8s: fix nil deref from dummy factory for API Server options (#83132)

This commit is contained in:
Charandas 2024-02-20 13:00:02 -08:00 committed by GitHub
parent 16dee3cf1c
commit 0bd009fb53
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,7 +62,10 @@ 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.GetOptions().AddFlags(cmd.Flags())
if factoryOptions := o.factory.GetOptions(); factoryOptions != nil {
factoryOptions.AddFlags(cmd.Flags())
}
// Register standard k8s flags with the command line
o.RecommendedOptions = options.NewRecommendedOptions(