restore(restic): flatten restored data into target pvc root

This commit is contained in:
Brad Stein 2026-04-13 02:30:31 -03:00
parent d9dd73d831
commit cb23f76090

View File

@ -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 {