kastenhq / kubestr

Apache License 2.0
349 stars 47 forks source link

Refactoring the file-restore command to use a --fromPVC arg #299

Closed shlokc9 closed 1 month ago

shlokc9 commented 1 month ago

This PR adds a --fromPVC argument to the ./kubestr file-restore command. It would help users to mount a backup PVC along with their application PVC to a browser pod instead of only relying on a VolumeSnapshot as a backup.

Unit-tested these code changes with new fake tests and mock objects. Tested these code changes by executing the command on a GKE cluster. Please find the output below;

./bin/kubestr file-restore --fromPVC single-file-pvc --toPVC dummy-app-pvc -n application

> ./bin/kubestr file-restore --fromPVC restore-pvc --toPVC app-pvc -n application
Fetching the snapshot or PVC.
Fetching the restore PVC.
Fetching the source PVC.
Creating the browser pod & mounting the PVCs.
Forwarding the port.
Port forwarding is ready to get traffic. visit http://localhost:8080/
^C
Stopping port forward.
Cleaning up browser pod.

During cleanup, we do not clean the PVC. We just delete the Filebrowser pod.