diff --git a/pkg/lib/bundle/testdata/validate/valid_bundle/manifests/etcdclusters.etcd.database.coreos.com.crd.yaml b/pkg/lib/bundle/testdata/validate/valid_bundle/manifests/etcdclusters.etcd.database.coreos.com.crd.yaml index 01111e5c5..c0515b4de 100644 --- a/pkg/lib/bundle/testdata/validate/valid_bundle/manifests/etcdclusters.etcd.database.coreos.com.crd.yaml +++ b/pkg/lib/bundle/testdata/validate/valid_bundle/manifests/etcdclusters.etcd.database.coreos.com.crd.yaml @@ -14,3 +14,13 @@ spec: singular: etcdcluster scope: Namespaced version: v1beta2 + validation: + openAPIV3Schema: + properties: + spec: + type: object + properties: + test: + type: integer + minimum: 1 + maximum: 32767 diff --git a/pkg/lib/bundle/validate.go b/pkg/lib/bundle/validate.go index 470403ed8..0579f15b3 100644 --- a/pkg/lib/bundle/validate.go +++ b/pkg/lib/bundle/validate.go @@ -313,10 +313,11 @@ func (i imageValidator) ValidateBundleContent(manifestDir string) error { } } } else if gvk.Kind == CRDKind { + dec := k8syaml.NewYAMLOrJSONDecoder(strings.NewReader(string(data)), 30) switch gv := gvk.GroupVersion().String(); gv { case v1CRDapiVersion: crd := &apiextensionsv1.CustomResourceDefinition{} - err := runtime.DefaultUnstructuredConverter.FromUnstructured(k8sFile.Object, crd) + err := dec.Decode(crd) if err != nil { validationErrors = append(validationErrors, err) continue @@ -330,7 +331,7 @@ func (i imageValidator) ValidateBundleContent(manifestDir string) error { } case v1beta1CRDapiVersion: crd := &apiextensionsv1beta1.CustomResourceDefinition{} - err := runtime.DefaultUnstructuredConverter.FromUnstructured(k8sFile.Object, crd) + err := dec.Decode(crd) if err != nil { validationErrors = append(validationErrors, err) continue