Skip to content

Commit 1a25881

Browse files
committed
investigation
1 parent e27da48 commit 1a25881

File tree

2 files changed

+46
-2
lines changed
  • staging/operator-lifecycle-manager/pkg/controller/operators/catalog
  • vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog

2 files changed

+46
-2
lines changed

staging/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

+23-1
Original file line numberDiff line numberDiff line change
@@ -2242,6 +2242,26 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
22422242
return fmt.Errorf("error creating validator for schema version %s: %s", version, err)
22432243
}
22442244
gvr := schema.GroupVersionResource{Group: gr.Group, Version: version, Resource: gr.Resource}
2245+
2246+
results := make(map[string]*unstructured.Unstructured)
2247+
2248+
crList, err := dynamicClient.Resource(gvr).List(context.TODO(), metav1.ListOptions{})
2249+
if err != nil {
2250+
return fmt.Errorf("error listing resources in GroupVersionResource %#v: %s", gvr, err)
2251+
}
2252+
for _, cr := range crList.Items {
2253+
var namespacedName string
2254+
if cr.GetNamespace() == "" {
2255+
namespacedName = cr.GetName()
2256+
} else {
2257+
namespacedName = fmt.Sprintf("%s/%s", cr.GetNamespace(), cr.GetName())
2258+
}
2259+
if err := validation.ValidateCustomResource(field.NewPath(""), &cr, validator).ToAggregate(); err != nil {
2260+
return validationError{fmt.Errorf("blocking lister: error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)}
2261+
}
2262+
results[namespacedName] = &cr
2263+
}
2264+
22452265
pager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) {
22462266
return dynamicClient.Resource(gvr).List(context.TODO(), opts)
22472267
}))
@@ -2257,7 +2277,9 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
22572277
} else {
22582278
namespacedName = fmt.Sprintf("%s/%s", cr.GetNamespace(), cr.GetName())
22592279
}
2260-
return validationError{fmt.Errorf("error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)}
2280+
return validationError{fmt.Errorf("error validating %s %q: simple list succeeded where paginated failed:\nsimple:\n%#v\npaginated:\n%#v\n %v",
2281+
gvr, namespacedName, results[namespacedName], obj, err)}
2282+
// return validationError{fmt.Errorf("error validating %s %q: updated validation is too restrictive: %v", cr.GroupVersionKind(), namespacedName, err)}
22612283
}
22622284
return nil
22632285
}

vendor/github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators/catalog/operator.go

+23-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)