K8s: use contexthandler in standalone handler chain (#90102)

This commit is contained in:
Charandas
2024-07-08 12:22:10 -07:00
committed by GitHub
parent 3b6a8775bb
commit c210617735
21 changed files with 203 additions and 88 deletions

View File

@@ -74,15 +74,15 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{}
return err
}
config, err := o.Config()
if err != nil {
return err
}
if o.Options.TracingOptions.TracingService != nil {
tracer.InitTracer(o.Options.TracingOptions.TracingService)
}
config, err := o.Config(tracer)
if err != nil {
return err
}
defer o.factory.Shutdown()
if err := o.RunAPIServer(config, stopCh); err != nil {

View File

@@ -76,7 +76,7 @@ func (o *APIServerOptions) loadAPIGroupBuilders(ctx context.Context, tracer trac
return nil
}
func (o *APIServerOptions) Config() (*genericapiserver.RecommendedConfig, error) {
func (o *APIServerOptions) Config(tracer tracing.Tracer) (*genericapiserver.RecommendedConfig, error) {
if err := o.Options.RecommendedOptions.SecureServing.MaybeDefaultWithSelfSignedCerts(
"localhost", o.AlternateDNS, []net.IP{netutils.ParseIPSloppy("127.0.0.1")},
); err != nil {
@@ -122,6 +122,7 @@ func (o *APIServerOptions) Config() (*genericapiserver.RecommendedConfig, error)
setting.BuildVersion,
setting.BuildCommit,
setting.BuildBranch,
o.factory.GetOptionalMiddlewares(tracer)...,
)
return serverConfig, err
}