diff --git a/changelogs/unreleased/4769-half-life666 b/changelogs/unreleased/4769-half-life666 new file mode 100644 index 000000000..374f5ce3c --- /dev/null +++ b/changelogs/unreleased/4769-half-life666 @@ -0,0 +1 @@ +Skip podvolumerestore creation when restore excludes pv/pvc diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index 7eb8c8136..67681eea5 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -1296,7 +1296,10 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso return warnings, errs } - if len(restic.GetVolumeBackupsForPod(ctx.podVolumeBackups, pod, originalNamespace)) > 0 { + // Do not create podvolumerestore when current restore excludes pv/pvc + if ctx.resourceIncludesExcludes.ShouldInclude(kuberesource.PersistentVolumeClaims.String()) && + ctx.resourceIncludesExcludes.ShouldInclude(kuberesource.PersistentVolumes.String()) && + len(restic.GetVolumeBackupsForPod(ctx.podVolumeBackups, pod, originalNamespace)) > 0 { restorePodVolumeBackups(ctx, createdObj, originalNamespace) } }