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