Skip to content

Commit

Permalink
fix(#31): uninstallation of cert manager
Browse files Browse the repository at this point in the history
Merge pull request #32 from kubeslice/hotfix-certmanager-uninstall
  • Loading branch information
priyank-upadhyay authored Jan 10, 2023
2 parents d7b6216 + a065b91 commit b9ee345
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
// "github.com/spf13/cobra/doc"
)

var version = "0.4.0"
var version = "0.4.1"
var rootCmd = &cobra.Command{
Use: "kubeslice-cli",
Version: version,
Expand Down
22 changes: 22 additions & 0 deletions pkg/internal/cert-manager-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ func InstallCertManager(ApplicationConfiguration *ConfigurationSpecs) {

util.Printf("%s Successfully installed cert manager.\n", util.Tick)

}
func UninstallCertManager(ApplicationConfiguration *ConfigurationSpecs) {

cc := ApplicationConfiguration.Configuration.ClusterConfiguration
hc := ApplicationConfiguration.Configuration.HelmChartConfiguration
util.Printf("\nUninstalling Cert Manager...")

err := uninstallCertManager(cc.ControllerCluster, hc)
if err == nil {
util.Printf("%s Successfully uninstalled cert manager.\n", util.Tick)
} else {
util.Printf("%s Failed to uninstall cert manager.\n", util.Cross)
}

}

func installCertManager(cluster Cluster, hc HelmChartConfiguration) {
Expand All @@ -36,3 +50,11 @@ func installCertManager(cluster Cluster, hc HelmChartConfiguration) {
log.Fatalf("Process failed %v", err)
}
}
func uninstallCertManager(cluster Cluster, hc HelmChartConfiguration) error {
args := make([]string, 0)
args = append(args, "--kube-context", cluster.ContextName, "--kubeconfig", cluster.KubeConfigPath, "uninstall", "cert-manager", "--namespace", "cert-manager")

err := util.RunCommand("helm", args...)
return err

}
1 change: 1 addition & 0 deletions pkg/slicectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func Uninstall(componentsToUninstall, workersToUninstall map[string]string) {
}
if uninstallController {
internal.UninstallKubeSliceController(ApplicationConfiguration)
internal.UninstallCertManager(ApplicationConfiguration)
}
return
}
Expand Down

0 comments on commit b9ee345

Please sign in to comment.