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

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

@ -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),

@ -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"
)
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)
}

@ -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,
},
}

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

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

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

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

@ -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?**

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

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

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

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

@ -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:]...)

@ -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) {

@ -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)
}

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

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

@ -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")
}
}

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

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

@ -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,
},
}

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

@ -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)
})
}

@ -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()

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

@ -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,
},

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

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

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

@ -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)
}
}

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

@ -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 == "" {

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

@ -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)
}
}

@ -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")

Loading…
Cancel
Save