Skip to content

Commit

Permalink
Merge pull request #6634 from 27149chen/allow-update-gv
Browse files Browse the repository at this point in the history
Get resource client again after restore actions in case resource's gv is changed
  • Loading branch information
reasonerjt authored Aug 14, 2023
2 parents a88cb46 + 797267c commit 713792d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelogs/unreleased/6634-27149chen
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes #6498. Get resource client again after restore actions in case resource's gv is changed. This is an improvement of pr #6499, to support group changes. A group change usually happens in a restore plugin which is used for resource conversion: convert a resource from a not supported gv to a supported gv
3 changes: 2 additions & 1 deletion pkg/restore/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,8 @@ 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)
newGR := schema.GroupResource{Group: obj.GroupVersionKind().Group, Resource: groupResource.Resource}
resourceClient, err = ctx.getResourceClient(newGR, obj, obj.GetNamespace())
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
Expand Down

0 comments on commit 713792d

Please sign in to comment.