From 195d21d5d7a3e6be45065ddc7f5a9a7677fb4c93 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 14 Jun 2018 15:25:45 -0700 Subject: [PATCH] ref(cmd): rename `helm delete` to `helm uninstall` To match the convention of `helm install`, `helm uninstall` is the inverse. Other tangential changes in this PR: - StatusDeleting has been changed to StatusUninstalling - StatusDeleted has been changed to StatusUninstalled - `helm list --deleted` has been changed to `helm list --uninstalled` - `helm list --deleting` has been changed to `helm list --uninstalling` - `helm.DeleteOption` and all delete options have been renamed to `helm.UninstallOption` I have not made any changes to the "helm.sh/hook-delete-policy", "pre-delete" and "post-delete" hook annotations because 1. it's a major breaking change to existing helm charts, which we've commited to NOT break in Helm 3 2. there is no "helm.sh/hook-install-policy" to pair with "helm.sh/hook-uninstall-policy", so delete still makes sense here `helm delete` and `helm del` have been added as aliases to `helm uninstall`, so `helm delete` and `helm del` still works as is. --- cmd/helm/list.go | 24 +++++------ cmd/helm/list_test.go | 8 ++-- cmd/helm/root.go | 2 +- cmd/helm/testdata/output/delete-no-args.txt | 3 -- cmd/helm/testdata/output/delete-no-hooks.txt | 1 - cmd/helm/testdata/output/delete-purge.txt | 1 - cmd/helm/testdata/output/delete-timeout.txt | 1 - cmd/helm/testdata/output/delete.txt | 1 - .../testdata/output/uninstall-no-args.txt | 3 ++ .../testdata/output/uninstall-no-hooks.txt | 1 + cmd/helm/testdata/output/uninstall-purge.txt | 1 + .../testdata/output/uninstall-timeout.txt | 1 + cmd/helm/testdata/output/uninstall.txt | 1 + cmd/helm/{delete.go => uninstall.go} | 42 +++++++++---------- .../{delete_test.go => uninstall_test.go} | 30 ++++++------- .../custom_resource_definitions.md | 2 +- docs/chart_template_guide/getting_started.md | 2 +- docs/charts_hooks.md | 4 +- docs/charts_tips_and_tricks.md | 12 +++--- docs/install_faq.md | 2 +- docs/quickstart.md | 8 ++-- docs/using_helm.md | 28 ++++++------- pkg/hapi/release/status.go | 8 ++-- pkg/helm/client.go | 4 +- pkg/helm/fake.go | 4 +- pkg/helm/fake_test.go | 22 +++++----- pkg/helm/helm_test.go | 20 ++++----- pkg/helm/interface.go | 2 +- pkg/helm/option.go | 26 ++++++------ pkg/releaseutil/filter_test.go | 18 ++++---- pkg/releaseutil/sorter_test.go | 4 +- pkg/storage/driver/cfgmaps_test.go | 6 +-- pkg/storage/driver/memory_test.go | 2 +- pkg/storage/driver/secrets_test.go | 6 +-- pkg/storage/storage.go | 8 ++-- pkg/storage/storage_test.go | 8 ++-- pkg/tiller/release_install_test.go | 2 +- pkg/tiller/release_list_test.go | 6 +-- pkg/tiller/release_server.go | 2 +- pkg/tiller/release_server_test.go | 2 +- pkg/tiller/release_status.go | 2 +- pkg/tiller/release_status_test.go | 8 ++-- pkg/tiller/release_uninstall.go | 14 +++---- pkg/tiller/release_uninstall_test.go | 16 +++---- pkg/tiller/release_update.go | 12 +++--- pkg/tiller/release_update_test.go | 2 +- scripts/completions.bash | 8 ++-- 47 files changed, 195 insertions(+), 195 deletions(-) delete mode 100644 cmd/helm/testdata/output/delete-no-args.txt delete mode 100644 cmd/helm/testdata/output/delete-no-hooks.txt delete mode 100644 cmd/helm/testdata/output/delete-purge.txt delete mode 100644 cmd/helm/testdata/output/delete-timeout.txt delete mode 100644 cmd/helm/testdata/output/delete.txt create mode 100644 cmd/helm/testdata/output/uninstall-no-args.txt create mode 100644 cmd/helm/testdata/output/uninstall-no-hooks.txt create mode 100644 cmd/helm/testdata/output/uninstall-purge.txt create mode 100644 cmd/helm/testdata/output/uninstall-timeout.txt create mode 100644 cmd/helm/testdata/output/uninstall.txt rename cmd/helm/{delete.go => uninstall.go} (63%) rename cmd/helm/{delete_test.go => uninstall_test.go} (62%) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index f159d207f..cc9d85527 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -34,8 +34,8 @@ var listHelp = ` This command lists all of the releases. By default, it lists only releases that are deployed or failed. Flags like -'--deleted' and '--all' will alter this behavior. Such flags can be combined: -'--deleted --failed'. +'--uninstalled' and '--all' will alter this behavior. Such flags can be combined: +'--uninstalled --failed'. By default, items are sorted alphabetically. Use the '-d' flag to sort by release date. @@ -63,8 +63,8 @@ type listOptions struct { allNamespaces bool // --all-namespaces byDate bool // --date colWidth uint // --col-width - deleted bool // --deleted - deleting bool // --deleting + uninstalled bool // --uninstalled + uninstalling bool // --uninstalling deployed bool // --deployed failed bool // --failed limit int // --max @@ -104,9 +104,9 @@ func newListCmd(client helm.Interface, out io.Writer) *cobra.Command { f.IntVarP(&o.limit, "max", "m", 256, "maximum number of releases to fetch") f.StringVarP(&o.offset, "offset", "o", "", "next release name in the list, used to offset from start value") f.BoolVarP(&o.all, "all", "a", false, "show all releases, not just the ones marked deployed") - f.BoolVar(&o.deleted, "deleted", false, "show deleted releases") + f.BoolVar(&o.uninstalled, "uninstalled", false, "show uninstalled releases") f.BoolVar(&o.superseded, "superseded", false, "show superseded releases") - f.BoolVar(&o.deleting, "deleting", false, "show releases that are currently being deleted") + f.BoolVar(&o.uninstalling, "uninstalling", false, "show releases that are currently being uninstalled") f.BoolVar(&o.deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled") f.BoolVar(&o.failed, "failed", false, "show failed releases") f.BoolVar(&o.pending, "pending", false, "show pending releases") @@ -188,8 +188,8 @@ func (o *listOptions) statusCodes() []release.ReleaseStatus { return []release.ReleaseStatus{ release.StatusUnknown, release.StatusDeployed, - release.StatusDeleted, - release.StatusDeleting, + release.StatusUninstalled, + release.StatusUninstalling, release.StatusFailed, release.StatusPendingInstall, release.StatusPendingUpgrade, @@ -200,11 +200,11 @@ func (o *listOptions) statusCodes() []release.ReleaseStatus { if o.deployed { status = append(status, release.StatusDeployed) } - if o.deleted { - status = append(status, release.StatusDeleted) + if o.uninstalled { + status = append(status, release.StatusUninstalled) } - if o.deleting { - status = append(status, release.StatusDeleting) + if o.uninstalling { + status = append(status, release.StatusUninstalling) } if o.failed { status = append(status, release.StatusFailed) diff --git a/cmd/helm/list_test.go b/cmd/helm/list_test.go index 2a331eb01..ef1abcbf5 100644 --- a/cmd/helm/list_test.go +++ b/cmd/helm/list_test.go @@ -48,9 +48,9 @@ func TestListCmd(t *testing.T) { golden: "output/list-with-failed.txt", }, { name: "with a release, multiple flags", - cmd: "list --deleted --deployed --failed -q", + cmd: "list --uninstalled --deployed --failed -q", rels: []*release.Release{ - helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusUninstalled}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), }, // Note: We're really only testing that the flags parsed correctly. Which results are returned @@ -60,7 +60,7 @@ func TestListCmd(t *testing.T) { name: "with a release, multiple flags", cmd: "list --all -q", rels: []*release.Release{ - helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleted}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusUninstalled}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), }, // See note on previous test. @@ -69,7 +69,7 @@ func TestListCmd(t *testing.T) { name: "with a release, multiple flags, deleting", cmd: "list --all -q", rels: []*release.Release{ - helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusDeleting}), + helm.ReleaseMock(&helm.MockReleaseOptions{Name: "thomas-guide", Status: release.StatusUninstalling}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}), }, // See note on previous test. diff --git a/cmd/helm/root.go b/cmd/helm/root.go index 15737a6e9..6e890c886 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -71,7 +71,6 @@ func newRootCmd(c helm.Interface, out io.Writer, args []string) *cobra.Command { newVerifyCmd(out), // release commands - newDeleteCmd(c, out), newGetCmd(c, out), newHistoryCmd(c, out), newInstallCmd(c, out), @@ -79,6 +78,7 @@ func newRootCmd(c helm.Interface, out io.Writer, args []string) *cobra.Command { newReleaseTestCmd(c, out), newRollbackCmd(c, out), newStatusCmd(c, out), + newUninstallCmd(c, out), newUpgradeCmd(c, out), newCompletionCmd(out), diff --git a/cmd/helm/testdata/output/delete-no-args.txt b/cmd/helm/testdata/output/delete-no-args.txt deleted file mode 100644 index f06a4cb4e..000000000 --- a/cmd/helm/testdata/output/delete-no-args.txt +++ /dev/null @@ -1,3 +0,0 @@ -Error: "helm delete" requires at least 1 argument - -Usage: helm delete RELEASE_NAME [...] [flags] diff --git a/cmd/helm/testdata/output/delete-no-hooks.txt b/cmd/helm/testdata/output/delete-no-hooks.txt deleted file mode 100644 index 1292e5eb7..000000000 --- a/cmd/helm/testdata/output/delete-no-hooks.txt +++ /dev/null @@ -1 +0,0 @@ -release "aeneas" deleted diff --git a/cmd/helm/testdata/output/delete-purge.txt b/cmd/helm/testdata/output/delete-purge.txt deleted file mode 100644 index 1292e5eb7..000000000 --- a/cmd/helm/testdata/output/delete-purge.txt +++ /dev/null @@ -1 +0,0 @@ -release "aeneas" deleted diff --git a/cmd/helm/testdata/output/delete-timeout.txt b/cmd/helm/testdata/output/delete-timeout.txt deleted file mode 100644 index 1292e5eb7..000000000 --- a/cmd/helm/testdata/output/delete-timeout.txt +++ /dev/null @@ -1 +0,0 @@ -release "aeneas" deleted diff --git a/cmd/helm/testdata/output/delete.txt b/cmd/helm/testdata/output/delete.txt deleted file mode 100644 index 1292e5eb7..000000000 --- a/cmd/helm/testdata/output/delete.txt +++ /dev/null @@ -1 +0,0 @@ -release "aeneas" deleted diff --git a/cmd/helm/testdata/output/uninstall-no-args.txt b/cmd/helm/testdata/output/uninstall-no-args.txt new file mode 100644 index 000000000..fc01a75b9 --- /dev/null +++ b/cmd/helm/testdata/output/uninstall-no-args.txt @@ -0,0 +1,3 @@ +Error: "helm uninstall" requires at least 1 argument + +Usage: helm uninstall RELEASE_NAME [...] [flags] diff --git a/cmd/helm/testdata/output/uninstall-no-hooks.txt b/cmd/helm/testdata/output/uninstall-no-hooks.txt new file mode 100644 index 000000000..f5454b88d --- /dev/null +++ b/cmd/helm/testdata/output/uninstall-no-hooks.txt @@ -0,0 +1 @@ +release "aeneas" uninstalled diff --git a/cmd/helm/testdata/output/uninstall-purge.txt b/cmd/helm/testdata/output/uninstall-purge.txt new file mode 100644 index 000000000..f5454b88d --- /dev/null +++ b/cmd/helm/testdata/output/uninstall-purge.txt @@ -0,0 +1 @@ +release "aeneas" uninstalled diff --git a/cmd/helm/testdata/output/uninstall-timeout.txt b/cmd/helm/testdata/output/uninstall-timeout.txt new file mode 100644 index 000000000..f5454b88d --- /dev/null +++ b/cmd/helm/testdata/output/uninstall-timeout.txt @@ -0,0 +1 @@ +release "aeneas" uninstalled diff --git a/cmd/helm/testdata/output/uninstall.txt b/cmd/helm/testdata/output/uninstall.txt new file mode 100644 index 000000000..f5454b88d --- /dev/null +++ b/cmd/helm/testdata/output/uninstall.txt @@ -0,0 +1 @@ +release "aeneas" uninstalled diff --git a/cmd/helm/delete.go b/cmd/helm/uninstall.go similarity index 63% rename from cmd/helm/delete.go rename to cmd/helm/uninstall.go index eec08ccc1..fed20e378 100644 --- a/cmd/helm/delete.go +++ b/cmd/helm/uninstall.go @@ -26,15 +26,15 @@ import ( "k8s.io/helm/pkg/helm" ) -const deleteDesc = ` -This command takes a release name, and then deletes the release from Kubernetes. +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. -Use the '--dry-run' flag to see which releases will be deleted without actually -deleting them. +Use the '--dry-run' flag to see which releases will be uninstalled without actually +uninstalling them. ` -type deleteOptions struct { +type uninstallOptions struct { disableHooks bool // --no-hooks dryRun bool // --dry-run purge bool // --purge @@ -46,15 +46,15 @@ type deleteOptions struct { client helm.Interface } -func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { - o := &deleteOptions{client: c} +func newUninstallCmd(c helm.Interface, out io.Writer) *cobra.Command { + o := &uninstallOptions{client: c} cmd := &cobra.Command{ - Use: "delete RELEASE_NAME [...]", - Aliases: []string{"del"}, + Use: "uninstall RELEASE_NAME [...]", + Aliases: []string{"del", "delete", "un"}, SuggestFor: []string{"remove", "rm"}, - Short: "given a release name, delete the release from Kubernetes", - Long: deleteDesc, + Short: "given a release name, uninstall the release from Kubernetes", + Long: uninstallDesc, Args: require.MinimumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { o.client = ensureHelmClient(o.client, false) @@ -65,29 +65,29 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { return err } - fmt.Fprintf(out, "release \"%s\" deleted\n", o.name) + fmt.Fprintf(out, "release \"%s\" uninstalled\n", o.name) } return nil }, } f := cmd.Flags() - f.BoolVar(&o.dryRun, "dry-run", false, "simulate a delete") - f.BoolVar(&o.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") + f.BoolVar(&o.dryRun, "dry-run", false, "simulate a uninstall") + f.BoolVar(&o.disableHooks, "no-hooks", false, "prevent hooks from running during uninstallation") f.BoolVar(&o.purge, "purge", false, "remove the release from the store and make its name free for later use") f.Int64Var(&o.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") return cmd } -func (o *deleteOptions) run(out io.Writer) error { - opts := []helm.DeleteOption{ - helm.DeleteDryRun(o.dryRun), - helm.DeleteDisableHooks(o.disableHooks), - helm.DeletePurge(o.purge), - helm.DeleteTimeout(o.timeout), +func (o *uninstallOptions) run(out io.Writer) error { + opts := []helm.UninstallOption{ + helm.UninstallDryRun(o.dryRun), + helm.UninstallDisableHooks(o.disableHooks), + helm.UninstallPurge(o.purge), + helm.UninstallTimeout(o.timeout), } - res, err := o.client.DeleteRelease(o.name, opts...) + res, err := o.client.UninstallRelease(o.name, opts...) if res != nil && res.Info != "" { fmt.Fprintln(out, res.Info) } diff --git a/cmd/helm/delete_test.go b/cmd/helm/uninstall_test.go similarity index 62% rename from cmd/helm/delete_test.go rename to cmd/helm/uninstall_test.go index a391d995f..c176b793a 100644 --- a/cmd/helm/delete_test.go +++ b/cmd/helm/uninstall_test.go @@ -23,39 +23,39 @@ import ( "k8s.io/helm/pkg/helm" ) -func TestDelete(t *testing.T) { +func TestUninstall(t *testing.T) { rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})} tests := []cmdTestCase{ { - name: "basic delete", - cmd: "delete aeneas", - golden: "output/delete.txt", + name: "basic uninstall", + cmd: "uninstall aeneas", + golden: "output/uninstall.txt", rels: rels, }, { - name: "delete with timeout", - cmd: "delete aeneas --timeout 120", - golden: "output/delete-timeout.txt", + name: "uninstall with timeout", + cmd: "uninstall aeneas --timeout 120", + golden: "output/uninstall-timeout.txt", rels: rels, }, { - name: "delete without hooks", - cmd: "delete aeneas --no-hooks", - golden: "output/delete-no-hooks.txt", + name: "uninstall without hooks", + cmd: "uninstall aeneas --no-hooks", + golden: "output/uninstall-no-hooks.txt", rels: rels, }, { name: "purge", - cmd: "delete aeneas --purge", - golden: "output/delete-purge.txt", + cmd: "uninstall aeneas --purge", + golden: "output/uninstall-purge.txt", rels: rels, }, { - name: "delete without release", - cmd: "delete", - golden: "output/delete-no-args.txt", + name: "uninstall without release", + cmd: "uninstall", + golden: "output/uninstall-no-args.txt", wantError: true, }, } diff --git a/docs/chart_best_practices/custom_resource_definitions.md b/docs/chart_best_practices/custom_resource_definitions.md index 96690dc9b..fc390e258 100644 --- a/docs/chart_best_practices/custom_resource_definitions.md +++ b/docs/chart_best_practices/custom_resource_definitions.md @@ -34,4 +34,4 @@ To package the two together, add a `pre-install` hook to the CRD definition so that it is fully installed before the rest of the chart is executed. Note that if you create the CRD with a `pre-install` hook, that CRD definition -will not be deleted when `helm delete` is run. +will not be uninstalled when `helm uninstall` is run. diff --git a/docs/chart_template_guide/getting_started.md b/docs/chart_template_guide/getting_started.md index 87ae5fa3c..107a0bfb8 100644 --- a/docs/chart_template_guide/getting_started.md +++ b/docs/chart_template_guide/getting_started.md @@ -133,7 +133,7 @@ generated this YAML document. From there on, we can see that the YAML data is exactly what we put in our `configmap.yaml` file. -Now we can delete our release: `helm delete full-coral`. +Now we can uninstall our release: `helm uninstall full-coral`. ### Adding a Simple Template Call diff --git a/docs/charts_hooks.md b/docs/charts_hooks.md index 4142f2ce0..945e93a4b 100644 --- a/docs/charts_hooks.md +++ b/docs/charts_hooks.md @@ -94,7 +94,7 @@ release. Once Tiller verifies that the hook has reached its ready state, it will leave the hook resource alone. Practically speaking, this means that if you create resources in a hook, you -cannot rely upon `helm delete` to remove the resources. To destroy such +cannot rely upon `helm uninstall` to remove the resources. To destroy such resources, you need to either write code to perform this operation in a `pre-delete` or `post-delete` hook or add `"helm.sh/hook-delete-policy"` annotation to the hook template file. @@ -185,7 +185,7 @@ You can choose one or more defined annotation values: * `"hook-failed"` specifies Tiller should delete the hook if the hook failed during execution. * `"before-hook-creation"` specifies Tiller should delete the previous hook before the new hook is launched. -### Automatically delete hook from previous release +### Automatically uninstall hook from previous release When helm release being updated it is possible, that hook resource already exists in cluster. By default helm will try to create resource and fail with `"... already exists"` error. diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 484d8b936..c86a052c5 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -160,11 +160,11 @@ spec: See also the `helm upgrade --recreate-pods` flag for a slightly different way of addressing this issue. -## Tell Tiller Not To Delete a Resource +## Tell Tiller Not To Uninstall a Resource -Sometimes there are resources that should not be deleted when Helm runs a -`helm delete`. Chart developers can add an annotation to a resource to prevent -it from being deleted. +Sometimes there are resources that should not be uninstalled when Helm runs a +`helm uninstall`. Chart developers can add an annotation to a resource to prevent +it from being uninstalled. ```yaml kind: Secret @@ -177,9 +177,9 @@ metadata: (Quotation marks are required) The annotation `"helm.sh/resource-policy": keep` instructs Tiller to skip this -resource during a `helm delete` operation. _However_, this resource becomes +resource during a `helm uninstall` operation. _However_, this resource becomes orphaned. Helm will no longer manage it in any way. This can lead to problems -if using `helm install --replace` on a release that has already been deleted, but +if using `helm install --replace` on a release that has already been uninstalled, but has kept resources. ## Using "Partials" and Template Includes diff --git a/docs/install_faq.md b/docs/install_faq.md index f2eae5b48..a7a35cc44 100644 --- a/docs/install_faq.md +++ b/docs/install_faq.md @@ -224,7 +224,7 @@ I am trying to remove stuff. **Q: When I delete the Tiller deployment, how come all the releases are still there?** Releases are stored in ConfigMaps inside of the `kube-system` namespace. You will -have to manually delete them to get rid of the record, or use ```helm delete --purge```. +have to manually delete them to get rid of the record, or use ```helm uninstall --purge```. **Q: I want to delete my local Helm. Where are all its files?** diff --git a/docs/quickstart.md b/docs/quickstart.md index 52a7c800f..2a5f25f66 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -107,10 +107,10 @@ The `helm list` function will show you a list of all deployed releases. ## Uninstall a Release -To uninstall a release, use the `helm delete` command: +To uninstall a release, use the `helm uninstall` command: ```console -$ helm delete smiling-penguin +$ helm uninstall smiling-penguin Removed smiling-penguin ``` @@ -119,11 +119,11 @@ still be able to request information about that release: ```console $ helm status smiling-penguin -Status: DELETED +Status: UNINSTALLED ... ``` -Because Helm tracks your releases even after you've deleted them, you +Because Helm tracks your releases even after you've uninstalled them, you can audit a cluster's history, and even undelete a release (with `helm rollback`). diff --git a/docs/using_helm.md b/docs/using_helm.md index 6bf7bc40a..80324d72f 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -387,13 +387,13 @@ is not a full list of cli flags. To see a description of all flags, just run will cause all pods to be recreated (with the exception of pods belonging to deployments) -## 'helm delete': Deleting a Release +## 'helm uninstall': Uninstalling a Release -When it is time to uninstall or delete a release from the cluster, use -the `helm delete` command: +When it is time to uninstall or uninstall a release from the cluster, use +the `helm uninstall` command: ``` -$ helm delete happy-panda +$ helm uninstall happy-panda ``` This will remove the release from the cluster. You can see all of your @@ -406,28 +406,28 @@ inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0 ``` From the output above, we can see that the `happy-panda` release was -deleted. +uninstalled. However, Helm always keeps records of what releases happened. Need to -see the deleted releases? `helm list --deleted` shows those, and `helm -list --all` shows all of the releases (deleted and currently deployed, +see the uninstalled releases? `helm list --uninstalled` shows those, and `helm +list --all` shows all of the releases (uninstalled and currently deployed, as well as releases that failed): ```console ⇒ helm list --all NAME VERSION UPDATED STATUS CHART -happy-panda 2 Wed Sep 28 12:47:54 2016 DELETED mariadb-0.3.0 +happy-panda 2 Wed Sep 28 12:47:54 2016 UNINSTALLED mariadb-0.3.0 inky-cat 1 Wed Sep 28 12:59:46 2016 DEPLOYED alpine-0.1.0 -kindred-angelf 2 Tue Sep 27 16:16:10 2016 DELETED alpine-0.1.0 +kindred-angelf 2 Tue Sep 27 16:16:10 2016 UNINSTALLED alpine-0.1.0 ``` -Because Helm keeps records of deleted releases, a release name cannot be -re-used. (If you _really_ need to re-use a release name, you can use the -`--replace` flag, but it will simply re-use the existing release and +Because Helm keeps records of uninstalled releases, a release name cannot +be re-used. (If you _really_ need to re-use a release name, you can use +the `--replace` flag, but it will simply re-use the existing release and replace its resources.) Note that because releases are preserved in this way, you can rollback a -deleted resource, and have it re-activate. +uninstalled resource, and have it re-activate. ## 'helm repo': Working with Repositories @@ -505,7 +505,7 @@ In some cases you may wish to scope Tiller or deploy multiple Tillers to a singl ## Conclusion This chapter has covered the basic usage patterns of the `helm` client, -including searching, installation, upgrading, and deleting. It has also +including searching, installation, upgrading, and uninstalling. It has also covered useful utility commands like `helm status`, `helm get`, and `helm repo`. diff --git a/pkg/hapi/release/status.go b/pkg/hapi/release/status.go index cd7d9e9d2..2d4accb23 100644 --- a/pkg/hapi/release/status.go +++ b/pkg/hapi/release/status.go @@ -22,14 +22,14 @@ const ( StatusUnknown ReleaseStatus = "unknown" // StatusDeployed indicates that the release has been pushed to Kubernetes. StatusDeployed ReleaseStatus = "deployed" - // StatusDeleted indicates that a release has been deleted from Kubermetes. - StatusDeleted ReleaseStatus = "deleted" + // StatusUninstalled indicates that a release has been uninstalled from Kubermetes. + StatusUninstalled ReleaseStatus = "uninstalled" // StatusSuperseded indicates that this release object is outdated and a newer one exists. StatusSuperseded ReleaseStatus = "superseded" // StatusFailed indicates that the release was not successfully deployed. StatusFailed ReleaseStatus = "failed" - // StatusDeleting indicates that a delete operation is underway. - StatusDeleting ReleaseStatus = "deleting" + // StatusUninstalling indicates that a uninstall operation is underway. + StatusUninstalling ReleaseStatus = "uninstalling" // StatusPendingInstall indicates that an install operation is underway. StatusPendingInstall ReleaseStatus = "pending-install" // StatusPendingUpgrade indicates that an upgrade operation is underway. diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 7ce4e912d..8925b6043 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -106,8 +106,8 @@ func (c *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ... return c.tiller.InstallRelease(req) } -// DeleteRelease uninstalls a named release and returns the response. -func (c *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error) { +// UninstallRelease uninstalls a named release and returns the response. +func (c *Client) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error) { // apply the uninstall options reqOpts := c.opts for _, opt := range opts { diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index c3409225f..d7f5e01fd 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -77,8 +77,8 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts return release, nil } -// DeleteRelease deletes a release from the FakeClient -func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error) { +// UninstallRelease uninstalls a release from the FakeClient +func (c *FakeClient) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error) { for i, rel := range c.Rels { if rel.Name == rlsName { c.Rels = append(c.Rels[:i], c.Rels[i+1:]...) diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index c41142b0e..12114328a 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -182,13 +182,13 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { } } -func TestFakeClient_DeleteRelease(t *testing.T) { +func TestFakeClient_UninstallRelease(t *testing.T) { type fields struct { Rels []*release.Release } type args struct { rlsName string - opts []DeleteOption + opts []UninstallOption } tests := []struct { name string @@ -199,7 +199,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { wantErr bool }{ { - name: "Delete a release that exists.", + name: "Uninstall a release that exists.", fields: fields{ Rels: []*release.Release{ ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), @@ -208,7 +208,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { }, args: args{ rlsName: "trepid-tapir", - opts: []DeleteOption{}, + opts: []UninstallOption{}, }, relsAfter: []*release.Release{ ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), @@ -219,7 +219,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { wantErr: false, }, { - name: "Delete a release that does not exist.", + name: "Uninstall a release that does not exist.", fields: fields{ Rels: []*release.Release{ ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), @@ -228,7 +228,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { }, args: args{ rlsName: "release-that-does-not-exists", - opts: []DeleteOption{}, + opts: []UninstallOption{}, }, relsAfter: []*release.Release{ ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), @@ -238,7 +238,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { wantErr: true, }, { - name: "Delete when only 1 item exists.", + name: "Uninstall when only 1 item exists.", fields: fields{ Rels: []*release.Release{ ReleaseMock(&MockReleaseOptions{Name: "trepid-tapir"}), @@ -246,7 +246,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) { }, args: args{ rlsName: "trepid-tapir", - opts: []DeleteOption{}, + opts: []UninstallOption{}, }, relsAfter: []*release.Release{}, want: &hapi.UninstallReleaseResponse{ @@ -260,13 +260,13 @@ func TestFakeClient_DeleteRelease(t *testing.T) { c := &FakeClient{ Rels: tt.fields.Rels, } - got, err := c.DeleteRelease(tt.args.rlsName, tt.args.opts...) + got, err := c.UninstallRelease(tt.args.rlsName, tt.args.opts...) if (err != nil) != tt.wantErr { - t.Errorf("FakeClient.DeleteRelease() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("FakeClient.UninstallRelease() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { - t.Errorf("FakeClient.DeleteRelease() = %v, want %v", got, tt.want) + t.Errorf("FakeClient.UninstallRelease() = %v, want %v", got, tt.want) } if !reflect.DeepEqual(c.Rels, tt.relsAfter) { diff --git a/pkg/helm/helm_test.go b/pkg/helm/helm_test.go index 16fa2fd9c..94207077f 100644 --- a/pkg/helm/helm_test.go +++ b/pkg/helm/helm_test.go @@ -45,7 +45,7 @@ func TestListReleases_VerifyOptions(t *testing.T) { var sortOrd = hapi.SortAsc var codes = []rls.ReleaseStatus{ rls.StatusFailed, - rls.StatusDeleted, + rls.StatusUninstalled, rls.StatusDeployed, rls.StatusSuperseded, } @@ -143,27 +143,27 @@ func TestInstallRelease_VerifyOptions(t *testing.T) { assert(t, "", client.opts.instReq.Name) } -// Verify each DeleteOptions is applied to an UninstallReleaseRequest correctly. -func TestDeleteRelease_VerifyOptions(t *testing.T) { +// Verify each UninstallOptions is applied to an UninstallReleaseRequest correctly. +func TestUninstallRelease_VerifyOptions(t *testing.T) { // Options testdata var releaseName = "test" var disableHooks = true var purgeFlag = true - // Expected DeleteReleaseRequest message + // Expected UninstallReleaseRequest message exp := &hapi.UninstallReleaseRequest{ Name: releaseName, Purge: purgeFlag, DisableHooks: disableHooks, } - // Options used in DeleteRelease - ops := []DeleteOption{ - DeletePurge(purgeFlag), - DeleteDisableHooks(disableHooks), + // Options used in UninstallRelease + ops := []UninstallOption{ + UninstallPurge(purgeFlag), + UninstallDisableHooks(disableHooks), } - // BeforeCall option to intercept Helm client DeleteReleaseRequest + // BeforeCall option to intercept Helm client UninstallReleaseRequest b4c := BeforeCall(func(msg interface{}) error { switch act := msg.(type) { case *hapi.UninstallReleaseRequest: @@ -176,7 +176,7 @@ func TestDeleteRelease_VerifyOptions(t *testing.T) { }) client := NewClient(b4c) - if _, err := client.DeleteRelease(releaseName, ops...); err != errSkip { + if _, err := client.UninstallRelease(releaseName, ops...); err != errSkip { t.Fatalf("did not expect error but got (%v)\n``", err) } diff --git a/pkg/helm/interface.go b/pkg/helm/interface.go index 39c029d1b..25b96a0a8 100644 --- a/pkg/helm/interface.go +++ b/pkg/helm/interface.go @@ -27,7 +27,7 @@ type Interface interface { ListReleases(opts ...ReleaseListOption) ([]*release.Release, error) InstallRelease(chStr, namespace string, opts ...InstallOption) (*release.Release, error) InstallReleaseFromChart(chart *chart.Chart, namespace string, opts ...InstallOption) (*release.Release, error) - DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error) + UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error) UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error) diff --git a/pkg/helm/option.go b/pkg/helm/option.go index e362483f2..476f00262 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -37,7 +37,7 @@ type options struct { reuseName bool // if set, performs pod restart during upgrade/rollback recreate bool - // if set, force resource update through delete/recreate if needed + // if set, force resource update through uninstall/recreate if needed force bool // if set, skip running hooks disableHooks bool @@ -170,8 +170,8 @@ func UpgradeTimeout(timeout int64) UpdateOption { } } -// DeleteTimeout specifies the number of seconds before kubernetes calls timeout -func DeleteTimeout(timeout int64) DeleteOption { +// UninstallTimeout specifies the number of seconds before kubernetes calls timeout +func UninstallTimeout(timeout int64) UninstallOption { return func(opts *options) { opts.uninstallReq.Timeout = timeout } @@ -226,22 +226,22 @@ func UpdateValueOverrides(raw []byte) UpdateOption { } } -// DeleteDisableHooks will disable hooks for a deletion operation. -func DeleteDisableHooks(disable bool) DeleteOption { +// UninstallDisableHooks will disable hooks for a deletion operation. +func UninstallDisableHooks(disable bool) UninstallOption { return func(opts *options) { opts.disableHooks = disable } } -// DeleteDryRun will (if true) execute a deletion as a dry run. -func DeleteDryRun(dry bool) DeleteOption { +// UninstallDryRun will (if true) execute a deletion as a dry run. +func UninstallDryRun(dry bool) UninstallOption { return func(opts *options) { opts.dryRun = dry } } -// DeletePurge removes the release from the store and make its name free for later use. -func DeletePurge(purge bool) DeleteOption { +// UninstallPurge removes the release from the store and make its name free for later use. +func UninstallPurge(purge bool) UninstallOption { return func(opts *options) { opts.uninstallReq.Purge = purge } @@ -289,7 +289,7 @@ func RollbackRecreate(recreate bool) RollbackOption { } } -// RollbackForce will (if true) force resource update through delete/recreate if needed +// RollbackForce will (if true) force resource update through uninstall/recreate if needed func RollbackForce(force bool) RollbackOption { return func(opts *options) { opts.force = force @@ -339,16 +339,16 @@ func UpgradeRecreate(recreate bool) UpdateOption { } } -// UpgradeForce will (if true) force resource update through delete/recreate if needed +// UpgradeForce will (if true) force resource update through uninstall/recreate if needed func UpgradeForce(force bool) UpdateOption { return func(opts *options) { opts.force = force } } -// DeleteOption allows setting optional attributes when +// UninstallOption allows setting optional attributes when // performing a UninstallRelease tiller rpc. -type DeleteOption func(*options) +type UninstallOption func(*options) // UpdateOption allows specifying various settings // configurable by the helm client user for overriding diff --git a/pkg/releaseutil/filter_test.go b/pkg/releaseutil/filter_test.go index 0eb6a32c3..969fd9ea5 100644 --- a/pkg/releaseutil/filter_test.go +++ b/pkg/releaseutil/filter_test.go @@ -23,24 +23,24 @@ import ( ) func TestFilterAny(t *testing.T) { - ls := Any(StatusFilter(rspb.StatusDeleted)).Filter(releases) + ls := Any(StatusFilter(rspb.StatusUninstalled)).Filter(releases) if len(ls) != 2 { t.Fatalf("expected 2 results, got '%d'", len(ls)) } r0, r1 := ls[0], ls[1] switch { - case r0.Info.Status != rspb.StatusDeleted: - t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.String()) - case r1.Info.Status != rspb.StatusDeleted: - t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.String()) + case r0.Info.Status != rspb.StatusUninstalled: + t.Fatalf("expected UNINSTALLED result, got '%s'", r1.Info.Status.String()) + case r1.Info.Status != rspb.StatusUninstalled: + t.Fatalf("expected UNINSTALLED result, got '%s'", r1.Info.Status.String()) } } func TestFilterAll(t *testing.T) { fn := FilterFunc(func(rls *rspb.Release) bool { - // true if not deleted and version < 4 - v0 := !StatusFilter(rspb.StatusDeleted).Check(rls) + // true if not uninstalled and version < 4 + v0 := !StatusFilter(rspb.StatusUninstalled).Check(rls) v1 := rls.Version < 4 return v0 && v1 }) @@ -53,7 +53,7 @@ func TestFilterAll(t *testing.T) { switch r0 := ls[0]; { case r0.Version == 4: t.Fatal("got release with status revision 4") - case r0.Info.Status == rspb.StatusDeleted: - t.Fatal("got release with status DELTED") + case r0.Info.Status == rspb.StatusUninstalled: + t.Fatal("got release with status UNINSTALLED") } } diff --git a/pkg/releaseutil/sorter_test.go b/pkg/releaseutil/sorter_test.go index 8761a6064..05890507c 100644 --- a/pkg/releaseutil/sorter_test.go +++ b/pkg/releaseutil/sorter_test.go @@ -28,8 +28,8 @@ import ( var releases = []*rspb.Release{ tsRelease("quiet-bear", 2, 2000, rspb.StatusSuperseded), tsRelease("angry-bird", 4, 3000, rspb.StatusDeployed), - tsRelease("happy-cats", 1, 4000, rspb.StatusDeleted), - tsRelease("vocal-dogs", 3, 6000, rspb.StatusDeleted), + tsRelease("happy-cats", 1, 4000, rspb.StatusUninstalled), + tsRelease("vocal-dogs", 3, 6000, rspb.StatusUninstalled), } func tsRelease(name string, vers int, dur time.Duration, status rspb.ReleaseStatus) *rspb.Release { diff --git a/pkg/storage/driver/cfgmaps_test.go b/pkg/storage/driver/cfgmaps_test.go index d92b35764..904122faf 100644 --- a/pkg/storage/driver/cfgmaps_test.go +++ b/pkg/storage/driver/cfgmaps_test.go @@ -85,8 +85,8 @@ func TestUNcompressedConfigMapGet(t *testing.T) { func TestConfigMapList(t *testing.T) { cfgmaps := newTestFixtureCfgMaps(t, []*rspb.Release{ - releaseStub("key-1", 1, "default", rspb.StatusDeleted), - releaseStub("key-2", 1, "default", rspb.StatusDeleted), + releaseStub("key-1", 1, "default", rspb.StatusUninstalled), + releaseStub("key-2", 1, "default", rspb.StatusUninstalled), releaseStub("key-3", 1, "default", rspb.StatusDeployed), releaseStub("key-4", 1, "default", rspb.StatusDeployed), releaseStub("key-5", 1, "default", rspb.StatusSuperseded), @@ -95,7 +95,7 @@ func TestConfigMapList(t *testing.T) { // list all deleted releases del, err := cfgmaps.List(func(rel *rspb.Release) bool { - return rel.Info.Status == rspb.StatusDeleted + return rel.Info.Status == rspb.StatusUninstalled }) // check if err != nil { diff --git a/pkg/storage/driver/memory_test.go b/pkg/storage/driver/memory_test.go index cfbab5a11..2b94c1bb4 100644 --- a/pkg/storage/driver/memory_test.go +++ b/pkg/storage/driver/memory_test.go @@ -123,7 +123,7 @@ func TestMemoryUpdate(t *testing.T) { { "update release does not exist", "rls-z.v1", - releaseStub("rls-z", 1, "default", rspb.StatusDeleted), + releaseStub("rls-z", 1, "default", rspb.StatusUninstalled), true, }, } diff --git a/pkg/storage/driver/secrets_test.go b/pkg/storage/driver/secrets_test.go index 6596753a8..bd205d8fb 100644 --- a/pkg/storage/driver/secrets_test.go +++ b/pkg/storage/driver/secrets_test.go @@ -85,8 +85,8 @@ func TestUNcompressedSecretGet(t *testing.T) { func TestSecretList(t *testing.T) { secrets := newTestFixtureSecrets(t, []*rspb.Release{ - releaseStub("key-1", 1, "default", rspb.StatusDeleted), - releaseStub("key-2", 1, "default", rspb.StatusDeleted), + releaseStub("key-1", 1, "default", rspb.StatusUninstalled), + releaseStub("key-2", 1, "default", rspb.StatusUninstalled), releaseStub("key-3", 1, "default", rspb.StatusDeployed), releaseStub("key-4", 1, "default", rspb.StatusDeployed), releaseStub("key-5", 1, "default", rspb.StatusSuperseded), @@ -95,7 +95,7 @@ func TestSecretList(t *testing.T) { // list all deleted releases del, err := secrets.List(func(rel *rspb.Release) bool { - return rel.Info.Status == rspb.StatusDeleted + return rel.Info.Status == rspb.StatusUninstalled }) // check if err != nil { diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index dadc30e8b..a5c7d5686 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -82,12 +82,12 @@ func (s *Storage) ListReleases() ([]*rspb.Release, error) { return s.Driver.List(func(_ *rspb.Release) bool { return true }) } -// ListDeleted returns all releases with Status == DELETED. An error is returned +// ListUninstalled returns all releases with Status == UNINSTALLED. An error is returned // if the storage backend fails to retrieve the releases. -func (s *Storage) ListDeleted() ([]*rspb.Release, error) { - s.Log("listing deleted releases in storage") +func (s *Storage) ListUninstalled() ([]*rspb.Release, error) { + s.Log("listing uninstalled releases in storage") return s.Driver.List(func(rls *rspb.Release) bool { - return relutil.StatusFilter(rspb.StatusDeleted).Check(rls) + return relutil.StatusFilter(rspb.StatusUninstalled).Check(rls) }) } diff --git a/pkg/storage/storage_test.go b/pkg/storage/storage_test.go index b5ba429b4..c14387d5f 100644 --- a/pkg/storage/storage_test.go +++ b/pkg/storage/storage_test.go @@ -61,7 +61,7 @@ func TestStorageUpdate(t *testing.T) { assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease") // modify the release - rls.Info.Status = rspb.StatusDeleted + rls.Info.Status = rspb.StatusUninstalled assertErrNil(t.Fatal, storage.Update(rls), "UpdateRelease") // retrieve the updated release @@ -127,8 +127,8 @@ func TestStorageList(t *testing.T) { rls2 := ReleaseTestData{Name: "relaxed-cat", Status: rspb.StatusSuperseded}.ToRelease() rls3 := ReleaseTestData{Name: "hungry-hippo", Status: rspb.StatusDeployed}.ToRelease() rls4 := ReleaseTestData{Name: "angry-beaver", Status: rspb.StatusDeployed}.ToRelease() - rls5 := ReleaseTestData{Name: "opulent-frog", Status: rspb.StatusDeleted}.ToRelease() - rls6 := ReleaseTestData{Name: "happy-liger", Status: rspb.StatusDeleted}.ToRelease() + rls5 := ReleaseTestData{Name: "opulent-frog", Status: rspb.StatusUninstalled}.ToRelease() + rls6 := ReleaseTestData{Name: "happy-liger", Status: rspb.StatusUninstalled}.ToRelease() // create the release records in the storage assertErrNil(t.Fatal, storage.Create(rls0), "Storing release 'rls0'") @@ -145,9 +145,9 @@ func TestStorageList(t *testing.T) { NumExpected int ListFunc func() ([]*rspb.Release, error) }{ - {"ListDeleted", 2, storage.ListDeleted}, {"ListDeployed", 2, storage.ListDeployed}, {"ListReleases", 7, storage.ListReleases}, + {"ListUninstalled", 2, storage.ListUninstalled}, } setup() diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 3f067ac47..d84184175 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -314,7 +314,7 @@ func TestInstallRelease_ReuseName(t *testing.T) { rs := rsFixture(t) rs.Log = t.Logf rel := releaseStub() - rel.Info.Status = release.StatusDeleted + rel.Info.Status = release.StatusUninstalled rs.Releases.Create(rel) req := installRequest( diff --git a/pkg/tiller/release_list_test.go b/pkg/tiller/release_list_test.go index c31da8905..9bf282766 100644 --- a/pkg/tiller/release_list_test.go +++ b/pkg/tiller/release_list_test.go @@ -49,7 +49,7 @@ func TestListReleasesByStatus(t *testing.T) { rs := rsFixture(t) stubs := []*release.Release{ namedReleaseStub("kamal", release.StatusDeployed), - namedReleaseStub("astrolabe", release.StatusDeleted), + namedReleaseStub("astrolabe", release.StatusUninstalled), namedReleaseStub("octant", release.StatusFailed), namedReleaseStub("sextant", release.StatusUnknown), } @@ -69,7 +69,7 @@ func TestListReleasesByStatus(t *testing.T) { }, { names: []string{"astrolabe"}, - statusCodes: []release.ReleaseStatus{release.StatusDeleted}, + statusCodes: []release.ReleaseStatus{release.StatusUninstalled}, }, { names: []string{"kamal", "octant"}, @@ -79,7 +79,7 @@ func TestListReleasesByStatus(t *testing.T) { names: []string{"kamal", "astrolabe", "octant", "sextant"}, statusCodes: []release.ReleaseStatus{ release.StatusDeployed, - release.StatusDeleted, + release.StatusUninstalled, release.StatusFailed, release.StatusUnknown, }, diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 44c6d7bf2..a6201489e 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -177,7 +177,7 @@ func (s *ReleaseServer) uniqName(start string, reuse bool) (string, error) { relutil.Reverse(h, relutil.SortByRevision) rel := h[0] - if st := rel.Info.Status; reuse && (st == release.StatusDeleted || st == release.StatusFailed) { + if st := rel.Info.Status; reuse && (st == release.StatusUninstalled || st == release.StatusFailed) { // Allowe re-use of names if the previous release is marked deleted. s.Log("name %s exists but is not in use, reusing name", start) return start, nil diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index de2d63931..b8e34bf10 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -323,7 +323,7 @@ func TestUniqName(t *testing.T) { rel1 := releaseStub() rel2 := releaseStub() rel2.Name = "happy-panda" - rel2.Info.Status = release.StatusDeleted + rel2.Info.Status = release.StatusUninstalled rs.Releases.Create(rel1) rs.Releases.Create(rel2) diff --git a/pkg/tiller/release_status.go b/pkg/tiller/release_status.go index a2b5b1eca..49ce4d483 100644 --- a/pkg/tiller/release_status.go +++ b/pkg/tiller/release_status.go @@ -63,7 +63,7 @@ func (s *ReleaseServer) GetReleaseStatus(req *hapi.GetReleaseStatusRequest) (*ha // Ok, we got the status of the release as we had jotted down, now we need to match the // manifest we stashed away with reality from the cluster. resp, err := s.KubeClient.Get(rel.Namespace, bytes.NewBufferString(rel.Manifest)) - if sc == release.StatusDeleted || sc == release.StatusFailed { + if sc == release.StatusUninstalled || sc == release.StatusFailed { // Skip errors if this is already deleted or failed. return statusResp, nil } else if err != nil { diff --git a/pkg/tiller/release_status_test.go b/pkg/tiller/release_status_test.go index 9a578c2c6..4da39e7a8 100644 --- a/pkg/tiller/release_status_test.go +++ b/pkg/tiller/release_status_test.go @@ -43,10 +43,10 @@ func TestGetReleaseStatus(t *testing.T) { } } -func TestGetReleaseStatusDeleted(t *testing.T) { +func TestGetReleaseStatusUninstalled(t *testing.T) { rs := rsFixture(t) rel := releaseStub() - rel.Info.Status = release.StatusDeleted + rel.Info.Status = release.StatusUninstalled if err := rs.Releases.Create(rel); err != nil { t.Fatalf("Could not store mock release: %s", err) } @@ -56,7 +56,7 @@ func TestGetReleaseStatusDeleted(t *testing.T) { t.Fatalf("Error getting release content: %s", err) } - if res.Info.Status != release.StatusDeleted { - t.Errorf("Expected %s, got %s", release.StatusDeleted, res.Info.Status) + if res.Info.Status != release.StatusUninstalled { + t.Errorf("Expected %s, got %s", release.StatusUninstalled, res.Info.Status) } } diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index c3160a2ad..9abb7559c 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -30,7 +30,7 @@ import ( relutil "k8s.io/helm/pkg/releaseutil" ) -// UninstallRelease deletes all of the resources associated with this release, and marks the release DELETED. +// UninstallRelease deletes all of the resources associated with this release, and marks the release UNINSTALLED. func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*hapi.UninstallReleaseResponse, error) { if err := validateReleaseName(req.Name); err != nil { return nil, errors.Errorf("uninstall: Release name is invalid: %s", req.Name) @@ -49,7 +49,7 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha // TODO: Are there any cases where we want to force a delete even if it's // already marked deleted? - if rel.Info.Status == release.StatusDeleted { + if rel.Info.Status == release.StatusUninstalled { if req.Purge { if err := s.purgeReleases(rels...); err != nil { return nil, errors.Wrap(err, "uninstall: Failed to purge the release") @@ -60,7 +60,7 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha } s.Log("uninstall: Deleting %s", req.Name) - rel.Info.Status = release.StatusDeleting + rel.Info.Status = release.StatusUninstalling rel.Info.Deleted = time.Now() rel.Info.Description = "Deletion in progress (or silently failed)" res := &hapi.UninstallReleaseResponse{Release: rel} @@ -73,7 +73,7 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha s.Log("delete hooks disabled for %s", req.Name) } - // From here on out, the release is currently considered to be in StatusDeleting + // From here on out, the release is currently considered to be in StatusUninstalling // state. if err := s.Releases.Update(rel); err != nil { s.Log("uninstall: Failed to store updated release: %s", err) @@ -88,8 +88,8 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha } } - rel.Info.Status = release.StatusDeleted - rel.Info.Description = "Deletion complete" + rel.Info.Status = release.StatusUninstalled + rel.Info.Description = "Uninstallation complete" if req.Purge { s.Log("purge requested for %s", req.Name) @@ -102,7 +102,7 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha } if len(errs) > 0 { - return res, errors.Errorf("deletion completed with %d error(s): %s", len(errs), joinErrors(errs)) + return res, errors.Errorf("uninstallation completed with %d error(s): %s", len(errs), joinErrors(errs)) } return res, nil } diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index bc2da7110..1ca93109a 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -41,8 +41,8 @@ func TestUninstallRelease(t *testing.T) { t.Errorf("Expected angry-panda, got %q", res.Release.Name) } - if res.Release.Info.Status != release.StatusDeleted { - t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) + if res.Release.Info.Status != release.StatusUninstalled { + t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status) } if res.Release.Hooks[0].LastRun.IsZero() { @@ -53,8 +53,8 @@ func TestUninstallRelease(t *testing.T) { t.Errorf("Expected valid UNIX date, got %d", res.Release.Info.Deleted.Second()) } - if res.Release.Info.Description != "Deletion complete" { - t.Errorf("Expected Deletion complete, got %q", res.Release.Info.Description) + if res.Release.Info.Description != "Uninstallation complete" { + t.Errorf("Expected Uninstallation complete, got %q", res.Release.Info.Description) } } @@ -80,8 +80,8 @@ func TestUninstallPurgeRelease(t *testing.T) { t.Errorf("Expected angry-panda, got %q", res.Release.Name) } - if res.Release.Info.Status != release.StatusDeleted { - t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) + if res.Release.Info.Status != release.StatusUninstalled { + t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status) } if res.Release.Info.Deleted.Second() <= 0 { @@ -138,8 +138,8 @@ func TestUninstallReleaseWithKeepPolicy(t *testing.T) { t.Errorf("Expected angry-bunny, got %q", res.Release.Name) } - if res.Release.Info.Status != release.StatusDeleted { - t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) + if res.Release.Info.Status != release.StatusUninstalled { + t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status) } if res.Info == "" { diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 3bcc9cfcf..763c49bfb 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -139,7 +139,7 @@ func (s *ReleaseServer) prepareUpdate(req *hapi.UpdateReleaseRequest) (*release. return currentRelease, updatedRelease, err } -// performUpdateForce performs the same action as a `helm delete && helm install --replace`. +// performUpdateForce performs the same action as a `helm uninstall && helm install --replace`. func (s *ReleaseServer) performUpdateForce(req *hapi.UpdateReleaseRequest) (*release.Release, error) { // find the last release with the given name oldRelease, err := s.Releases.Last(req.Name) @@ -167,9 +167,9 @@ func (s *ReleaseServer) performUpdateForce(req *hapi.UpdateReleaseRequest) (*rel return newRelease, errors.Wrap(err, "failed update prepare step") } - // From here on out, the release is considered to be in StatusDeleting or StatusDeleted + // From here on out, the release is considered to be in StatusUninstalling or StatusUninstalled // state. There is no turning back. - oldRelease.Info.Status = release.StatusDeleting + oldRelease.Info.Status = release.StatusUninstalling oldRelease.Info.Deleted = time.Now() oldRelease.Info.Description = "Deletion in progress (or silently failed)" s.recordRelease(oldRelease, true) @@ -186,12 +186,12 @@ func (s *ReleaseServer) performUpdateForce(req *hapi.UpdateReleaseRequest) (*rel // delete manifests from the old release _, errs := s.deleteRelease(oldRelease) - oldRelease.Info.Status = release.StatusDeleted - oldRelease.Info.Description = "Deletion complete" + oldRelease.Info.Status = release.StatusUninstalled + oldRelease.Info.Description = "Uninstallation complete" s.recordRelease(oldRelease, true) if len(errs) > 0 { - return newRelease, errors.Errorf("upgrade --force successfully deleted the previous release, but encountered %d error(s) and cannot continue: %s", len(errs), joinErrors(errs)) + return newRelease, errors.Errorf("upgrade --force successfully uninstalled the previous release, but encountered %d error(s) and cannot continue: %s", len(errs), joinErrors(errs)) } // post-delete hooks diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index 5cd25eb5c..08a119ff2 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -366,7 +366,7 @@ func TestUpdateReleaseFailure_Force(t *testing.T) { if err != nil { t.Errorf("Expected to be able to get previous release") } - if oldStatus := oldRelease.Info.Status; oldStatus != release.StatusDeleted { + if oldStatus := oldRelease.Info.Status; oldStatus != release.StatusUninstalled { t.Errorf("Expected Deleted status on previous Release version. Got %v", oldStatus) } } diff --git a/scripts/completions.bash b/scripts/completions.bash index c24f3d257..ededbb791 100644 --- a/scripts/completions.bash +++ b/scripts/completions.bash @@ -904,10 +904,10 @@ _helm_list() flags+=("--date") flags+=("-d") local_nonpersistent_flags+=("--date") - flags+=("--deleted") - local_nonpersistent_flags+=("--deleted") - flags+=("--deleting") - local_nonpersistent_flags+=("--deleting") + flags+=("--uninstalled") + local_nonpersistent_flags+=("--uninstalled") + flags+=("--uninstalling") + local_nonpersistent_flags+=("--uninstalling") flags+=("--deployed") local_nonpersistent_flags+=("--deployed") flags+=("--failed")