diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index cee3216f6f..df6edb6ec6 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -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 {