|
|
@ -8,7 +8,7 @@ import (
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
const removeDesc = `
|
|
|
|
const deleteDesc = `
|
|
|
|
This command takes a release name, and then deletes the release from Kubernetes.
|
|
|
|
This command takes a release name, and then deletes the release from Kubernetes.
|
|
|
|
It removes all of the resources associated with the last release of the chart.
|
|
|
|
It removes all of the resources associated with the last release of the chart.
|
|
|
|
|
|
|
|
|
|
|
@ -16,29 +16,29 @@ Use the '--dry-run' flag to see which releases will be deleted without actually
|
|
|
|
deleting them.
|
|
|
|
deleting them.
|
|
|
|
`
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
|
|
var removeDryRun bool
|
|
|
|
var deleteDryRun bool
|
|
|
|
|
|
|
|
|
|
|
|
var removeCommand = &cobra.Command{
|
|
|
|
var deleteCommand = &cobra.Command{
|
|
|
|
Use: "remove [flags] RELEASE_NAME",
|
|
|
|
Use: "delete [flags] RELEASE_NAME",
|
|
|
|
Aliases: []string{"rm"},
|
|
|
|
Aliases: []string{"del"},
|
|
|
|
SuggestFor: []string{"delete", "del"},
|
|
|
|
SuggestFor: []string{"remove", "rm"},
|
|
|
|
Short: "Given a release name, remove the release from Kubernetes",
|
|
|
|
Short: "Given a release name, delete the release from Kubernetes",
|
|
|
|
Long: removeDesc,
|
|
|
|
Long: deleteDesc,
|
|
|
|
RunE: rmRelease,
|
|
|
|
RunE: delRelease,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
func init() {
|
|
|
|
RootCommand.AddCommand(removeCommand)
|
|
|
|
RootCommand.AddCommand(deleteCommand)
|
|
|
|
removeCommand.Flags().BoolVar(&removeDryRun, "dry-run", false, "Simulate action, but don't actually do it.")
|
|
|
|
deleteCommand.Flags().BoolVar(&deleteDryRun, "dry-run", false, "Simulate action, but don't actually do it.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func rmRelease(cmd *cobra.Command, args []string) error {
|
|
|
|
func delRelease(cmd *cobra.Command, args []string) error {
|
|
|
|
if len(args) == 0 {
|
|
|
|
if len(args) == 0 {
|
|
|
|
return errors.New("Command 'remove' requires a release name.")
|
|
|
|
return errors.New("Command 'delete' requires a release name.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Handle dry run use case.
|
|
|
|
// TODO: Handle dry run use case.
|
|
|
|
if removeDryRun {
|
|
|
|
if deleteDryRun {
|
|
|
|
fmt.Printf("DRY RUN: Deleting %s\n", args[0])
|
|
|
|
fmt.Printf("DRY RUN: Deleting %s\n", args[0])
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|