@@ -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