API server: Add shutdown func to interface (#88827)

add shutdown func to interface
This commit is contained in:
Will Browne
2024-06-06 15:18:54 +01:00
committed by GitHub
parent 0e62c200dd
commit 7d8722b561
3 changed files with 16 additions and 0 deletions
+2
View File
@@ -80,6 +80,8 @@ func newCommandStartExampleAPIServer(o *APIServerOptions, stopCh <-chan struct{}
tracer.InitTracer(o.Options.TracingOptions.TracingService)
}
defer o.factory.Shutdown()
if err := o.RunAPIServer(config, stopCh); err != nil {
return err
}
@@ -36,6 +36,8 @@ type APIServerFactory interface {
// Make an API server for a given group+version
MakeAPIServer(ctx context.Context, tracer tracing.Tracer, gv schema.GroupVersion) (builder.APIGroupBuilder, error)
Shutdown()
}
// Zero dependency provider for testing
@@ -114,6 +116,8 @@ func (p *DummyAPIFactory) MakeAPIServer(_ context.Context, tracer tracing.Tracer
return nil, fmt.Errorf("unsupported group")
}
func (p *DummyAPIFactory) Shutdown() {}
// Simple stub for standalone datasource testing
type pluginDatasourceImpl struct {
startup v1.Time