From cb23f760909694596ebcf525c46d08f853f53006 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Mon, 13 Apr 2026 02:30:31 -0300 Subject: [PATCH] restore(restic): flatten restored data into target pvc root --- internal/k8s/jobs.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 {