Restore takes latest backup regardless of which original PVC it was from
Description
Seems k8up simply takes the latest snapshot and doesn't check if that snapshot actually was for the pvc that was being restored. This causes weird behavior where the content of PVC A gets restored to PVC B. This is also clearly visible in the logs.
I tried setting a restore filter but it seems this only gets applied after selecting the latest snapshot.
Selecting the latest snapshot should take the restore filter into account and even better would be if the restore filter would default to a filter that would match the correct PVC.
Additional Context
No response
Logs
2025-04-28T21:22:17Z INFO k8up.restic.restic.restore no snapshot defined, using latest one
2025-04-28T21:22:17Z INFO k8up.restic.restic.restore found snapshot {"date": "2025-04-28T06:53:16Z"}
2025-04-28T21:22:17Z INFO k8up.restic.restic.restore.command restic command {"path": "/usr/local/bin/restic", "args": ["ls", "--json", "aea6ac7796347cbd3ae78109a39783fc622495753860093ddcee896e04199753"]}
2025-04-28T21:22:17Z INFO k8up.restic.restic.restore.command Defining RESTIC_PROGRESS_FPS {"frequency": 0.016666666666666666}
2025-04-28T21:22:22Z INFO k8up.restic.restic.restore folder restore {"restoreDir": "/restore", "trimPath": true, "linkedDir": "/tmp/restore", "restoreFilter": "--path /data/music-assistant-server-data-pvc", "snapshotID": "aea6ac7796347cbd3ae78109a39783fc622495753860093ddcee896e04199753"}
2025-04-28T21:22:22Z INFO k8up.restic.restic.restore.command restic command {"path": "/usr/local/bin/restic", "args": ["restore", "aea6ac7796347cbd3ae78109a39783fc622495753860093ddcee896e04199753", "--target", "/tmp/restore", "--include", "--path /data/music-assistant-server-data-pvc"]}
2025-04-28T21:22:22Z INFO k8up.restic.restic.restore.command Defining RESTIC_PROGRESS_FPS {"frequency": 0.016666666666666666}
2025-04-28T21:22:30Z INFO k8up.restic.restic.restore.restic.stdout restoring <Snapshot aea6ac77 of [/data/zigbee2mqtt-data-pvc] at 2025-04-28 06:53:16.027282424 +0000 UTC by root@homelab> to /tmp/restore
2025-04-28T21:22:30Z INFO k8up.restic.restic.restore.restic.stdout Summary: Restored 0 files/dirs (0 B) in 0:00
Expected Behavior
Restores for volume A should restore a snapshot for volume A
Steps To Reproduce
- Have 2 or more different PVC's to backup
- Ensure all of them have snapshots
- Try to restore, notice the same snapshot will be used for all restores.
Version of K8up
2.1.2
Version of Kubernetes
1.32
Distribution of Kubernetes
Talos and k3s
Agree this should be considered a bug. I believe this is a duplicate of #867