@@ -2242,15 +2242,16 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
2242
2242
return fmt .Errorf ("error creating validator for schema version %s: %s" , version , err )
2243
2243
}
2244
2244
gvr := schema.GroupVersionResource {Group : gr .Group , Version : version , Resource : gr .Resource }
2245
+
2245
2246
pager := pager .New (pager .SimplePageFunc (func (opts metav1.ListOptions ) (runtime.Object , error ) {
2246
2247
return dynamicClient .Resource (gvr ).List (context .TODO (), opts )
2247
2248
}))
2248
2249
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 ()
2250
2254
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 )
2254
2255
var namespacedName string
2255
2256
if cr .GetNamespace () == "" {
2256
2257
namespacedName = cr .GetName ()
0 commit comments