mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
clean ctx
This commit is contained in:
parent
24ecb20e41
commit
b8ae868a73
@ -291,25 +291,14 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
|
|||||||
}
|
}
|
||||||
// We are passing the context to ProxyCerts.RunOnce as it needs to implement RunOnce(ctx) however the
|
// We are passing the context to ProxyCerts.RunOnce as it needs to implement RunOnce(ctx) however the
|
||||||
// context is not used at all. So passing a empty context shouldn't be a problem
|
// context is not used at all. So passing a empty context shouldn't be a problem
|
||||||
ctx := context.TODO()
|
if err := aggregatorProxyCerts.RunOnce(context.Background()); err != nil {
|
||||||
if err := aggregatorProxyCerts.RunOnce(ctx); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
aggregatorProxyCerts.AddListener(apiserviceRegistrationController)
|
aggregatorProxyCerts.AddListener(apiserviceRegistrationController)
|
||||||
s.proxyCurrentCertKeyContent = aggregatorProxyCerts.CurrentCertKeyContent
|
s.proxyCurrentCertKeyContent = aggregatorProxyCerts.CurrentCertKeyContent
|
||||||
|
|
||||||
s.GenericAPIServer.AddPostStartHookOrDie("aggregator-reload-proxy-client-cert", func(postStartHookContext genericapiserver.PostStartHookContext) error {
|
s.GenericAPIServer.AddPostStartHookOrDie("aggregator-reload-proxy-client-cert", func(postStartHookContext genericapiserver.PostStartHookContext) error {
|
||||||
// generate a context from stopCh. This is to avoid modifying files which are relying on apiserver
|
go aggregatorProxyCerts.Run(postStartHookContext, 1)
|
||||||
// TODO: See if we can pass ctx to the current method
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
|
||||||
go func() {
|
|
||||||
select {
|
|
||||||
case <-postStartHookContext.Done():
|
|
||||||
cancel() // stopCh closed, so cancel our context
|
|
||||||
case <-ctx.Done():
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
go aggregatorProxyCerts.Run(ctx, 1)
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user