mirror of https://github.com/k3s-io/k3s
apiextensions: don't run openapi controller if genericapiserver disables
openapik3s-v1.15.3
parent
eb35525d4a
commit
979368ac7d
|
@ -212,7 +212,11 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
|
|||
return nil
|
||||
})
|
||||
s.GenericAPIServer.AddPostStartHookOrDie("start-apiextensions-controllers", func(context genericapiserver.PostStartHookContext) error {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(apiextensionsfeatures.CustomResourcePublishOpenAPI) {
|
||||
// OpenAPIVersionedService and StaticOpenAPISpec are populated in generic apiserver PrepareRun().
|
||||
// Together they serve the /openapi/v2 endpoint on a generic apiserver. A generic apiserver may
|
||||
// choose to not enable OpenAPI by having null openAPIConfig, and thus OpenAPIVersionedService
|
||||
// and StaticOpenAPISpec are both null. In that case we don't run the CRD OpenAPI controller.
|
||||
if utilfeature.DefaultFeatureGate.Enabled(apiextensionsfeatures.CustomResourcePublishOpenAPI) && s.GenericAPIServer.OpenAPIVersionedService != nil && s.GenericAPIServer.StaticOpenAPISpec != nil {
|
||||
go openapiController.Run(s.GenericAPIServer.StaticOpenAPISpec, s.GenericAPIServer.OpenAPIVersionedService, context.StopCh)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue