kinvolk / lokomotive

🪦 DISCONTINUED Further Lokomotive development has been discontinued. Lokomotive is a 100% open-source, easy to use and secure Kubernetes distribution from the volks at Kinvolk
https://kinvolk.io/lokomotive-kubernetes/
Apache License 2.0
320 stars 49 forks source link

Should uninstalling not configured component return error? #1019

Open invidian opened 4 years ago

invidian commented 4 years ago

Currently, when one tries to uninstall component, which is not configured, lokoctl will happily proceed with it. It seems to me, that we should return an error in such case, as this is similar to what Terraform -target do and package managers. If you try uninstalling non-existent package or try destroying non-existent target, error is returned.

surajssd commented 4 years ago

This was a deliberate decision: https://github.com/kinvolk/lokomotive/pull/268#discussion_r410159354.

invidian commented 4 years ago

Thanks for digging it out @surajssd. This creates an edge case to handle in my refactoring work, as currently for installing component we require configuration to be in place, but when uninstalling, we ignore it :/

That also has some side effects, for example, if component has been installed in user-defined namespace, then uninstalling will fail (or will actually be silent), as it will try to uninstall it from a different namespace.

As we currently do not track which components has been installed, it seems more natural to me to first uninstall the component from the cluster, then de-configure it, to keep reversed order of the install operation (1st you configure, then you install, not the other way around). This would also prevents components from getting untracked (removed from configuration, but someone forgot to uninstall them).