Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/oc/cli/admin/migrate/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
}
Expand Down