Skip to content

Commit

Permalink
Allow updated resource version
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kucera <[email protected]>
  • Loading branch information
danielkucera committed Jul 19, 2023
1 parent f234dd6 commit 575a4ac
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,14 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
}
}

// The object apiVersion might get modified by a RestorePlugin so we need to
// get a new client to reflect updated resource path.
resourceClient, err = ctx.getResourceClient(groupResource, obj, namespace)
if err != nil {
errs.AddVeleroError(fmt.Errorf("error getting updated resource client for namespace %q, resource %q: %v", namespace, &groupResource, err))
return warnings, errs, itemExists
}

ctx.log.Infof("Attempting to restore %s: %v", obj.GroupVersionKind().Kind, name)
createdObj, restoreErr := resourceClient.Create(obj)
if restoreErr == nil {
Expand Down

0 comments on commit 575a4ac

Please sign in to comment.