mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
apiextensions: fix panix with KUBE_API_VERSIONS set
This commit is contained in:
parent
2bd0b3dd26
commit
39316dfe9c
@ -178,6 +178,11 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
|
|||||||
s.GenericAPIServer.Handler.NonGoRestfulMux.Handle("/apis", crdHandler)
|
s.GenericAPIServer.Handler.NonGoRestfulMux.Handle("/apis", crdHandler)
|
||||||
s.GenericAPIServer.Handler.NonGoRestfulMux.HandlePrefix("/apis/", crdHandler)
|
s.GenericAPIServer.Handler.NonGoRestfulMux.HandlePrefix("/apis/", crdHandler)
|
||||||
|
|
||||||
|
// this only happens when KUBE_API_VERSIONS is set. We must return without adding controllers or poststarthooks which would affect healthz
|
||||||
|
if crdClient == nil {
|
||||||
|
return s, nil
|
||||||
|
}
|
||||||
|
|
||||||
crdController := NewDiscoveryController(s.Informers.Apiextensions().InternalVersion().CustomResourceDefinitions(), versionDiscoveryHandler, groupDiscoveryHandler, c.GenericConfig.RequestContextMapper)
|
crdController := NewDiscoveryController(s.Informers.Apiextensions().InternalVersion().CustomResourceDefinitions(), versionDiscoveryHandler, groupDiscoveryHandler, c.GenericConfig.RequestContextMapper)
|
||||||
namingController := status.NewNamingConditionController(s.Informers.Apiextensions().InternalVersion().CustomResourceDefinitions(), crdClient)
|
namingController := status.NewNamingConditionController(s.Informers.Apiextensions().InternalVersion().CustomResourceDefinitions(), crdClient)
|
||||||
finalizingController := finalizer.NewCRDFinalizer(
|
finalizingController := finalizer.NewCRDFinalizer(
|
||||||
@ -186,11 +191,6 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
|
|||||||
crdHandler,
|
crdHandler,
|
||||||
)
|
)
|
||||||
|
|
||||||
// this only happens when KUBE_API_VERSIONS is set. We must return without adding poststarthooks which would affect healthz
|
|
||||||
if crdClient == nil {
|
|
||||||
return s, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
s.GenericAPIServer.AddPostStartHook("start-apiextensions-informers", func(context genericapiserver.PostStartHookContext) error {
|
s.GenericAPIServer.AddPostStartHook("start-apiextensions-informers", func(context genericapiserver.PostStartHookContext) error {
|
||||||
s.Informers.Start(context.StopCh)
|
s.Informers.Start(context.StopCh)
|
||||||
return nil
|
return nil
|
||||||
|
Loading…
Reference in New Issue
Block a user