From aebb47e7f410e5a7ff1c6b22a54b33a9971532f3 Mon Sep 17 00:00:00 2001 From: Antoine Pelisse Date: Thu, 30 Apr 2020 14:45:06 -0700 Subject: [PATCH] Only create SSA models for CRDs with structural schema And also, the current code only understands V2, so we should use that exclusively, or we're guaranteed to have errors in the future. --- .../pkg/apiserver/customresource_handler.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go index d3eddb8c6f1..0b897f8fa42 100644 --- a/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go +++ b/staging/src/k8s.io/apiextensions-apiserver/pkg/apiserver/customresource_handler.go @@ -1320,8 +1320,7 @@ func buildOpenAPIModelsForApply(staticOpenAPISpec *goopenapispec.Swagger, crd *a specs := []*goopenapispec.Swagger{} for _, v := range crd.Spec.Versions { - // Defaults are not pruned here, but before being served. - s, err := builder.BuildSwagger(crd, v.Name, builder.Options{V2: false, StripValueValidation: true, StripNullable: true, AllowNonStructural: true}) + s, err := builder.BuildSwagger(crd, v.Name, builder.Options{V2: true, StripValueValidation: true, StripNullable: true, AllowNonStructural: false}) if err != nil { return nil, err }