kubernetes-csi/csi-driver-host-path

destroying example deployment with a script

irbekrm opened this issue · 6 comments

Hi!

Thanks for this great project!

I was following the example linked from Readme and using the script in deploy/util/deploy-hostpath.sh to deploy the driver and the sidecars and it was really convenient, but if I want to clean up afterwards it takes a bit of time, especially to find the RBAC resources the script deployed- I was wondering if it wouldn't be nice to also be able to afterwards delete all the deployed resources with a corresponding destroy-hostpath.sh script?

I would be interested to write the script if you think it could be useful.

pohly commented

I think that would be useful.

Labeling the resources and then deleting those by selecting them via that label would be a good way to keep the script generic.

@pohly I have came across similar requirement. I believe we should make the deploy script to be generic and pass the operator as an arg. Like hostpath-driver.sh install and hostpath-driver.sh delete because we are evaluating paths and versions in the script so even at the time of destroying we won't need to re-evaluate them since rbacs doesn't have labels at the moment, we cannot just directly delete using labels.

Or the other option I think is we should create another script, delete all those things like sts which have labels like csi-provisioner, csi-attacher etc and then just evaluate the rbac versions and delete them using files directly to maintain consistency with what we apply to what we delete

pohly commented

since rbacs doesn't have labels at the moment, we cannot just directly delete using labels.

RBAC objects have an ObjectMeta and thus can have labels. That they currently don't have them is something that we can and should change once we add deletion by label.

delete them using files directly to maintain consistency with what we apply to what we delete

It may be useful to delete objects created by a different version of the scripts, for example when it isn't even known anymore which exact version was used for deploying, or simply to keep it easy to use.

When deleting exactly what would be installed, we may miss deleting of things that no longer get installed at all or were renamed.

right!, make sense. thanks. I will create seperate PRs for adding labels to all the rbac-files and also the resources which dont have right now (probably for the older versions also) and then will just add a PR for deleting script in this repo.

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

pohly commented

/remove-lifecycle stale

@aayushrangwala do you still intend to work on this?