diff --git a/pkg/kudoctl/cmd/init/crds.go b/pkg/kudoctl/cmd/init/crds.go index a4141a296..9f10c85c0 100644 --- a/pkg/kudoctl/cmd/init/crds.go +++ b/pkg/kudoctl/cmd/init/crds.go @@ -93,7 +93,7 @@ func generateOperator() *apiextv1beta1.CustomResourceDefinition { "description": apiextv1beta1.JSONSchemaProps{Type: "string"}, "kubernetesVersion": apiextv1beta1.JSONSchemaProps{Type: "string"}, "kudoVersion": apiextv1beta1.JSONSchemaProps{Type: "string"}, - "maintainers": apiextv1beta1.JSONSchemaProps{ + "maintainers": apiextv1beta1.JSONSchemaProps{Type: "object", Items: &apiextv1beta1.JSONSchemaPropsOrArray{Schema: &apiextv1beta1.JSONSchemaProps{ Type: "object", Properties: maintainers, @@ -109,9 +109,8 @@ func generateOperator() *apiextv1beta1.CustomResourceDefinition { "spec": apiextv1beta1.JSONSchemaProps{Properties: specProps, Type: "object"}, "status": apiextv1beta1.JSONSchemaProps{Type: "object"}, } - crd.Spec.Validation = &apiextv1beta1.CustomResourceValidation{ - OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{ + OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{Type: "object", Properties: validationProps, }, } @@ -180,7 +179,7 @@ func generateOperatorVersion() *apiextv1beta1.CustomResourceDefinition { } crd.Spec.Validation = &apiextv1beta1.CustomResourceValidation{ - OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{ + OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{Type: "object", Properties: validationProps, }, } @@ -233,7 +232,7 @@ func generateInstance() *apiextv1beta1.CustomResourceDefinition { } crd.Spec.Validation = &apiextv1beta1.CustomResourceValidation{ - OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{ + OpenAPIV3Schema: &apiextv1beta1.JSONSchemaProps{Type: "object", Properties: validationProps, }, } @@ -267,6 +266,10 @@ func generateCrd(kind string, plural string) *apiextv1beta1.CustomResourceDefini StoredVersions: []string{}, }, } + // below is needed if we support 1.15 CRD in v1beta1, it is deprecated within the 1.15 + // for 1.16 it is removed and functions as if preserve == false + // preserveFields := false + // crd.Spec.PreserveUnknownFields = &preserveFields return crd }