@@ -374,6 +374,7 @@ func (r *CRDMigrator) reconcileStorageVersionMigration(ctx context.Context, crd
374
374
Kind : crd .Spec .Names .Kind ,
375
375
}
376
376
377
+ errs := []error {}
377
378
for _ , obj := range customResourceObjects {
378
379
e := objectEntry {
379
380
Kind : gvk .Kind ,
@@ -406,12 +407,17 @@ func (r *CRDMigrator) reconcileStorageVersionMigration(ctx context.Context, crd
406
407
// If we got a NotFound error, the object no longer exists so no need to update it.
407
408
// If we got a Conflict error, another client wrote the object already so no need to update it.
408
409
if err != nil && ! apierrors .IsNotFound (err ) && ! apierrors .IsConflict (err ) {
409
- return errors .Wrapf (err , "failed to migrate storage version of %s %s" , gvk .Kind , klog .KObj (u ))
410
+ errs = append (errs , errors .Wrap (err , klog .KObj (u ).String ()))
411
+ continue
410
412
}
411
413
412
414
r .storageVersionMigrationCache .Add (e )
413
415
}
414
416
417
+ if len (errs ) > 0 {
418
+ return errors .Wrapf (kerrors .NewAggregate (errs ), "failed to migrate storage version of %s objects" , gvk .Kind )
419
+ }
420
+
415
421
return nil
416
422
}
417
423
@@ -431,6 +437,7 @@ func (r *CRDMigrator) reconcileCleanupManagedFields(ctx context.Context, crd *ap
431
437
}
432
438
}
433
439
440
+ errs := []error {}
434
441
for _ , obj := range customResourceObjects {
435
442
if len (obj .GetManagedFields ()) == 0 {
436
443
continue
@@ -512,10 +519,15 @@ func (r *CRDMigrator) reconcileCleanupManagedFields(ctx context.Context, crd *ap
512
519
// Note: We always have to return the conflict error directly (instead of an aggregate) so retry on conflict works.
513
520
return err
514
521
}); err != nil {
515
- return errors .Wrapf (kerrors .NewAggregate ([]error {err , getErr }), "failed to cleanup managedFields of %s %s" , crd .Spec .Names .Kind , klog .KObj (obj ))
522
+ errs = append (errs , errors .Wrap (kerrors .NewAggregate ([]error {err , getErr }), klog .KObj (obj ).String ()))
523
+ continue
516
524
}
517
525
}
518
526
527
+ if len (errs ) > 0 {
528
+ return errors .Wrapf (kerrors .NewAggregate (errs ), "failed to cleanup managedFields of %s objects" , crd .Spec .Names .Kind )
529
+ }
530
+
519
531
return nil
520
532
}
521
533
0 commit comments