From d649858bc571ae65d4016be6ba7bb9b1e2acf928 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Mon, 11 Feb 2019 14:03:41 -0500 Subject: [PATCH] fix(openapi): add InstallMode definition Had to add openapi-gen tag in clusterserviceversion_types.go and adjusted Makefile to pick it up. --- Makefile | 2 +- .../v1alpha1/clusterserviceversion_types.go | 1 + .../apis/openapi/zz_generated.openapi.go | 27 +++++++++++++++++++ .../v1alpha1/packagemanifest_types.go | 4 +-- 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9be5c0d9bd..6b01634b0a 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ codegen: cp scripts/generate_groups.sh vendor/k8s.io/code-generator/generate_groups.sh mkdir -p vendor/k8s.io/code-generator/hack cp boilerplate.go.txt vendor/k8s.io/code-generator/hack/boilerplate.go.txt - go run vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go --logtostderr -i ./vendor/k8s.io/apimachinery/pkg/runtime,./vendor/k8s.io/apimachinery/pkg/apis/meta/v1,./vendor/k8s.io/apimachinery/pkg/version,./pkg/package-server/apis/packagemanifest/v1alpha1 -p $(PKG)/pkg/package-server/apis/openapi -O zz_generated.openapi -h boilerplate.go.txt -r /dev/null + go run vendor/k8s.io/kube-openapi/cmd/openapi-gen/openapi-gen.go --logtostderr -i ./vendor/k8s.io/apimachinery/pkg/runtime,./vendor/k8s.io/apimachinery/pkg/apis/meta/v1,./vendor/k8s.io/apimachinery/pkg/version,./pkg/package-server/apis/packagemanifest/v1alpha1,./pkg/api/apis/operators/v1alpha1 -p $(PKG)/pkg/package-server/apis/openapi -O zz_generated.openapi -h boilerplate.go.txt -r /dev/null $(CODEGEN) all $(PKG)/pkg/api/client $(PKG)/pkg/api/apis "operators:v1alpha1,v1alpha2" $(CODEGEN) all $(PKG)/pkg/package-server/client $(PKG)/pkg/package-server/apis "packagemanifest:v1alpha1" diff --git a/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go b/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go index 7e3e8f72c1..cc0302aa07 100644 --- a/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go +++ b/pkg/api/apis/operators/v1alpha1/clusterserviceversion_types.go @@ -30,6 +30,7 @@ const ( ) // InstallMode associates an InstallModeType with a flag representing if the CSV supports it +// +k8s:openapi-gen=true type InstallMode struct { Type InstallModeType `json:"type"` Supported bool `json:"supported"` diff --git a/pkg/package-server/apis/openapi/zz_generated.openapi.go b/pkg/package-server/apis/openapi/zz_generated.openapi.go index 105d35ef47..23d757805b 100644 --- a/pkg/package-server/apis/openapi/zz_generated.openapi.go +++ b/pkg/package-server/apis/openapi/zz_generated.openapi.go @@ -30,6 +30,7 @@ import ( func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenAPIDefinition { return map[string]common.OpenAPIDefinition{ + "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1.InstallMode": schema_api_apis_operators_v1alpha1_InstallMode(ref), "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.AppLink": schema_package_server_apis_packagemanifest_v1alpha1_AppLink(ref), "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.CSVDescription": schema_package_server_apis_packagemanifest_v1alpha1_CSVDescription(ref), "github.com/operator-framework/operator-lifecycle-manager/pkg/package-server/apis/packagemanifest/v1alpha1.Icon": schema_package_server_apis_packagemanifest_v1alpha1_Icon(ref), @@ -82,6 +83,32 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA } } +func schema_api_apis_operators_v1alpha1_InstallMode(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "InstallMode associates an InstallModeType with a flag representing if the CSV supports it", + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "supported": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + Required: []string{"type", "supported"}, + }, + }, + Dependencies: []string{}, + } +} + func schema_package_server_apis_packagemanifest_v1alpha1_AppLink(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go b/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go index 9fcfdcffa8..a52c18e409 100644 --- a/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go +++ b/pkg/package-server/apis/packagemanifest/v1alpha1/packagemanifest_types.go @@ -2,7 +2,7 @@ package v1alpha1 import ( "github.com/coreos/go-semver/semver" - "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" + operatorv1alpha1 "github.com/operator-framework/operator-lifecycle-manager/pkg/api/apis/operators/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -101,7 +101,7 @@ type CSVDescription struct { LongDescription string `json:"description,omitempty"` // InstallModes specify supported installation types - InstallModes []v1alpha1.InstallMode `json:"installModes,omitempty"` + InstallModes []operatorv1alpha1.InstallMode `json:"installModes,omitempty"` } // AppLink defines a link to an application