Skip to content

Commit 76dcedb

Browse files
committed
UPSTREAM: <carry>: introduce delay in the post-start hooks
1 parent b4a19c4 commit 76dcedb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

pkg/controlplane/apiserver/server.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,15 @@ func (c completedConfig) New(name string, delegationTarget genericapiserver.Dele
320320
s.GenericAPIServer.AddPostStartHookOrDie("storage-readiness", s.GenericAPIServer.StorageReadinessHook.Hook)
321321
}
322322

323+
// Simulate an additional readiness delay like we have on 1.36 (where WatchCacheInitializationPostStartHook defaults to true).
324+
s.GenericAPIServer.AddPostStartHookOrDie("prove-pre-ready-window", func(hookContext genericapiserver.PostStartHookContext) error {
325+
select {
326+
case <-time.After(15 * time.Second):
327+
case <-hookContext.Done():
328+
}
329+
return nil
330+
})
331+
323332
s.GenericAPIServer.AddPostStartHookOrDie("start-legacy-token-tracking-controller", func(hookContext genericapiserver.PostStartHookContext) error {
324333
go legacytokentracking.NewController(client).RunWithContext(hookContext)
325334
return nil

0 commit comments

Comments
 (0)