diff --git a/internal/k8s/jobs.go b/internal/k8s/jobs.go index 31dc980..263d5e8 100644 --- a/internal/k8s/jobs.go +++ b/internal/k8s/jobs.go @@ -327,7 +327,10 @@ func backupCommand(cfg *config.Config, req api.BackupRequest) string { } func restoreCommand(snapshot string) string { - return fmt.Sprintf("set -euo pipefail; restic restore %s --target /restore", snapshot) + return fmt.Sprintf( + "set -euo pipefail; rm -rf /cache/restore && mkdir -p /cache/restore; restic restore %s --target /cache/restore; if [ -d /cache/restore/data ]; then cp -a /cache/restore/data/. /restore/; else cp -a /cache/restore/. /restore/; fi", + snapshot, + ) } func resticEnv(cfg *config.Config, secretName string) []corev1.EnvVar {