Add check for multiple release in Namespace
User should know that before deleting a component that other helm
release exists in a namespace.
closes:
@@ -205,7 +205,16 @@ func UninstallComponent(c components.Component, kubeconfig []byte, deleteNSBool
}
}
+ releasesList, err := action.NewList(cfg).Run()
+ if err != nil {
+ return fmt.Errorf("listing Helm releases: %w", err)
+ }
+
if deleteNSBool {
+ if len(releasesList) > 0 {
+ return fmt.Errorf("namespace %q may have other components installed, cannot remove namespace", ns)
+ }
+
if err := deleteNS(ns, kubeconfig); err != nil {
return err
}
