github.com/kubeshop/testkube@v1.17.23/cmd/kubectl-testkube/commands/purge.go (about)

     1  package commands
     2  
     3  import (
     4  	"github.com/spf13/cobra"
     5  
     6  	"github.com/kubeshop/testkube/pkg/process"
     7  	"github.com/kubeshop/testkube/pkg/ui"
     8  )
     9  
    10  func NewPurgeCmd() *cobra.Command {
    11  	var name, namespace string
    12  
    13  	cmd := &cobra.Command{
    14  		Use:     "purge",
    15  		Short:   "Uninstall Testkube from your current kubectl context",
    16  		Long:    `Uninstall Testkube from your current kubectl context`,
    17  		Aliases: []string{"uninstall"},
    18  		Run: func(cmd *cobra.Command, args []string) {
    19  
    20  			ui.Verbose = true
    21  
    22  			_, err := process.Execute("helm", "uninstall", "--namespace", namespace, name)
    23  			ui.PrintOnError("uninstalling testkube", err)
    24  		},
    25  	}
    26  
    27  	cmd.Flags().StringVar(&name, "name", "testkube", "installation name")
    28  	cmd.Flags().StringVar(&namespace, "namespace", "testkube", "namespace from where to uninstall")
    29  
    30  	return cmd
    31  }