Add action to show files in Volume
Motivation It can be hard to understand exactly what data is contained inside a Kubernetes volume. We can provide visibility with Robusta actions
Suggested Implementation Add a Robusta action which:
- Takes a Kubernetes volume as input
- Runs a "reader" job/pod which mounts that volume
- The reader pod should run
ls -Ron the volume to show all files. - The Robusta action should gather the reader pod's output and send it to Slack/other sinks by creating a finding
Bonus Add support for VolumeSnapshots too. For VolumeSnapshots you will first need to create a temporary Volume based on the snapshot, then do the above, and finally delete the temporary volume.
Caveats The above sometims wont work if the Volume is in use - depending on the mount's AccessMode. This can be fixed various ways. For example, for ReadWriteOnce it can be bypassed by running the reader pod on the same node as the pod that is currrently using the volume. Alternatively, it could be fixed for all AccessModes by always creating a VolumeSnapshot and reading the snapshot not the original.
In any event, a first version doesn't need to support any of this.
I am looking forward this issue, doing a dive to get my hands dirty is there anything I should be aware about the issue or descriptions says all
Everything is in the description. Feel free to ask any questions in the #beginners channel on Slack
Hey @aantn when you say volume is it a object that the function would receive or just the name of the volume p.s I was busy with my exam so took a time for this
@AvineshTripathi hope your exams went well!
The playbook action should take a PersistentVolumeEvent as input:
@action
def volume_analysis(event: PersistentVolumeEvent):
volume = event.get_persistentvolume()
print(f"got volume named {volume.metadata.name} as input with current status: {volume.status.reason}")
# create a reader pod (using the builtin hikaru library) that does stuff with the volume
reader_pod = Pod(
...
)
To trigger it you can just provide the volume's name though. Something like the cli command:
robusta playbooks trigger volume_analysis name=some-volume namespace=some-ns
@AvineshTripathi we have a new tutorial on writing playbooks actions that @Sheeproid wrote, so make sure you read that first:
https://docs.robusta.dev/master/tutorials/my-first-custom-action.html
When I am trying to upgrade helm after enabling PlaybooksPersistentVolume
controlplane $ helm upgrade robusta robusta/helm/robusta --values=values.yaml
Error: open values.yaml: no such file or directory
p.s. In the docs it is mentioned generated_values.yaml but in repo I see values.yaml I think both are same but names are different
Hey @AvineshTripathi , the values.yaml is the defaults, and the generated_values.yaml is the overrides that you created when you ran "robusta gen-config" and used in helm install
You should use generated_values.yaml with helm upgrade as well.
so to upgrade the helm I need to do gen-config first and then upgrade helm with flag value=generated_values.yaml
Hi @AvineshTripathi
After running gen-config for the first time, your generated_values.yaml is created.
That file contains your UI account id, and some configuration parameters.
You should save this file, and use it later on when you need to upgrade Robusta.
You need to run gen-config only once, on the first time you install Robusta.
I am trying to upgrade helm but it throws an error Error: UPGRADE FAILED: "robusta" has no deployed releases" when am running helm upgrade robusta helm/robusta --values=generated_values.yaml is there anything I am missing.
p.s. sorry for bugging again
@AvineshTripathi , I reached you in the Slack community channel. Lets solve it there?
sinksConfig:
- file_sink: name: file_sink file_name: file.json i added above sinks gettting below error devops@ip-192-168-242-253:~/robusta$ helm upgrade robusta robusta/robusta --values=generated_values.yaml Error: UPGRADE FAILED: "robusta" has no deployed releases anyone plz guide me where I am missing it