From 21326e493a0b898ca4a6e67571f2baf07d32a011 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Sat, 6 Jan 2024 04:10:49 -0800 Subject: [PATCH] Configure openapi v3 Signed-off-by: Tamal Saha --- pkg/cmds/server/start.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/cmds/server/start.go b/pkg/cmds/server/start.go index 0003f6160..5e34dbc2e 100644 --- a/pkg/cmds/server/start.go +++ b/pkg/cmds/server/start.go @@ -94,10 +94,7 @@ func (o StashOptions) Config() (*server.StashConfig, error) { // Fixes https://github.com/Azure/AKS/issues/522 clientcmd.Fix(serverConfig.ClientConfig) - serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(v1alpha1.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(server.Scheme)) - serverConfig.OpenAPIConfig.Info.Title = "stash-operator" - serverConfig.OpenAPIConfig.Info.Version = v1alpha1.SchemeGroupVersion.Version - serverConfig.OpenAPIConfig.IgnorePrefixes = []string{ + ignorePrefixes := []string{ "/swaggerapi", "/apis/admission.stash.appscode.com/v1alpha1", "/apis/admission.stash.appscode.com/v1alpha1/resticvalidators", @@ -112,6 +109,16 @@ func (o StashOptions) Config() (*server.StashConfig, error) { "/apis/admission.stash.appscode.com/v1beta1/backupconfigurationvalidators", } + serverConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(v1alpha1.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(server.Scheme)) + serverConfig.OpenAPIConfig.Info.Title = "stash-webhook-server" + serverConfig.OpenAPIConfig.Info.Version = v1alpha1.SchemeGroupVersion.Version + serverConfig.OpenAPIConfig.IgnorePrefixes = ignorePrefixes + + serverConfig.OpenAPIV3Config = genericapiserver.DefaultOpenAPIV3Config(v1alpha1.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(server.Scheme)) + serverConfig.OpenAPIV3Config.Info.Title = "stash-webhook-server" + serverConfig.OpenAPIV3Config.Info.Version = v1alpha1.SchemeGroupVersion.Version + serverConfig.OpenAPIV3Config.IgnorePrefixes = ignorePrefixes + extraConfig := controller.NewConfig(serverConfig.ClientConfig) if err := o.ExtraOptions.ApplyTo(extraConfig); err != nil { return nil, err