diff --git a/kyaml/openapi/README.md b/kyaml/openapi/README.md index 52e053a842..0ac38523cf 100644 --- a/kyaml/openapi/README.md +++ b/kyaml/openapi/README.md @@ -31,6 +31,12 @@ You may need to update the version of Kind these scripts use by changing `KIND_V In this directory, fetch the openapi schema, generate the corresponding swagger.go for the kubernetes api, and update `kubernetesapi/openapiinfo.go`: +``` +make all +``` + +You can run the steps individually with the following commands: + ``` make kustomizationapi/swagger.go make kubernetesapi/swagger.go diff --git a/kyaml/openapi/openapi.go b/kyaml/openapi/openapi.go index 8c6422b18e..7621499c15 100644 --- a/kyaml/openapi/openapi.go +++ b/kyaml/openapi/openapi.go @@ -573,13 +573,12 @@ func SetSchema(openAPIField map[string]string, schema []byte, reset bool) error // use builtin version kubernetesOpenAPIVersion = version - if version == "" { - version = kubernetesapi.DefaultOpenAPI + if kubernetesOpenAPIVersion != "" { + if _, ok := kubernetesapi.OpenAPIMustAsset[kubernetesOpenAPIVersion]; !ok { + return fmt.Errorf("the specified OpenAPI version is not built in") + } } - if _, ok := kubernetesapi.OpenAPIMustAsset[version]; !ok { - return fmt.Errorf("the specified OpenAPI version is not built in") - } customSchema = nil // if the schema is changed, initSchema should parse the new schema globalSchema.schemaInit = false