diff --git a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go index 10d3187096..ce51163853 100644 --- a/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go +++ b/staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go @@ -2242,22 +2242,23 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc return fmt.Errorf("error creating validator for schema version %s: %s", version, err) } gvr := schema.GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource} + pager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) { return dynamicClient.Resource(gvr).List(context.TODO(), opts) })) validationFn := func(obj runtime.Object) error { - err = validation.ValidateCustomResource(field.NewPath(""), obj, validator).ToAggregate() + // lister will only provide unstructured objects as runtime.Object, so this should never fail to convert + // if it does, it's a programming error + cr := obj.(*unstructured.Unstructured) + err = validation.ValidateCustomResource(field.NewPath(""), *cr, validator).ToAggregate() if err != nil { - // lister will only provide unstructured objects as runtime.Object, so this should never fail to convert - // if it does, it's a programming error - cr := obj.(*unstructured.Unstructured) var namespacedName string if cr.GetNamespace() == "" { namespacedName = cr.GetName() } else { namespacedName = fmt.Sprintf("%s/%s", cr.GetNamespace(), cr.GetName()) } - return validationError{fmt.Errorf("error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)} + return validationError{fmt.Errorf("JEK: error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)} } return nil } diff --git a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go index 10d3187096..ce51163853 100644 --- a/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go +++ b/vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go @@ -2242,22 +2242,23 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc return fmt.Errorf("error creating validator for schema version %s: %s", version, err) } gvr := schema.GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource} + pager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) { return dynamicClient.Resource(gvr).List(context.TODO(), opts) })) validationFn := func(obj runtime.Object) error { - err = validation.ValidateCustomResource(field.NewPath(""), obj, validator).ToAggregate() + // lister will only provide unstructured objects as runtime.Object, so this should never fail to convert + // if it does, it's a programming error + cr := obj.(*unstructured.Unstructured) + err = validation.ValidateCustomResource(field.NewPath(""), *cr, validator).ToAggregate() if err != nil { - // lister will only provide unstructured objects as runtime.Object, so this should never fail to convert - // if it does, it's a programming error - cr := obj.(*unstructured.Unstructured) var namespacedName string if cr.GetNamespace() == "" { namespacedName = cr.GetName() } else { namespacedName = fmt.Sprintf("%s/%s", cr.GetNamespace(), cr.GetName()) } - return validationError{fmt.Errorf("error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)} + return validationError{fmt.Errorf("JEK: error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)} } return nil }