Skip to content

Commit

Permalink
Configure openapi v3 (#1551)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Jan 6, 2024
1 parent 2b252fa commit 86fb04f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions pkg/cmds/server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit 86fb04f

Please sign in to comment.