diff --git a/pkg/oc/cli/admin/migrate/storage/storage.go b/pkg/oc/cli/admin/migrate/storage/storage.go index 657a94a7b6c7..23d2c993a357 100644 --- a/pkg/oc/cli/admin/migrate/storage/storage.go +++ b/pkg/oc/cli/admin/migrate/storage/storage.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" "golang.org/x/time/rate" + "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" @@ -308,6 +309,13 @@ func (o *MigrateAPIStorageOptions) save(info *resource.Info, reporter migrate.Re Resource(info.Mapping.Resource). Namespace(info.Namespace). Update(oldObject) + // storage migration is special in that all it needs to do is a no-op update to cause + // the api server to migrate the object to the preferred version. thus if we encounter + // a conflict, we know that something updated the object and we no longer need to do + // anything - if the object needed migration, the api server has already migrated it. + if errors.IsConflict(err) { + return migrate.ErrUnchanged + } if err != nil { return migrate.DefaultRetriable(info, err) }