Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Sep 5, 2024

Conversation

shlokc9
Copy link
Contributor

@shlokc9 shlokc9 commented Sep 3, 2024

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.

@shlokc9 shlokc9 added enhancement New feature or request go Pull requests that update Go code labels Sep 3, 2024
@shlokc9 shlokc9 self-assigned this Sep 3, 2024
Copy link
Contributor

@bathina2 bathina2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment, otherwise looks good.

restoreFileCmd.Flags().StringVarP(&fromSnapshot, "fromSnapshot", "f", "", "The name of a VolumeSnapshot. (Required)")
_ = restoreFileCmd.MarkFlagRequired("fromSnapshot")
restoreFileCmd.Flags().StringVarP(&fromSnapshot, "fromSnapshot", "f", "", "The name of a VolumeSnapshot.")
restoreFileCmd.Flags().StringVarP(&fromPVC, "fromPVC", "v", "", "The name of a PersistentVolumeClaim.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to add some flag options like this

restoreFileCmd.MarkFlagsMutuallyExclusive("fromSnapshot", "fromPVC")
restoreFileCmd.MarkFlagsOneRequired("fromSnapshot", "fromPVC")

@shlokc9 shlokc9 changed the title Refactoring the file-restore command to use a --toPVC arg Refactoring the file-restore command to use a --fromPVC arg Sep 5, 2024
@shlokc9 shlokc9 merged commit 9f6248b into kastenhq:master Sep 5, 2024
4 checks passed
@shlokc9 shlokc9 deleted the refactor-file-restore branch September 5, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Development

Successfully merging this pull request may close these issues.

2 participants