@@ -2243,34 +2243,15 @@ func validateExistingCRs(dynamicClient dynamic.Interface, gr schema.GroupResourc
2243
2243
}
2244
2244
gvr := schema.GroupVersionResource {Group : gr .Group , Version : version , Resource : gr .Resource }
2245
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
-
2265
2246
pager := pager .New (pager .SimplePageFunc (func (opts metav1.ListOptions ) (runtime.Object , error ) {
2266
2247
return dynamicClient .Resource (gvr ).List (context .TODO (), opts )
2267
2248
}))
2268
2249
validationFn := func (obj runtime.Object ) error {
2269
- 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 ()
2270
2254
if err != nil {
2271
- // lister will only provide unstructured objects as runtime.Object, so this should never fail to convert
2272
- // if it does, it's a programming error
2273
- cr := obj .(* unstructured.Unstructured )
2274
2255
var namespacedName string
2275
2256
if cr .GetNamespace () == "" {
2276
2257
namespacedName = cr .GetName ()
0 commit comments