File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import (
37
37
"k8s.io/apimachinery/pkg/runtime"
38
38
"k8s.io/apimachinery/pkg/runtime/schema"
39
39
"k8s.io/apimachinery/pkg/runtime/serializer"
40
+ "k8s.io/apimachinery/pkg/util/wait"
40
41
"k8s.io/apimachinery/pkg/version"
41
42
"k8s.io/apiserver/pkg/endpoints/discovery"
42
43
genericregistry "k8s.io/apiserver/pkg/registry/generic"
@@ -209,6 +210,14 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
209
210
go finalizingController .Run (5 , context .StopCh )
210
211
return nil
211
212
})
213
+ // we don't want to report healthy until we can handle all CRDs that have already been registered. Waiting for the informer
214
+ // to sync makes sure that the lister will be valid before we begin. There may still be races for CRDs added after startup,
215
+ // but we won't go healthy until we can handle the ones already present.
216
+ s .GenericAPIServer .AddPostStartHookOrDie ("crd-informer-synced" , func (context genericapiserver.PostStartHookContext ) error {
217
+ return wait .PollImmediateUntil (100 * time .Millisecond , func () (bool , error ) {
218
+ return s .Informers .Apiextensions ().InternalVersion ().CustomResourceDefinitions ().Informer ().HasSynced (), nil
219
+ }, context .StopCh )
220
+ })
212
221
213
222
return s , nil
214
223
}
You can’t perform that action at this time.
0 commit comments