NetApp / trident

Storage orchestrator for containers
Apache License 2.0
756 stars 219 forks source link

Trident operator doesn't clean up during uninstall #841

Open lindhe opened 1 year ago

lindhe commented 1 year ago

Describe the bug

After uninstalling the Trident operator (using Helm), I find that there are multiple CR and CRDs left. This is pretty annoying since the lingering resources still have finalizers on them preventing them from being deleted. So before I can delete the namespace to remove the resources, I have to edit each resource and clear its finalizer manually. I can thereafter remove the namespace to delete all resources and then finally remove all the Trident CRDs.

image

Environment Provide accurate information about the environment to help us reproduce the issue.

To Reproduce Steps to reproduce the behavior:

  1. helm install trident netapp-trident/trident-operator --version 23.04.0 --create-namespace --namespace trident
  2. helm uninstall trident --namespace trident

Expected behavior

I would expect the operator to clean up after itself automatically, as long as it has time to do a graceful shutdown.

wonderland commented 1 year ago

To completely remove Astra Trident (including the CRDs it creates) and effectively wipe the slate clean, you can edit TridentOrchestrator to pass the wipeout option. See the following example:

kubectl patch torc --type=merge -p '{"spec":{"wipeout":["crds"],"uninstall":true}}'

https://docs.netapp.com/us-en/trident/trident-managing-k8s/uninstall-trident.html

lindhe commented 1 year ago

Ah, interesting. Thanks for linking that!

I find that it says "If you installed Astra Trident by using Helm, you can uninstall it by using helm uninstall". Perhaps that should be amended to also include that part of the information you just pointed out?

You should only consider wiping out the CRDs when performing a complete uninstallation. This cannot be undone. Do not wipe out the CRDs unless you are looking to start over and create a fresh Astra Trident installation

That's key here. I guess removing the CRDs would nuke the backends and thus delete data. So it's kind of a matter of preference if that, potentially dangerous, operation should be carried out when uninstalling or not.

Considering this, I think the best way is probably to just document the uninstallation path for Helm a bit better. Ideally with a note about this in the Helm chart's README file. Is that a way forwards, do you think?