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.
pull/4224/head
Matthew Fisher 7 years ago
parent 23a0d4e08c
commit 195d21d5d7
No known key found for this signature in database
GPG Key ID: 92AA783CBAAE8E3B

@ -34,8 +34,8 @@ var listHelp = `
This command lists all of the releases. This command lists all of the releases.
By default, it lists only releases that are deployed or failed. Flags like 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: '--uninstalled' and '--all' will alter this behavior. Such flags can be combined:
'--deleted --failed'. '--uninstalled --failed'.
By default, items are sorted alphabetically. Use the '-d' flag to sort by By default, items are sorted alphabetically. Use the '-d' flag to sort by
release date. release date.
@ -63,8 +63,8 @@ type listOptions struct {
allNamespaces bool // --all-namespaces allNamespaces bool // --all-namespaces
byDate bool // --date byDate bool // --date
colWidth uint // --col-width colWidth uint // --col-width
deleted bool // --deleted uninstalled bool // --uninstalled
deleting bool // --deleting uninstalling bool // --uninstalling
deployed bool // --deployed deployed bool // --deployed
failed bool // --failed failed bool // --failed
limit int // --max 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.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.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.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.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.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.failed, "failed", false, "show failed releases")
f.BoolVar(&o.pending, "pending", false, "show pending releases") f.BoolVar(&o.pending, "pending", false, "show pending releases")
@ -188,8 +188,8 @@ func (o *listOptions) statusCodes() []release.ReleaseStatus {
return []release.ReleaseStatus{ return []release.ReleaseStatus{
release.StatusUnknown, release.StatusUnknown,
release.StatusDeployed, release.StatusDeployed,
release.StatusDeleted, release.StatusUninstalled,
release.StatusDeleting, release.StatusUninstalling,
release.StatusFailed, release.StatusFailed,
release.StatusPendingInstall, release.StatusPendingInstall,
release.StatusPendingUpgrade, release.StatusPendingUpgrade,
@ -200,11 +200,11 @@ func (o *listOptions) statusCodes() []release.ReleaseStatus {
if o.deployed { if o.deployed {
status = append(status, release.StatusDeployed) status = append(status, release.StatusDeployed)
} }
if o.deleted { if o.uninstalled {
status = append(status, release.StatusDeleted) status = append(status, release.StatusUninstalled)
} }
if o.deleting { if o.uninstalling {
status = append(status, release.StatusDeleting) status = append(status, release.StatusUninstalling)
} }
if o.failed { if o.failed {
status = append(status, release.StatusFailed) status = append(status, release.StatusFailed)

@ -48,9 +48,9 @@ func TestListCmd(t *testing.T) {
golden: "output/list-with-failed.txt", golden: "output/list-with-failed.txt",
}, { }, {
name: "with a release, multiple flags", name: "with a release, multiple flags",
cmd: "list --deleted --deployed --failed -q", cmd: "list --uninstalled --deployed --failed -q",
rels: []*release.Release{ 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}), 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 // 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", name: "with a release, multiple flags",
cmd: "list --all -q", cmd: "list --all -q",
rels: []*release.Release{ 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}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
}, },
// See note on previous test. // See note on previous test.
@ -69,7 +69,7 @@ func TestListCmd(t *testing.T) {
name: "with a release, multiple flags, deleting", name: "with a release, multiple flags, deleting",
cmd: "list --all -q", cmd: "list --all -q",
rels: []*release.Release{ 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}), helm.ReleaseMock(&helm.MockReleaseOptions{Name: "atlas-guide", Status: release.StatusDeployed}),
}, },
// See note on previous test. // See note on previous test.

@ -71,7 +71,6 @@ func newRootCmd(c helm.Interface, out io.Writer, args []string) *cobra.Command {
newVerifyCmd(out), newVerifyCmd(out),
// release commands // release commands
newDeleteCmd(c, out),
newGetCmd(c, out), newGetCmd(c, out),
newHistoryCmd(c, out), newHistoryCmd(c, out),
newInstallCmd(c, out), newInstallCmd(c, out),
@ -79,6 +78,7 @@ func newRootCmd(c helm.Interface, out io.Writer, args []string) *cobra.Command {
newReleaseTestCmd(c, out), newReleaseTestCmd(c, out),
newRollbackCmd(c, out), newRollbackCmd(c, out),
newStatusCmd(c, out), newStatusCmd(c, out),
newUninstallCmd(c, out),
newUpgradeCmd(c, out), newUpgradeCmd(c, out),
newCompletionCmd(out), newCompletionCmd(out),

@ -1,3 +0,0 @@
Error: "helm delete" requires at least 1 argument
Usage: helm delete RELEASE_NAME [...] [flags]

@ -1 +0,0 @@
release "aeneas" deleted

@ -1 +0,0 @@
release "aeneas" deleted

@ -1 +0,0 @@
release "aeneas" deleted

@ -1 +0,0 @@
release "aeneas" deleted

@ -0,0 +1,3 @@
Error: "helm uninstall" requires at least 1 argument
Usage: helm uninstall RELEASE_NAME [...] [flags]

@ -0,0 +1 @@
release "aeneas" uninstalled

@ -0,0 +1 @@
release "aeneas" uninstalled

@ -0,0 +1 @@
release "aeneas" uninstalled

@ -0,0 +1 @@
release "aeneas" uninstalled

@ -26,15 +26,15 @@ import (
"k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm"
) )
const deleteDesc = ` const uninstallDesc = `
This command takes a release name, and then deletes the release from Kubernetes. 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. 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 Use the '--dry-run' flag to see which releases will be uninstalled without actually
deleting them. uninstalling them.
` `
type deleteOptions struct { type uninstallOptions struct {
disableHooks bool // --no-hooks disableHooks bool // --no-hooks
dryRun bool // --dry-run dryRun bool // --dry-run
purge bool // --purge purge bool // --purge
@ -46,15 +46,15 @@ type deleteOptions struct {
client helm.Interface client helm.Interface
} }
func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { func newUninstallCmd(c helm.Interface, out io.Writer) *cobra.Command {
o := &deleteOptions{client: c} o := &uninstallOptions{client: c}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "delete RELEASE_NAME [...]", Use: "uninstall RELEASE_NAME [...]",
Aliases: []string{"del"}, Aliases: []string{"del", "delete", "un"},
SuggestFor: []string{"remove", "rm"}, SuggestFor: []string{"remove", "rm"},
Short: "given a release name, delete the release from Kubernetes", Short: "given a release name, uninstall the release from Kubernetes",
Long: deleteDesc, Long: uninstallDesc,
Args: require.MinimumNArgs(1), Args: require.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
o.client = ensureHelmClient(o.client, false) o.client = ensureHelmClient(o.client, false)
@ -65,29 +65,29 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command {
return err return err
} }
fmt.Fprintf(out, "release \"%s\" deleted\n", o.name) fmt.Fprintf(out, "release \"%s\" uninstalled\n", o.name)
} }
return nil return nil
}, },
} }
f := cmd.Flags() f := cmd.Flags()
f.BoolVar(&o.dryRun, "dry-run", false, "simulate a delete") f.BoolVar(&o.dryRun, "dry-run", false, "simulate a uninstall")
f.BoolVar(&o.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") 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.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)") f.Int64Var(&o.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)")
return cmd return cmd
} }
func (o *deleteOptions) run(out io.Writer) error { func (o *uninstallOptions) run(out io.Writer) error {
opts := []helm.DeleteOption{ opts := []helm.UninstallOption{
helm.DeleteDryRun(o.dryRun), helm.UninstallDryRun(o.dryRun),
helm.DeleteDisableHooks(o.disableHooks), helm.UninstallDisableHooks(o.disableHooks),
helm.DeletePurge(o.purge), helm.UninstallPurge(o.purge),
helm.DeleteTimeout(o.timeout), 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 != "" { if res != nil && res.Info != "" {
fmt.Fprintln(out, res.Info) fmt.Fprintln(out, res.Info)
} }

@ -23,39 +23,39 @@ import (
"k8s.io/helm/pkg/helm" "k8s.io/helm/pkg/helm"
) )
func TestDelete(t *testing.T) { func TestUninstall(t *testing.T) {
rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})} rels := []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}
tests := []cmdTestCase{ tests := []cmdTestCase{
{ {
name: "basic delete", name: "basic uninstall",
cmd: "delete aeneas", cmd: "uninstall aeneas",
golden: "output/delete.txt", golden: "output/uninstall.txt",
rels: rels, rels: rels,
}, },
{ {
name: "delete with timeout", name: "uninstall with timeout",
cmd: "delete aeneas --timeout 120", cmd: "uninstall aeneas --timeout 120",
golden: "output/delete-timeout.txt", golden: "output/uninstall-timeout.txt",
rels: rels, rels: rels,
}, },
{ {
name: "delete without hooks", name: "uninstall without hooks",
cmd: "delete aeneas --no-hooks", cmd: "uninstall aeneas --no-hooks",
golden: "output/delete-no-hooks.txt", golden: "output/uninstall-no-hooks.txt",
rels: rels, rels: rels,
}, },
{ {
name: "purge", name: "purge",
cmd: "delete aeneas --purge", cmd: "uninstall aeneas --purge",
golden: "output/delete-purge.txt", golden: "output/uninstall-purge.txt",
rels: rels, rels: rels,
}, },
{ {
name: "delete without release", name: "uninstall without release",
cmd: "delete", cmd: "uninstall",
golden: "output/delete-no-args.txt", golden: "output/uninstall-no-args.txt",
wantError: true, wantError: true,
}, },
} }

@ -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. 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 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.

@ -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 From there on, we can see that the YAML data is exactly what we put in our
`configmap.yaml` file. `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 ### Adding a Simple Template Call

@ -94,7 +94,7 @@ release. Once Tiller verifies that the hook has reached its ready state, it
will leave the hook resource alone. will leave the hook resource alone.
Practically speaking, this means that if you create resources in a hook, you 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` 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. 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. * `"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. * `"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. 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.

@ -160,11 +160,11 @@ spec:
See also the `helm upgrade --recreate-pods` flag for a slightly See also the `helm upgrade --recreate-pods` flag for a slightly
different way of addressing this issue. 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 Sometimes there are resources that should not be uninstalled when Helm runs a
`helm delete`. Chart developers can add an annotation to a resource to prevent `helm uninstall`. Chart developers can add an annotation to a resource to prevent
it from being deleted. it from being uninstalled.
```yaml ```yaml
kind: Secret kind: Secret
@ -177,9 +177,9 @@ metadata:
(Quotation marks are required) (Quotation marks are required)
The annotation `"helm.sh/resource-policy": keep` instructs Tiller to skip this 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 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. has kept resources.
## Using "Partials" and Template Includes ## Using "Partials" and Template Includes

@ -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?** **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 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?** **Q: I want to delete my local Helm. Where are all its files?**

@ -107,10 +107,10 @@ The `helm list` function will show you a list of all deployed releases.
## Uninstall a Release ## Uninstall a Release
To uninstall a release, use the `helm delete` command: To uninstall a release, use the `helm uninstall` command:
```console ```console
$ helm delete smiling-penguin $ helm uninstall smiling-penguin
Removed smiling-penguin Removed smiling-penguin
``` ```
@ -119,11 +119,11 @@ still be able to request information about that release:
```console ```console
$ helm status smiling-penguin $ 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 can audit a cluster's history, and even undelete a release (with `helm
rollback`). rollback`).

@ -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 will cause all pods to be recreated (with the exception of pods belonging to
deployments) 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 When it is time to uninstall or uninstall a release from the cluster, use
the `helm delete` command: 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 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 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 However, Helm always keeps records of what releases happened. Need to
see the deleted releases? `helm list --deleted` shows those, and `helm see the uninstalled releases? `helm list --uninstalled` shows those, and `helm
list --all` shows all of the releases (deleted and currently deployed, list --all` shows all of the releases (uninstalled and currently deployed,
as well as releases that failed): as well as releases that failed):
```console ```console
⇒ helm list --all ⇒ helm list --all
NAME VERSION UPDATED STATUS CHART 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 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 Because Helm keeps records of uninstalled releases, a release name cannot
re-used. (If you _really_ need to re-use a release name, you can use the be re-used. (If you _really_ need to re-use a release name, you can use
`--replace` flag, but it will simply re-use the existing release and the `--replace` flag, but it will simply re-use the existing release and
replace its resources.) replace its resources.)
Note that because releases are preserved in this way, you can rollback a 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 ## '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 ## Conclusion
This chapter has covered the basic usage patterns of the `helm` client, 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 covered useful utility commands like `helm status`, `helm get`, and
`helm repo`. `helm repo`.

@ -22,14 +22,14 @@ const (
StatusUnknown ReleaseStatus = "unknown" StatusUnknown ReleaseStatus = "unknown"
// StatusDeployed indicates that the release has been pushed to Kubernetes. // StatusDeployed indicates that the release has been pushed to Kubernetes.
StatusDeployed ReleaseStatus = "deployed" StatusDeployed ReleaseStatus = "deployed"
// StatusDeleted indicates that a release has been deleted from Kubermetes. // StatusUninstalled indicates that a release has been uninstalled from Kubermetes.
StatusDeleted ReleaseStatus = "deleted" StatusUninstalled ReleaseStatus = "uninstalled"
// StatusSuperseded indicates that this release object is outdated and a newer one exists. // StatusSuperseded indicates that this release object is outdated and a newer one exists.
StatusSuperseded ReleaseStatus = "superseded" StatusSuperseded ReleaseStatus = "superseded"
// StatusFailed indicates that the release was not successfully deployed. // StatusFailed indicates that the release was not successfully deployed.
StatusFailed ReleaseStatus = "failed" StatusFailed ReleaseStatus = "failed"
// StatusDeleting indicates that a delete operation is underway. // StatusUninstalling indicates that a uninstall operation is underway.
StatusDeleting ReleaseStatus = "deleting" StatusUninstalling ReleaseStatus = "uninstalling"
// StatusPendingInstall indicates that an install operation is underway. // StatusPendingInstall indicates that an install operation is underway.
StatusPendingInstall ReleaseStatus = "pending-install" StatusPendingInstall ReleaseStatus = "pending-install"
// StatusPendingUpgrade indicates that an upgrade operation is underway. // StatusPendingUpgrade indicates that an upgrade operation is underway.

@ -106,8 +106,8 @@ func (c *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...
return c.tiller.InstallRelease(req) return c.tiller.InstallRelease(req)
} }
// DeleteRelease uninstalls a named release and returns the response. // UninstallRelease uninstalls a named release and returns the response.
func (c *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error) { func (c *Client) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error) {
// apply the uninstall options // apply the uninstall options
reqOpts := c.opts reqOpts := c.opts
for _, opt := range opts { for _, opt := range opts {

@ -77,8 +77,8 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts
return release, nil return release, nil
} }
// DeleteRelease deletes a release from the FakeClient // UninstallRelease uninstalls a release from the FakeClient
func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*hapi.UninstallReleaseResponse, error) { func (c *FakeClient) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error) {
for i, rel := range c.Rels { for i, rel := range c.Rels {
if rel.Name == rlsName { if rel.Name == rlsName {
c.Rels = append(c.Rels[:i], c.Rels[i+1:]...) c.Rels = append(c.Rels[:i], c.Rels[i+1:]...)

@ -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 { type fields struct {
Rels []*release.Release Rels []*release.Release
} }
type args struct { type args struct {
rlsName string rlsName string
opts []DeleteOption opts []UninstallOption
} }
tests := []struct { tests := []struct {
name string name string
@ -199,7 +199,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
wantErr bool wantErr bool
}{ }{
{ {
name: "Delete a release that exists.", name: "Uninstall a release that exists.",
fields: fields{ fields: fields{
Rels: []*release.Release{ Rels: []*release.Release{
ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}),
@ -208,7 +208,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
}, },
args: args{ args: args{
rlsName: "trepid-tapir", rlsName: "trepid-tapir",
opts: []DeleteOption{}, opts: []UninstallOption{},
}, },
relsAfter: []*release.Release{ relsAfter: []*release.Release{
ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}),
@ -219,7 +219,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
wantErr: false, wantErr: false,
}, },
{ {
name: "Delete a release that does not exist.", name: "Uninstall a release that does not exist.",
fields: fields{ fields: fields{
Rels: []*release.Release{ Rels: []*release.Release{
ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}),
@ -228,7 +228,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
}, },
args: args{ args: args{
rlsName: "release-that-does-not-exists", rlsName: "release-that-does-not-exists",
opts: []DeleteOption{}, opts: []UninstallOption{},
}, },
relsAfter: []*release.Release{ relsAfter: []*release.Release{
ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}), ReleaseMock(&MockReleaseOptions{Name: "angry-dolphin"}),
@ -238,7 +238,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
wantErr: true, wantErr: true,
}, },
{ {
name: "Delete when only 1 item exists.", name: "Uninstall when only 1 item exists.",
fields: fields{ fields: fields{
Rels: []*release.Release{ Rels: []*release.Release{
ReleaseMock(&MockReleaseOptions{Name: "trepid-tapir"}), ReleaseMock(&MockReleaseOptions{Name: "trepid-tapir"}),
@ -246,7 +246,7 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
}, },
args: args{ args: args{
rlsName: "trepid-tapir", rlsName: "trepid-tapir",
opts: []DeleteOption{}, opts: []UninstallOption{},
}, },
relsAfter: []*release.Release{}, relsAfter: []*release.Release{},
want: &hapi.UninstallReleaseResponse{ want: &hapi.UninstallReleaseResponse{
@ -260,13 +260,13 @@ func TestFakeClient_DeleteRelease(t *testing.T) {
c := &FakeClient{ c := &FakeClient{
Rels: tt.fields.Rels, 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 { 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 return
} }
if !reflect.DeepEqual(got, tt.want) { 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) { if !reflect.DeepEqual(c.Rels, tt.relsAfter) {

@ -45,7 +45,7 @@ func TestListReleases_VerifyOptions(t *testing.T) {
var sortOrd = hapi.SortAsc var sortOrd = hapi.SortAsc
var codes = []rls.ReleaseStatus{ var codes = []rls.ReleaseStatus{
rls.StatusFailed, rls.StatusFailed,
rls.StatusDeleted, rls.StatusUninstalled,
rls.StatusDeployed, rls.StatusDeployed,
rls.StatusSuperseded, rls.StatusSuperseded,
} }
@ -143,27 +143,27 @@ func TestInstallRelease_VerifyOptions(t *testing.T) {
assert(t, "", client.opts.instReq.Name) assert(t, "", client.opts.instReq.Name)
} }
// Verify each DeleteOptions is applied to an UninstallReleaseRequest correctly. // Verify each UninstallOptions is applied to an UninstallReleaseRequest correctly.
func TestDeleteRelease_VerifyOptions(t *testing.T) { func TestUninstallRelease_VerifyOptions(t *testing.T) {
// Options testdata // Options testdata
var releaseName = "test" var releaseName = "test"
var disableHooks = true var disableHooks = true
var purgeFlag = true var purgeFlag = true
// Expected DeleteReleaseRequest message // Expected UninstallReleaseRequest message
exp := &hapi.UninstallReleaseRequest{ exp := &hapi.UninstallReleaseRequest{
Name: releaseName, Name: releaseName,
Purge: purgeFlag, Purge: purgeFlag,
DisableHooks: disableHooks, DisableHooks: disableHooks,
} }
// Options used in DeleteRelease // Options used in UninstallRelease
ops := []DeleteOption{ ops := []UninstallOption{
DeletePurge(purgeFlag), UninstallPurge(purgeFlag),
DeleteDisableHooks(disableHooks), UninstallDisableHooks(disableHooks),
} }
// BeforeCall option to intercept Helm client DeleteReleaseRequest // BeforeCall option to intercept Helm client UninstallReleaseRequest
b4c := BeforeCall(func(msg interface{}) error { b4c := BeforeCall(func(msg interface{}) error {
switch act := msg.(type) { switch act := msg.(type) {
case *hapi.UninstallReleaseRequest: case *hapi.UninstallReleaseRequest:
@ -176,7 +176,7 @@ func TestDeleteRelease_VerifyOptions(t *testing.T) {
}) })
client := NewClient(b4c) 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) t.Fatalf("did not expect error but got (%v)\n``", err)
} }

@ -27,7 +27,7 @@ type Interface interface {
ListReleases(opts ...ReleaseListOption) ([]*release.Release, error) ListReleases(opts ...ReleaseListOption) ([]*release.Release, error)
InstallRelease(chStr, namespace string, opts ...InstallOption) (*release.Release, error) InstallRelease(chStr, namespace string, opts ...InstallOption) (*release.Release, error)
InstallReleaseFromChart(chart *chart.Chart, 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) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error)
UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error) UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error)
UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error)

@ -37,7 +37,7 @@ type options struct {
reuseName bool reuseName bool
// if set, performs pod restart during upgrade/rollback // if set, performs pod restart during upgrade/rollback
recreate bool recreate bool
// if set, force resource update through delete/recreate if needed // if set, force resource update through uninstall/recreate if needed
force bool force bool
// if set, skip running hooks // if set, skip running hooks
disableHooks bool disableHooks bool
@ -170,8 +170,8 @@ func UpgradeTimeout(timeout int64) UpdateOption {
} }
} }
// DeleteTimeout specifies the number of seconds before kubernetes calls timeout // UninstallTimeout specifies the number of seconds before kubernetes calls timeout
func DeleteTimeout(timeout int64) DeleteOption { func UninstallTimeout(timeout int64) UninstallOption {
return func(opts *options) { return func(opts *options) {
opts.uninstallReq.Timeout = timeout opts.uninstallReq.Timeout = timeout
} }
@ -226,22 +226,22 @@ func UpdateValueOverrides(raw []byte) UpdateOption {
} }
} }
// DeleteDisableHooks will disable hooks for a deletion operation. // UninstallDisableHooks will disable hooks for a deletion operation.
func DeleteDisableHooks(disable bool) DeleteOption { func UninstallDisableHooks(disable bool) UninstallOption {
return func(opts *options) { return func(opts *options) {
opts.disableHooks = disable opts.disableHooks = disable
} }
} }
// DeleteDryRun will (if true) execute a deletion as a dry run. // UninstallDryRun will (if true) execute a deletion as a dry run.
func DeleteDryRun(dry bool) DeleteOption { func UninstallDryRun(dry bool) UninstallOption {
return func(opts *options) { return func(opts *options) {
opts.dryRun = dry opts.dryRun = dry
} }
} }
// DeletePurge removes the release from the store and make its name free for later use. // UninstallPurge removes the release from the store and make its name free for later use.
func DeletePurge(purge bool) DeleteOption { func UninstallPurge(purge bool) UninstallOption {
return func(opts *options) { return func(opts *options) {
opts.uninstallReq.Purge = purge 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 { func RollbackForce(force bool) RollbackOption {
return func(opts *options) { return func(opts *options) {
opts.force = force 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 { func UpgradeForce(force bool) UpdateOption {
return func(opts *options) { return func(opts *options) {
opts.force = force opts.force = force
} }
} }
// DeleteOption allows setting optional attributes when // UninstallOption allows setting optional attributes when
// performing a UninstallRelease tiller rpc. // performing a UninstallRelease tiller rpc.
type DeleteOption func(*options) type UninstallOption func(*options)
// UpdateOption allows specifying various settings // UpdateOption allows specifying various settings
// configurable by the helm client user for overriding // configurable by the helm client user for overriding

@ -23,24 +23,24 @@ import (
) )
func TestFilterAny(t *testing.T) { func TestFilterAny(t *testing.T) {
ls := Any(StatusFilter(rspb.StatusDeleted)).Filter(releases) ls := Any(StatusFilter(rspb.StatusUninstalled)).Filter(releases)
if len(ls) != 2 { if len(ls) != 2 {
t.Fatalf("expected 2 results, got '%d'", len(ls)) t.Fatalf("expected 2 results, got '%d'", len(ls))
} }
r0, r1 := ls[0], ls[1] r0, r1 := ls[0], ls[1]
switch { switch {
case r0.Info.Status != rspb.StatusDeleted: case r0.Info.Status != rspb.StatusUninstalled:
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.String()) t.Fatalf("expected UNINSTALLED result, got '%s'", r1.Info.Status.String())
case r1.Info.Status != rspb.StatusDeleted: case r1.Info.Status != rspb.StatusUninstalled:
t.Fatalf("expected DELETED result, got '%s'", r1.Info.Status.String()) t.Fatalf("expected UNINSTALLED result, got '%s'", r1.Info.Status.String())
} }
} }
func TestFilterAll(t *testing.T) { func TestFilterAll(t *testing.T) {
fn := FilterFunc(func(rls *rspb.Release) bool { fn := FilterFunc(func(rls *rspb.Release) bool {
// true if not deleted and version < 4 // true if not uninstalled and version < 4
v0 := !StatusFilter(rspb.StatusDeleted).Check(rls) v0 := !StatusFilter(rspb.StatusUninstalled).Check(rls)
v1 := rls.Version < 4 v1 := rls.Version < 4
return v0 && v1 return v0 && v1
}) })
@ -53,7 +53,7 @@ func TestFilterAll(t *testing.T) {
switch r0 := ls[0]; { switch r0 := ls[0]; {
case r0.Version == 4: case r0.Version == 4:
t.Fatal("got release with status revision 4") t.Fatal("got release with status revision 4")
case r0.Info.Status == rspb.StatusDeleted: case r0.Info.Status == rspb.StatusUninstalled:
t.Fatal("got release with status DELTED") t.Fatal("got release with status UNINSTALLED")
} }
} }

@ -28,8 +28,8 @@ import (
var releases = []*rspb.Release{ var releases = []*rspb.Release{
tsRelease("quiet-bear", 2, 2000, rspb.StatusSuperseded), tsRelease("quiet-bear", 2, 2000, rspb.StatusSuperseded),
tsRelease("angry-bird", 4, 3000, rspb.StatusDeployed), tsRelease("angry-bird", 4, 3000, rspb.StatusDeployed),
tsRelease("happy-cats", 1, 4000, rspb.StatusDeleted), tsRelease("happy-cats", 1, 4000, rspb.StatusUninstalled),
tsRelease("vocal-dogs", 3, 6000, rspb.StatusDeleted), tsRelease("vocal-dogs", 3, 6000, rspb.StatusUninstalled),
} }
func tsRelease(name string, vers int, dur time.Duration, status rspb.ReleaseStatus) *rspb.Release { func tsRelease(name string, vers int, dur time.Duration, status rspb.ReleaseStatus) *rspb.Release {

@ -85,8 +85,8 @@ func TestUNcompressedConfigMapGet(t *testing.T) {
func TestConfigMapList(t *testing.T) { func TestConfigMapList(t *testing.T) {
cfgmaps := newTestFixtureCfgMaps(t, []*rspb.Release{ cfgmaps := newTestFixtureCfgMaps(t, []*rspb.Release{
releaseStub("key-1", 1, "default", rspb.StatusDeleted), releaseStub("key-1", 1, "default", rspb.StatusUninstalled),
releaseStub("key-2", 1, "default", rspb.StatusDeleted), releaseStub("key-2", 1, "default", rspb.StatusUninstalled),
releaseStub("key-3", 1, "default", rspb.StatusDeployed), releaseStub("key-3", 1, "default", rspb.StatusDeployed),
releaseStub("key-4", 1, "default", rspb.StatusDeployed), releaseStub("key-4", 1, "default", rspb.StatusDeployed),
releaseStub("key-5", 1, "default", rspb.StatusSuperseded), releaseStub("key-5", 1, "default", rspb.StatusSuperseded),
@ -95,7 +95,7 @@ func TestConfigMapList(t *testing.T) {
// list all deleted releases // list all deleted releases
del, err := cfgmaps.List(func(rel *rspb.Release) bool { del, err := cfgmaps.List(func(rel *rspb.Release) bool {
return rel.Info.Status == rspb.StatusDeleted return rel.Info.Status == rspb.StatusUninstalled
}) })
// check // check
if err != nil { if err != nil {

@ -123,7 +123,7 @@ func TestMemoryUpdate(t *testing.T) {
{ {
"update release does not exist", "update release does not exist",
"rls-z.v1", "rls-z.v1",
releaseStub("rls-z", 1, "default", rspb.StatusDeleted), releaseStub("rls-z", 1, "default", rspb.StatusUninstalled),
true, true,
}, },
} }

@ -85,8 +85,8 @@ func TestUNcompressedSecretGet(t *testing.T) {
func TestSecretList(t *testing.T) { func TestSecretList(t *testing.T) {
secrets := newTestFixtureSecrets(t, []*rspb.Release{ secrets := newTestFixtureSecrets(t, []*rspb.Release{
releaseStub("key-1", 1, "default", rspb.StatusDeleted), releaseStub("key-1", 1, "default", rspb.StatusUninstalled),
releaseStub("key-2", 1, "default", rspb.StatusDeleted), releaseStub("key-2", 1, "default", rspb.StatusUninstalled),
releaseStub("key-3", 1, "default", rspb.StatusDeployed), releaseStub("key-3", 1, "default", rspb.StatusDeployed),
releaseStub("key-4", 1, "default", rspb.StatusDeployed), releaseStub("key-4", 1, "default", rspb.StatusDeployed),
releaseStub("key-5", 1, "default", rspb.StatusSuperseded), releaseStub("key-5", 1, "default", rspb.StatusSuperseded),
@ -95,7 +95,7 @@ func TestSecretList(t *testing.T) {
// list all deleted releases // list all deleted releases
del, err := secrets.List(func(rel *rspb.Release) bool { del, err := secrets.List(func(rel *rspb.Release) bool {
return rel.Info.Status == rspb.StatusDeleted return rel.Info.Status == rspb.StatusUninstalled
}) })
// check // check
if err != nil { if err != nil {

@ -82,12 +82,12 @@ func (s *Storage) ListReleases() ([]*rspb.Release, error) {
return s.Driver.List(func(_ *rspb.Release) bool { return true }) 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. // if the storage backend fails to retrieve the releases.
func (s *Storage) ListDeleted() ([]*rspb.Release, error) { func (s *Storage) ListUninstalled() ([]*rspb.Release, error) {
s.Log("listing deleted releases in storage") s.Log("listing uninstalled releases in storage")
return s.Driver.List(func(rls *rspb.Release) bool { return s.Driver.List(func(rls *rspb.Release) bool {
return relutil.StatusFilter(rspb.StatusDeleted).Check(rls) return relutil.StatusFilter(rspb.StatusUninstalled).Check(rls)
}) })
} }

@ -61,7 +61,7 @@ func TestStorageUpdate(t *testing.T) {
assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease") assertErrNil(t.Fatal, storage.Create(rls), "StoreRelease")
// modify the release // modify the release
rls.Info.Status = rspb.StatusDeleted rls.Info.Status = rspb.StatusUninstalled
assertErrNil(t.Fatal, storage.Update(rls), "UpdateRelease") assertErrNil(t.Fatal, storage.Update(rls), "UpdateRelease")
// retrieve the updated release // retrieve the updated release
@ -127,8 +127,8 @@ func TestStorageList(t *testing.T) {
rls2 := ReleaseTestData{Name: "relaxed-cat", Status: rspb.StatusSuperseded}.ToRelease() rls2 := ReleaseTestData{Name: "relaxed-cat", Status: rspb.StatusSuperseded}.ToRelease()
rls3 := ReleaseTestData{Name: "hungry-hippo", Status: rspb.StatusDeployed}.ToRelease() rls3 := ReleaseTestData{Name: "hungry-hippo", Status: rspb.StatusDeployed}.ToRelease()
rls4 := ReleaseTestData{Name: "angry-beaver", Status: rspb.StatusDeployed}.ToRelease() rls4 := ReleaseTestData{Name: "angry-beaver", Status: rspb.StatusDeployed}.ToRelease()
rls5 := ReleaseTestData{Name: "opulent-frog", Status: rspb.StatusDeleted}.ToRelease() rls5 := ReleaseTestData{Name: "opulent-frog", Status: rspb.StatusUninstalled}.ToRelease()
rls6 := ReleaseTestData{Name: "happy-liger", Status: rspb.StatusDeleted}.ToRelease() rls6 := ReleaseTestData{Name: "happy-liger", Status: rspb.StatusUninstalled}.ToRelease()
// create the release records in the storage // create the release records in the storage
assertErrNil(t.Fatal, storage.Create(rls0), "Storing release 'rls0'") assertErrNil(t.Fatal, storage.Create(rls0), "Storing release 'rls0'")
@ -145,9 +145,9 @@ func TestStorageList(t *testing.T) {
NumExpected int NumExpected int
ListFunc func() ([]*rspb.Release, error) ListFunc func() ([]*rspb.Release, error)
}{ }{
{"ListDeleted", 2, storage.ListDeleted},
{"ListDeployed", 2, storage.ListDeployed}, {"ListDeployed", 2, storage.ListDeployed},
{"ListReleases", 7, storage.ListReleases}, {"ListReleases", 7, storage.ListReleases},
{"ListUninstalled", 2, storage.ListUninstalled},
} }
setup() setup()

@ -314,7 +314,7 @@ func TestInstallRelease_ReuseName(t *testing.T) {
rs := rsFixture(t) rs := rsFixture(t)
rs.Log = t.Logf rs.Log = t.Logf
rel := releaseStub() rel := releaseStub()
rel.Info.Status = release.StatusDeleted rel.Info.Status = release.StatusUninstalled
rs.Releases.Create(rel) rs.Releases.Create(rel)
req := installRequest( req := installRequest(

@ -49,7 +49,7 @@ func TestListReleasesByStatus(t *testing.T) {
rs := rsFixture(t) rs := rsFixture(t)
stubs := []*release.Release{ stubs := []*release.Release{
namedReleaseStub("kamal", release.StatusDeployed), namedReleaseStub("kamal", release.StatusDeployed),
namedReleaseStub("astrolabe", release.StatusDeleted), namedReleaseStub("astrolabe", release.StatusUninstalled),
namedReleaseStub("octant", release.StatusFailed), namedReleaseStub("octant", release.StatusFailed),
namedReleaseStub("sextant", release.StatusUnknown), namedReleaseStub("sextant", release.StatusUnknown),
} }
@ -69,7 +69,7 @@ func TestListReleasesByStatus(t *testing.T) {
}, },
{ {
names: []string{"astrolabe"}, names: []string{"astrolabe"},
statusCodes: []release.ReleaseStatus{release.StatusDeleted}, statusCodes: []release.ReleaseStatus{release.StatusUninstalled},
}, },
{ {
names: []string{"kamal", "octant"}, names: []string{"kamal", "octant"},
@ -79,7 +79,7 @@ func TestListReleasesByStatus(t *testing.T) {
names: []string{"kamal", "astrolabe", "octant", "sextant"}, names: []string{"kamal", "astrolabe", "octant", "sextant"},
statusCodes: []release.ReleaseStatus{ statusCodes: []release.ReleaseStatus{
release.StatusDeployed, release.StatusDeployed,
release.StatusDeleted, release.StatusUninstalled,
release.StatusFailed, release.StatusFailed,
release.StatusUnknown, release.StatusUnknown,
}, },

@ -177,7 +177,7 @@ func (s *ReleaseServer) uniqName(start string, reuse bool) (string, error) {
relutil.Reverse(h, relutil.SortByRevision) relutil.Reverse(h, relutil.SortByRevision)
rel := h[0] 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. // 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) s.Log("name %s exists but is not in use, reusing name", start)
return start, nil return start, nil

@ -323,7 +323,7 @@ func TestUniqName(t *testing.T) {
rel1 := releaseStub() rel1 := releaseStub()
rel2 := releaseStub() rel2 := releaseStub()
rel2.Name = "happy-panda" rel2.Name = "happy-panda"
rel2.Info.Status = release.StatusDeleted rel2.Info.Status = release.StatusUninstalled
rs.Releases.Create(rel1) rs.Releases.Create(rel1)
rs.Releases.Create(rel2) rs.Releases.Create(rel2)

@ -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 // 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. // manifest we stashed away with reality from the cluster.
resp, err := s.KubeClient.Get(rel.Namespace, bytes.NewBufferString(rel.Manifest)) 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. // Skip errors if this is already deleted or failed.
return statusResp, nil return statusResp, nil
} else if err != nil { } else if err != nil {

@ -43,10 +43,10 @@ func TestGetReleaseStatus(t *testing.T) {
} }
} }
func TestGetReleaseStatusDeleted(t *testing.T) { func TestGetReleaseStatusUninstalled(t *testing.T) {
rs := rsFixture(t) rs := rsFixture(t)
rel := releaseStub() rel := releaseStub()
rel.Info.Status = release.StatusDeleted rel.Info.Status = release.StatusUninstalled
if err := rs.Releases.Create(rel); err != nil { if err := rs.Releases.Create(rel); err != nil {
t.Fatalf("Could not store mock release: %s", err) 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) t.Fatalf("Error getting release content: %s", err)
} }
if res.Info.Status != release.StatusDeleted { if res.Info.Status != release.StatusUninstalled {
t.Errorf("Expected %s, got %s", release.StatusDeleted, res.Info.Status) t.Errorf("Expected %s, got %s", release.StatusUninstalled, res.Info.Status)
} }
} }

@ -30,7 +30,7 @@ import (
relutil "k8s.io/helm/pkg/releaseutil" 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) { func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*hapi.UninstallReleaseResponse, error) {
if err := validateReleaseName(req.Name); err != nil { if err := validateReleaseName(req.Name); err != nil {
return nil, errors.Errorf("uninstall: Release name is invalid: %s", req.Name) 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 // TODO: Are there any cases where we want to force a delete even if it's
// already marked deleted? // already marked deleted?
if rel.Info.Status == release.StatusDeleted { if rel.Info.Status == release.StatusUninstalled {
if req.Purge { if req.Purge {
if err := s.purgeReleases(rels...); err != nil { if err := s.purgeReleases(rels...); err != nil {
return nil, errors.Wrap(err, "uninstall: Failed to purge the release") 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) s.Log("uninstall: Deleting %s", req.Name)
rel.Info.Status = release.StatusDeleting rel.Info.Status = release.StatusUninstalling
rel.Info.Deleted = time.Now() rel.Info.Deleted = time.Now()
rel.Info.Description = "Deletion in progress (or silently failed)" rel.Info.Description = "Deletion in progress (or silently failed)"
res := &hapi.UninstallReleaseResponse{Release: rel} 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) 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. // state.
if err := s.Releases.Update(rel); err != nil { if err := s.Releases.Update(rel); err != nil {
s.Log("uninstall: Failed to store updated release: %s", err) 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.Status = release.StatusUninstalled
rel.Info.Description = "Deletion complete" rel.Info.Description = "Uninstallation complete"
if req.Purge { if req.Purge {
s.Log("purge requested for %s", req.Name) s.Log("purge requested for %s", req.Name)
@ -102,7 +102,7 @@ func (s *ReleaseServer) UninstallRelease(req *hapi.UninstallReleaseRequest) (*ha
} }
if len(errs) > 0 { 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 return res, nil
} }

@ -41,8 +41,8 @@ func TestUninstallRelease(t *testing.T) {
t.Errorf("Expected angry-panda, got %q", res.Release.Name) t.Errorf("Expected angry-panda, got %q", res.Release.Name)
} }
if res.Release.Info.Status != release.StatusDeleted { if res.Release.Info.Status != release.StatusUninstalled {
t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status)
} }
if res.Release.Hooks[0].LastRun.IsZero() { 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()) t.Errorf("Expected valid UNIX date, got %d", res.Release.Info.Deleted.Second())
} }
if res.Release.Info.Description != "Deletion complete" { if res.Release.Info.Description != "Uninstallation complete" {
t.Errorf("Expected Deletion complete, got %q", res.Release.Info.Description) 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) t.Errorf("Expected angry-panda, got %q", res.Release.Name)
} }
if res.Release.Info.Status != release.StatusDeleted { if res.Release.Info.Status != release.StatusUninstalled {
t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status)
} }
if res.Release.Info.Deleted.Second() <= 0 { 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) t.Errorf("Expected angry-bunny, got %q", res.Release.Name)
} }
if res.Release.Info.Status != release.StatusDeleted { if res.Release.Info.Status != release.StatusUninstalled {
t.Errorf("Expected status code to be DELETED, got %s", res.Release.Info.Status) t.Errorf("Expected status code to be UNINSTALLED, got %s", res.Release.Info.Status)
} }
if res.Info == "" { if res.Info == "" {

@ -139,7 +139,7 @@ func (s *ReleaseServer) prepareUpdate(req *hapi.UpdateReleaseRequest) (*release.
return currentRelease, updatedRelease, err 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) { func (s *ReleaseServer) performUpdateForce(req *hapi.UpdateReleaseRequest) (*release.Release, error) {
// find the last release with the given name // find the last release with the given name
oldRelease, err := s.Releases.Last(req.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") 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. // state. There is no turning back.
oldRelease.Info.Status = release.StatusDeleting oldRelease.Info.Status = release.StatusUninstalling
oldRelease.Info.Deleted = time.Now() oldRelease.Info.Deleted = time.Now()
oldRelease.Info.Description = "Deletion in progress (or silently failed)" oldRelease.Info.Description = "Deletion in progress (or silently failed)"
s.recordRelease(oldRelease, true) s.recordRelease(oldRelease, true)
@ -186,12 +186,12 @@ func (s *ReleaseServer) performUpdateForce(req *hapi.UpdateReleaseRequest) (*rel
// delete manifests from the old release // delete manifests from the old release
_, errs := s.deleteRelease(oldRelease) _, errs := s.deleteRelease(oldRelease)
oldRelease.Info.Status = release.StatusDeleted oldRelease.Info.Status = release.StatusUninstalled
oldRelease.Info.Description = "Deletion complete" oldRelease.Info.Description = "Uninstallation complete"
s.recordRelease(oldRelease, true) s.recordRelease(oldRelease, true)
if len(errs) > 0 { 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 // post-delete hooks

@ -366,7 +366,7 @@ func TestUpdateReleaseFailure_Force(t *testing.T) {
if err != nil { if err != nil {
t.Errorf("Expected to be able to get previous release") 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) t.Errorf("Expected Deleted status on previous Release version. Got %v", oldStatus)
} }
} }

@ -904,10 +904,10 @@ _helm_list()
flags+=("--date") flags+=("--date")
flags+=("-d") flags+=("-d")
local_nonpersistent_flags+=("--date") local_nonpersistent_flags+=("--date")
flags+=("--deleted") flags+=("--uninstalled")
local_nonpersistent_flags+=("--deleted") local_nonpersistent_flags+=("--uninstalled")
flags+=("--deleting") flags+=("--uninstalling")
local_nonpersistent_flags+=("--deleting") local_nonpersistent_flags+=("--uninstalling")
flags+=("--deployed") flags+=("--deployed")
local_nonpersistent_flags+=("--deployed") local_nonpersistent_flags+=("--deployed")
flags+=("--failed") flags+=("--failed")

Loading…
Cancel
Save