kastenhq / kubestr

Apache License 2.0
349 stars 47 forks source link

Adding new capabilities to the "./kubestr browse" command #276

Closed shlokc9 closed 2 months ago

shlokc9 commented 2 months ago

Description

Right now, we allow ./kubestr browse command to mount a single PersistentVolumeClaim on a Filebrowser pod and expose the browser UI to look into the contents of a PVC. It would be great if we could extend the browse utility to look through the contents of a VolumeSnapshot, too.

Proposed changes

Browse through a PVC using Filebrowser

> ./kubestr browse <pvc-name> -n <namespace> -v <volume-snapshot-class>

For backward compatibility purposes, we continue to support this command which helps in browsing through a PVC. Just the way it functions at the moment.

> ./kubestr browse pvc <pvc-name> -n <namespace> -v <volume-snapshot-class>

We create a new ./kubestr browse pvc sub-command that works the same way as ./kubestr browse. Adding a pvc sub-command would come in handy to differentiate between PVC browsing and Snapshot browsing functionalities. Making both the commands concise and easy to understand.

Browse through a VolumeSnapshot using Filebrowser

$ ./kubestr browse snapshot <snapshot-name> -n <namespace> -s <storage-class>

This new command would create an in-flight PVC from the given VolumeSnapshot and mount the same PVC to a Filebrowser pod. Which would allow users to navigate through the contents of the Snapshot using Filebrowser UI.

Print directory tree structure for a PVC

$ ./kubestr browse pvc <pvc-name> -n <namespace> -v <volume-snapshot-class> —show-tree

The --show-tree flag would allow users to print out the directory structure of a PVC without using the Filebrowser service. Expected behavior here is to launch a container in an ephemeral pod that uses any basic linux image and run a POSIX command that would output the entire tree structure of the PVC content. And pass along that stdout in the container to kubestr.

Print directory tree structure for a VolumeSnapshot

$ ./kubestr browse snapshot <snapshot-name> -n <namespace> -s <storage-class> —show-tree

Lastly, the --show-tree flag for ./kubestr browse snapshot is expected to work the same as it does for ./kubestr browse pvc. The only difference here would be that we output the tree structure of the contents of a Snapshot instead of a PVC.