diff --git a/cmd/helm/testdata/output/uninstall-purge.txt b/cmd/helm/testdata/output/uninstall-keep-history.txt similarity index 100% rename from cmd/helm/testdata/output/uninstall-purge.txt rename to cmd/helm/testdata/output/uninstall-keep-history.txt diff --git a/cmd/helm/uninstall.go b/cmd/helm/uninstall.go index 1117465da..37da40666 100644 --- a/cmd/helm/uninstall.go +++ b/cmd/helm/uninstall.go @@ -27,8 +27,10 @@ import ( ) const uninstallDesc = ` -This command takes a release name, and then uninstalls the release from Kubernetes. -It removes all of the resources associated with the last release of the chart. +This command takes a release name and uninstalls the release. + +It removes all of the resources associated with the last release of the chart +as well as the release history, freeing it up for future use. Use the '--dry-run' flag to see which releases will be uninstalled without actually uninstalling them. @@ -41,7 +43,7 @@ func newUninstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { Use: "uninstall RELEASE_NAME [...]", Aliases: []string{"del", "delete", "un"}, SuggestFor: []string{"remove", "rm"}, - Short: "given a release name, uninstall the release from Kubernetes", + Short: "uninstall a release", Long: uninstallDesc, Args: require.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { @@ -64,7 +66,7 @@ func newUninstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f := cmd.Flags() f.BoolVar(&client.DryRun, "dry-run", false, "simulate a uninstall") f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during uninstallation") - f.BoolVar(&client.Purge, "purge", false, "remove the release from the store and make its name free for later use") + f.BoolVar(&client.KeepHistory, "keep-history", false, "remove all associated resources and mark the release as deleted, but retain the release history") f.Int64Var(&client.Timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") return cmd diff --git a/cmd/helm/uninstall_test.go b/cmd/helm/uninstall_test.go index b31928e8f..409019a3c 100644 --- a/cmd/helm/uninstall_test.go +++ b/cmd/helm/uninstall_test.go @@ -52,9 +52,9 @@ func TestUninstall(t *testing.T) { rels: []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "aeneas"})}, }, { - name: "purge", - cmd: "uninstall aeneas --purge", - golden: "output/uninstall-purge.txt", + name: "keep history", + cmd: "uninstall aeneas --keep-history", + golden: "output/uninstall-keep-history.txt", rels: []*release.Release{release.Mock(&release.MockReleaseOptions{Name: "aeneas"})}, }, { diff --git a/docs/faq.md b/docs/faq.md index 4d37e8a24..85bfc5350 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -15,6 +15,16 @@ Here's an exhaustive list of all the major changes introduced in Helm 3. In Helm 3, Helm switched the Go import path over from `k8s.io/helm` to `helm.sh/helm`. If you intend to upgrade to the Helm 3 Go client libraries, make sure to change your import paths. +### Helm delete + +In order to better align the verbiage from other package managers, `helm delete` was re-named to +`helm uninstall`. `helm delete` is still retained as an alias to `helm uninstall`, so either form +can be used. + +In Helm 2, in order to purge the release ledger, the `--purge` flag had to be provided. This +functionality is now enabled by default. To retain the previous behaviour, use +`helm uninstall --keep-history`. + ## Installing diff --git a/pkg/action/uninstall.go b/pkg/action/uninstall.go index e44b15583..11d1b5225 100644 --- a/pkg/action/uninstall.go +++ b/pkg/action/uninstall.go @@ -38,7 +38,7 @@ type Uninstall struct { DisableHooks bool DryRun bool - Purge bool + KeepHistory bool Timeout int64 } @@ -78,7 +78,7 @@ func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) // TODO: Are there any cases where we want to force a delete even if it's // already marked deleted? if rel.Info.Status == release.StatusUninstalled { - if u.Purge { + if !u.KeepHistory { if err := u.purgeReleases(rels...); err != nil { return nil, errors.Wrap(err, "uninstall: Failed to purge the release") } @@ -119,7 +119,7 @@ func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) rel.Info.Status = release.StatusUninstalled rel.Info.Description = "Uninstallation complete" - if u.Purge { + if !u.KeepHistory { u.cfg.Log("purge requested for %s", name) err := u.purgeReleases(rels...) return res, errors.Wrap(err, "uninstall: Failed to purge the release") diff --git a/scripts/completions.bash b/scripts/completions.bash index ededbb791..6c05963b4 100644 --- a/scripts/completions.bash +++ b/scripts/completions.bash @@ -287,8 +287,8 @@ _helm_delete() local_nonpersistent_flags+=("--dry-run") flags+=("--no-hooks") local_nonpersistent_flags+=("--no-hooks") - flags+=("--purge") - local_nonpersistent_flags+=("--purge") + flags+=("--keep-history") + local_nonpersistent_flags+=("--keep-history") flags+=("--timeout=") local_nonpersistent_flags+=("--timeout=") flags+=("--tls")