From 334f173091a32f39d2766bef2e618661fde985bf Mon Sep 17 00:00:00 2001
From: Vineet Reddy Rajula <rajula.vineet.reddy@cern.ch>
Date: Wed, 15 Mar 2023 11:46:57 +0100
Subject: [PATCH] Do not rsync permissions during restore

---
 velero-restic-restore/restore_pvs.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/velero-restic-restore/restore_pvs.sh b/velero-restic-restore/restore_pvs.sh
index ac471fc..606a3c4 100755
--- a/velero-restic-restore/restore_pvs.sh
+++ b/velero-restic-restore/restore_pvs.sh
@@ -43,7 +43,8 @@ sleep 60s
 POD_NAME=`oc get pod -l app=drupal,drupalSite="$DRUPALSITE" -n "$NAMESPACE" --sort-by=.metadata.creationTimestamp --field-selector=status.phase==Running -o jsonpath="{.items[-1:].metadata.name}"`
 validateVar "$POD_NAME" "POD_NAME"
 
-oc rsync /restore/ "$POD_NAME":/drupal-data  --delete -n "$NAMESPACE" -c php-fpm
+# Add no-perms to abide by the existing permissions set on the PVC
+oc rsync /restore/ "$POD_NAME":/drupal-data --no-perms=true --delete -n "$NAMESPACE" -c php-fpm
 
 # We remove /root/.cache/ in each iteration to prevent restic backups to run out of memory and fail the cronjobs we run,
 # as we detected this malfunction in our infra.
-- 
GitLab