Skip to content

Commit b8ae868

Browse files
committed
clean ctx
1 parent 24ecb20 commit b8ae868

File tree

1 file changed

+2
-13
lines changed
  • staging/src/k8s.io/kube-aggregator/pkg/apiserver

1 file changed

+2
-13
lines changed

staging/src/k8s.io/kube-aggregator/pkg/apiserver/apiserver.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -291,25 +291,14 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
291291
}
292292
// We are passing the context to ProxyCerts.RunOnce as it needs to implement RunOnce(ctx) however the
293293
// context is not used at all. So passing a empty context shouldn't be a problem
294-
ctx := context.TODO()
295-
if err := aggregatorProxyCerts.RunOnce(ctx); err != nil {
294+
if err := aggregatorProxyCerts.RunOnce(context.Background()); err != nil {
296295
return nil, err
297296
}
298297
aggregatorProxyCerts.AddListener(apiserviceRegistrationController)
299298
s.proxyCurrentCertKeyContent = aggregatorProxyCerts.CurrentCertKeyContent
300299

301300
s.GenericAPIServer.AddPostStartHookOrDie("aggregator-reload-proxy-client-cert", func(postStartHookContext genericapiserver.PostStartHookContext) error {
302-
// generate a context from stopCh. This is to avoid modifying files which are relying on apiserver
303-
// TODO: See if we can pass ctx to the current method
304-
ctx, cancel := context.WithCancel(context.Background())
305-
go func() {
306-
select {
307-
case <-postStartHookContext.Done():
308-
cancel() // stopCh closed, so cancel our context
309-
case <-ctx.Done():
310-
}
311-
}()
312-
go aggregatorProxyCerts.Run(ctx, 1)
301+
go aggregatorProxyCerts.Run(postStartHookContext, 1)
313302
return nil
314303
})
315304
}

0 commit comments

Comments
 (0)