Skip to content

Commit 2b02a7b

Browse files
committed
pass deref'd pointer to ValidateCustomResource to dodge false incompatibility notice
1 parent 1474ee3 commit 2b02a7b

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,14 @@ image: clean build #HELP Build image image for linux on host architecture
153153
# the e2e and experimental_metrics tags are required to get e2e tests to pass
154154
# search the code for go:build e2e or go:build experimental_metrics to see where these tags are used
155155
e2e-build: export GO_BUILD_TAGS += e2e experimental_metrics #HELP Build image for e2e testing
156-
e2e-build: IMAGE_TAG = local
157-
e2e-build: image
156+
e2e-build: local-build
157+
158+
.PHONY: local-build
159+
local-build: IMAGE_TAG = local
160+
local-build: image
161+
162+
.PHONY: run-local
163+
run-local: local-build kind-create deploy
158164

159165
.PHONY: clean
160166
clean: #HELP Clean up build artifacts

pkg/controller/operators/catalog/operator.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,15 +2242,16 @@ 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+
22452246
pager := pager.New(pager.SimplePageFunc(func(opts metav1.ListOptions) (runtime.Object, error) {
22462247
return dynamicClient.Resource(gvr).List(context.TODO(), opts)
22472248
}))
22482249
validationFn := func(obj runtime.Object) error {
2249-
err = validation.ValidateCustomResource(field.NewPath(""), obj, validator).ToAggregate()
2250+
// lister will only provide unstructured objects as runtime.Object, so this should never fail to convert
2251+
// if it does, it's a programming error
2252+
cr := obj.(*unstructured.Unstructured)
2253+
err = validation.ValidateCustomResource(field.NewPath(""), *cr, validator).ToAggregate()
22502254
if err != nil {
2251-
// lister will only provide unstructured objects as runtime.Object, so this should never fail to convert
2252-
// if it does, it's a programming error
2253-
cr := obj.(*unstructured.Unstructured)
22542255
var namespacedName string
22552256
if cr.GetNamespace() == "" {
22562257
namespacedName = cr.GetName()

0 commit comments

Comments
 (0)