diff --git a/changelogs/unreleased/6634-27149chen b/changelogs/unreleased/6634-27149chen new file mode 100644 index 0000000000..61e71665e9 --- /dev/null +++ b/changelogs/unreleased/6634-27149chen @@ -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 \ No newline at end of file diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index df6edb6ec6..2cc9c56224 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -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