litmus-go icon indicating copy to clipboard operation
litmus-go copied to clipboard

Delete chaosresults as part of cleanup.

Open rbalagopalakrishna opened this issue 3 years ago • 4 comments

BUG REPORT

What happened: Deleting the chaosengine is only deleting the pods(runner, helper, experiment pod)which are being created during the chaos test.

What you expected to happen: It should also delete the chaosresults from the test.

#kubectl delete chaosengine -n litmus network-chaos-1 network-chaos-2
chaosengine.litmuschaos.io "network-chaos-1" deleted
chaosengine.litmuschaos.io "network-chaos-2" deleted

#kubectl get pods -n litmus
NAME                                READY   STATUS    RESTARTS   AGE
chaos-operator-ce-c7cc65966-zz5n4   1/1     Running   0          6h57m

#kubectl get chaosresults -n litmus
NAME                                  AGE
network-chaos-1-pod-network-latency   5m9s
network-chaos-2-pod-network-latency   3m26s```

rbalagopalakrishna avatar Jun 30 '21 15:06 rbalagopalakrishna

chaosresult is a dedicated custom resource @rbalagopalakrishna . There is a case for it to exist independently (of chaosengine or its associated pods) in order to track failure/success history or generate some useful reports.

IMO a custom script/post-hook can be set up in case you are interested to remove them.

ksatchit avatar Jun 30 '21 15:06 ksatchit

@ksatchit in our use case we are generating chaosengine name and it is unique for each execution so it generates new chaosresult each time. And so no history maintained in that case. We want the results to be delete along with engine. As of now we are doing it the way you suggested by custom script. However, we want a more robust and integrated solution for it in engine itself. Can there be a flag in engine to delete results along with engine? By default it can be set to false and if someone (like us) needs it then they can enable it.

mdnyeemakhtar avatar Jun 30 '21 16:06 mdnyeemakhtar

@mdnyeemakhtar I see. That is an interesting case. Let me get back on this.

ksatchit avatar Jul 01 '21 03:07 ksatchit

@mdnyeemakhtar I see. That is an interesting case. Let me get back on this.

Thank you @ksatchit

mdnyeemakhtar avatar Jul 01 '21 15:07 mdnyeemakhtar