Skip to content

Commit 62b6dfb

Browse files
mjudeikisk8s-publishing-bot
authored andcommitted
clean ctx
Kubernetes-commit: b8ae868a73459c2fa6619bf10980a67fa2a2505b
1 parent bf8152a commit 62b6dfb

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

pkg/apiserver/apiserver.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -297,25 +297,14 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
297297
}
298298
// We are passing the context to ProxyCerts.RunOnce as it needs to implement RunOnce(ctx) however the
299299
// context is not used at all. So passing a empty context shouldn't be a problem
300-
ctx := context.TODO()
301-
if err := aggregatorProxyCerts.RunOnce(ctx); err != nil {
300+
if err := aggregatorProxyCerts.RunOnce(context.Background()); err != nil {
302301
return nil, err
303302
}
304303
aggregatorProxyCerts.AddListener(apiserviceRegistrationController)
305304
s.proxyCurrentCertKeyContent = aggregatorProxyCerts.CurrentCertKeyContent
306305

307306
s.GenericAPIServer.AddPostStartHookOrDie("aggregator-reload-proxy-client-cert", func(postStartHookContext genericapiserver.PostStartHookContext) error {
308-
// generate a context from stopCh. This is to avoid modifying files which are relying on apiserver
309-
// TODO: See if we can pass ctx to the current method
310-
ctx, cancel := context.WithCancel(context.Background())
311-
go func() {
312-
select {
313-
case <-postStartHookContext.Done():
314-
cancel() // stopCh closed, so cancel our context
315-
case <-ctx.Done():
316-
}
317-
}()
318-
go aggregatorProxyCerts.Run(ctx, 1)
307+
go aggregatorProxyCerts.Run(postStartHookContext, 1)
319308
return nil
320309
})
321310
}

0 commit comments

Comments
 (0)