From 8389fe1d58a35757762acb194b4ecf878dcb0849 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:13:14 -0400 Subject: [PATCH 1/3] added description field to api types UpdateReleaseRequest, InstallReleaseRequest, UninstallReleaseRequest, and RollbackReleaseRequest Signed-off-by: Arash Deshmeh --- _proto/hapi/services/tiller.proto | 9 ++ pkg/proto/hapi/services/tiller.pb.go | 196 ++++++++++++++++----------- 2 files changed, 126 insertions(+), 79 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 8daef0cb3..95391cb1a 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -209,6 +209,8 @@ message UpdateReleaseRequest { bool reuse_values = 10; // Force resource update through delete/recreate if needed. bool force = 11; + // Description, if set, will set the description for the updated release + string description = 12; } // UpdateReleaseResponse is the response to an update request. @@ -234,6 +236,8 @@ message RollbackReleaseRequest { bool wait = 7; // Force resource update through delete/recreate if needed. bool force = 8; + // Description, if set, will set the description for the rollback + string description = 9; } // RollbackReleaseResponse is the response to an update request. @@ -273,6 +277,9 @@ message InstallReleaseRequest { bool wait = 9; bool disable_crd_hook = 10; + + // Description, if set, will set the description for the installed release + string description = 11; } // InstallReleaseResponse is the response from a release installation. @@ -290,6 +297,8 @@ message UninstallReleaseRequest { bool purge = 3; // timeout specifies the max amount of time any kubernetes client command can run. int64 timeout = 4; + // Description, if set, will set the description for the uninnstalled release + string description = 5; } // UninstallReleaseResponse represents a successful response to an uninstall request. diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 4d23bcdad..c0b9ab7d3 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -376,6 +376,8 @@ type UpdateReleaseRequest struct { ReuseValues bool `protobuf:"varint,10,opt,name=reuse_values,json=reuseValues" json:"reuse_values,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,11,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the updated release + Description string `protobuf:"bytes,12,opt,name=description" json:"description,omitempty"` } func (m *UpdateReleaseRequest) Reset() { *m = UpdateReleaseRequest{} } @@ -460,6 +462,13 @@ func (m *UpdateReleaseRequest) GetForce() bool { return false } +func (m *UpdateReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UpdateReleaseResponse is the response to an update request. type UpdateReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -495,6 +504,8 @@ type RollbackReleaseRequest struct { Wait bool `protobuf:"varint,7,opt,name=wait" json:"wait,omitempty"` // Force resource update through delete/recreate if needed. Force bool `protobuf:"varint,8,opt,name=force" json:"force,omitempty"` + // Description, if set, will set the description for the rollback + Description string `protobuf:"bytes,9,opt,name=description" json:"description,omitempty"` } func (m *RollbackReleaseRequest) Reset() { *m = RollbackReleaseRequest{} } @@ -558,6 +569,13 @@ func (m *RollbackReleaseRequest) GetForce() bool { return false } +func (m *RollbackReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // RollbackReleaseResponse is the response to an update request. type RollbackReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -601,6 +619,8 @@ type InstallReleaseRequest struct { // before marking the release as successful. It will wait for as long as timeout Wait bool `protobuf:"varint,9,opt,name=wait" json:"wait,omitempty"` DisableCrdHook bool `protobuf:"varint,10,opt,name=disable_crd_hook,json=disableCrdHook" json:"disable_crd_hook,omitempty"` + // Description, if set, will set the description for the installed release + Description string `protobuf:"bytes,11,opt,name=description" json:"description,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -678,6 +698,13 @@ func (m *InstallReleaseRequest) GetDisableCrdHook() bool { return false } +func (m *InstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // InstallReleaseResponse is the response from a release installation. type InstallReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -705,6 +732,8 @@ type UninstallReleaseRequest struct { Purge bool `protobuf:"varint,3,opt,name=purge" json:"purge,omitempty"` // timeout specifies the max amount of time any kubernetes client command can run. Timeout int64 `protobuf:"varint,4,opt,name=timeout" json:"timeout,omitempty"` + // Description, if set, will set the description for the uninnstalled release + Description string `protobuf:"bytes,5,opt,name=description" json:"description,omitempty"` } func (m *UninstallReleaseRequest) Reset() { *m = UninstallReleaseRequest{} } @@ -740,6 +769,13 @@ func (m *UninstallReleaseRequest) GetTimeout() int64 { return 0 } +func (m *UninstallReleaseRequest) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + // UninstallReleaseResponse represents a successful response to an uninstall request. type UninstallReleaseResponse struct { // Release is the release that was marked deleted. @@ -1376,83 +1412,85 @@ var _ReleaseService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("hapi/services/tiller.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1235 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdd, 0x6e, 0xe3, 0xc4, - 0x17, 0xaf, 0xf3, 0x9d, 0x93, 0x6e, 0xfe, 0xd9, 0x69, 0xda, 0xba, 0xfe, 0x2f, 0xa8, 0x18, 0xc1, - 0x66, 0x17, 0x36, 0x85, 0xc0, 0x0d, 0x12, 0x42, 0xea, 0x66, 0xa3, 0xb6, 0x50, 0xba, 0x92, 0xb3, - 0x5d, 0x24, 0x04, 0x44, 0x6e, 0x32, 0x69, 0xcd, 0x3a, 0x76, 0xf0, 0x8c, 0xcb, 0xf6, 0x96, 0x3b, - 0xde, 0x8a, 0x77, 0xe0, 0x92, 0x4b, 0x78, 0x10, 0x34, 0x5f, 0xae, 0x27, 0xb5, 0x5b, 0xd3, 0x9b, - 0x78, 0x66, 0xce, 0xf7, 0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04, 0xa5, 0xb7, 0xbc, 0x5b, 0x82, - 0x5a, 0x69, 0x70, 0xf6, 0x1a, 0xf2, 0xa0, 0xed, 0xc4, 0x81, 0x34, 0xcd, 0xda, 0x02, 0xca, 0x91, - 0xbe, 0xd9, 0xd5, 0xac, 0x27, 0x05, 0x38, 0xaf, 0xef, 0xf7, 0x73, 0xf8, 0xbe, 0xa1, 0x58, 0xcf, - 0x6a, 0xfc, 0xdf, 0xef, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x5d, 0xc3, 0xd5, 0x55, 0xeb, - 0x0f, 0x00, 0x00, + // 1267 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xed, 0x6e, 0xe3, 0x44, + 0x17, 0x6e, 0xe2, 0x7c, 0x9e, 0x74, 0xf3, 0x66, 0x67, 0xb3, 0xad, 0xeb, 0x77, 0x41, 0xc1, 0x08, + 0x36, 0xbb, 0xb0, 0x29, 0x04, 0xfe, 0x20, 0x21, 0xa4, 0x6e, 0x36, 0x6a, 0x0b, 0xa5, 0x2b, 0x39, + 0xdb, 0x45, 0x42, 0x40, 0xe4, 0x26, 0x93, 0xd6, 0xac, 0x63, 0x07, 0xcf, 0xb8, 0x6c, 0x2f, 0x00, + 0x24, 0xee, 0x83, 0x0b, 0xe1, 0x3e, 0xb8, 0x0e, 0xfe, 0x23, 0xcf, 0x87, 0xeb, 0x71, 0xec, 0xd4, + 0xf4, 0x4f, 0xe3, 0x99, 0x73, 0xe6, 0x7c, 0x3c, 0xcf, 0x9c, 0x33, 0xa7, 0x60, 0x5c, 0xda, 0x2b, + 0x67, 0x9f, 0xe0, 0xe0, 0xca, 0x99, 0x61, 0xb2, 0x4f, 0x1d, 0xd7, 0xc5, 0xc1, 0x60, 0x15, 0xf8, + 0xd4, 0x47, 0xdd, 0x48, 0x36, 0x90, 0xb2, 0x01, 0x97, 0x19, 0x3b,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4a, 0x35, 0x38, 0x73, 0x0b, 0x39, 0xd0, 0xb6, 0x42, 0x4f, 0xb8, 0x8e, 0xda, 0x02, 0xca, 0x39, + 0xbd, 0xde, 0xd5, 0x8c, 0x27, 0x05, 0x34, 0x6f, 0xea, 0xfb, 0x39, 0x7c, 0xdf, 0x90, 0xaa, 0xe7, + 0x35, 0xf6, 0x5f, 0xf8, 0x67, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x73, 0x4f, 0x4d, 0x73, + 0x10, 0x00, 0x00, } From a32868e48b82c97dba246b5ed4003bf8966a7725 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:29:21 -0400 Subject: [PATCH 2/3] added ability to handle custom release descriptions to tiller Signed-off-by: Arash Deshmeh --- pkg/tiller/release_install.go | 6 +++- pkg/tiller/release_install_test.go | 20 ++++++++++++ pkg/tiller/release_rollback.go | 7 +++- pkg/tiller/release_rollback_test.go | 32 ++++++++++++++++++ pkg/tiller/release_uninstall.go | 6 +++- pkg/tiller/release_uninstall_test.go | 21 ++++++++++++ pkg/tiller/release_update.go | 12 +++++-- pkg/tiller/release_update_test.go | 49 ++++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 5 deletions(-) diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 0b8f4da5b..01ef88c98 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -250,7 +250,11 @@ func (s *ReleaseServer) performRelease(r *release.Release, req *services.Install } r.Info.Status.Code = release.Status_DEPLOYED - r.Info.Description = "Install complete" + if req.Description == "" { + r.Info.Description = "Install complete" + } else { + r.Info.Description = req.Description + } // This is a tricky case. The release has been created, but the result // cannot be recorded. The truest thing to tell the user is that the // release was created. However, the user will not be able to do anything diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index a244e4b72..bbea3b9dd 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -495,3 +495,23 @@ func TestInstallRelease_WrongKubeVersion(t *testing.T) { t.Errorf("Expected %q to contain %q", err.Error(), expect) } } + +func TestInstallRelease_Description(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.InstallReleaseRequest{ + Chart: chartStub(), + Description: customDescription, + } + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Errorf("Failed install: %s", err) + } + + if desc := res.Release.Info.Description; desc != customDescription { + t.Errorf("Expected description %q. Got %q", customDescription, desc) + } +} diff --git a/pkg/tiller/release_rollback.go b/pkg/tiller/release_rollback.go index fa3d943f4..ab6462db9 100644 --- a/pkg/tiller/release_rollback.go +++ b/pkg/tiller/release_rollback.go @@ -86,6 +86,11 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* return nil, nil, err } + description := req.Description + if req.Description == "" { + description = fmt.Sprintf("Rollback to %d", previousVersion) + } + // Store a new release object with previous release's configuration targetRelease := &release.Release{ Name: req.Name, @@ -101,7 +106,7 @@ func (s *ReleaseServer) prepareRollback(req *services.RollbackReleaseRequest) (* }, // Because we lose the reference to previous version elsewhere, we set the // message here, and only override it later if we experience failure. - Description: fmt.Sprintf("Rollback to %d", previousVersion), + Description: description, }, Version: currentRelease.Version + 1, Manifest: previousRelease.Manifest, diff --git a/pkg/tiller/release_rollback_test.go b/pkg/tiller/release_rollback_test.go index b73501a36..710f0ebbe 100644 --- a/pkg/tiller/release_rollback_test.go +++ b/pkg/tiller/release_rollback_test.go @@ -252,3 +252,35 @@ func TestRollbackReleaseFailure(t *testing.T) { t.Errorf("Expected SUPERSEDED status on previous Release version. Got %v", oldStatus) } } + +func TestRollbackReleaseWithCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + upgradedRel := upgradeReleaseVersion(rel) + rs.env.Releases.Update(rel) + rs.env.Releases.Create(upgradedRel) + + customDescription := "foo" + req := &services.RollbackReleaseRequest{ + Name: rel.Name, + Description: customDescription, + } + res, err := rs.RollbackRelease(c, req) + if err != nil { + t.Fatalf("Failed rollback: %s", err) + } + + if res.Release.Name == "" { + t.Errorf("Expected release name.") + } + + if res.Release.Name != rel.Name { + t.Errorf("Updated release name does not match previous release name. Expected %s, got %s", rel.Name, res.Release.Name) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected Description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_uninstall.go b/pkg/tiller/release_uninstall.go index 423b6e7ef..294645ae7 100644 --- a/pkg/tiller/release_uninstall.go +++ b/pkg/tiller/release_uninstall.go @@ -97,7 +97,11 @@ func (s *ReleaseServer) UninstallRelease(c ctx.Context, req *services.UninstallR } rel.Info.Status.Code = release.Status_DELETED - rel.Info.Description = "Deletion complete" + if req.Description == "" { + rel.Info.Description = "Deletion complete" + } else { + rel.Info.Description = req.Description + } if req.Purge { s.Log("purge requested for %s", req.Name) diff --git a/pkg/tiller/release_uninstall_test.go b/pkg/tiller/release_uninstall_test.go index 20bfd2486..a68ac55f7 100644 --- a/pkg/tiller/release_uninstall_test.go +++ b/pkg/tiller/release_uninstall_test.go @@ -176,3 +176,24 @@ func TestUninstallReleaseNoHooks(t *testing.T) { t.Errorf("Expected LastRun to be zero, got %d.", res.Release.Hooks[0].LastRun.Seconds) } } + +func TestUninstallReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rs.env.Releases.Create(releaseStub()) + + customDescription := "foo" + req := &services.UninstallReleaseRequest{ + Name: "angry-panda", + Description: "foo", + } + + res, err := rs.UninstallRelease(c, req) + if err != nil { + t.Errorf("Failed uninstall: %s", err) + } + + if res.Release.Info.Description != customDescription { + t.Errorf("Expected description to be %q, got %q", customDescription, res.Release.Info.Description) + } +} diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 6f5d37331..e94de705d 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -243,7 +243,11 @@ func (s *ReleaseServer) performUpdateForce(req *services.UpdateReleaseRequest) ( } newRelease.Info.Status.Code = release.Status_DEPLOYED - newRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + newRelease.Info.Description = "Upgrade complete" + } else { + newRelease.Info.Description = req.Description + } s.recordRelease(newRelease, true) return res, nil @@ -287,7 +291,11 @@ func (s *ReleaseServer) performUpdate(originalRelease, updatedRelease *release.R s.recordRelease(originalRelease, true) updatedRelease.Info.Status.Code = release.Status_DEPLOYED - updatedRelease.Info.Description = "Upgrade complete" + if req.Description == "" { + updatedRelease.Info.Description = "Upgrade complete" + } else { + updatedRelease.Info.Description = req.Description + } return res, nil } diff --git a/pkg/tiller/release_update_test.go b/pkg/tiller/release_update_test.go index a1b9a4bff..56dcca874 100644 --- a/pkg/tiller/release_update_test.go +++ b/pkg/tiller/release_update_test.go @@ -432,6 +432,55 @@ func TestUpdateReleaseNoChanges(t *testing.T) { } } +func TestUpdateReleaseCustomDescription(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + +func TestUpdateReleaseCustomDescription_Force(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + rel := releaseStub() + rs.env.Releases.Create(rel) + + customDescription := "foo" + + req := &services.UpdateReleaseRequest{ + Name: rel.Name, + Chart: rel.GetChart(), + Force: true, + Description: customDescription, + } + + res, err := rs.UpdateRelease(c, req) + if err != nil { + t.Fatalf("Failed updated: %s", err) + } + if res.Release.Info.Description != customDescription { + t.Errorf("Expected release description to be %q, got %q", customDescription, res.Release.Info.Description) + } + compareStoredAndReturnedRelease(t, *rs, *res) +} + func compareStoredAndReturnedRelease(t *testing.T, rs ReleaseServer, res services.UpdateReleaseResponse) *release.Release { storedRelease, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version) if err != nil { From d8c4cbb0e0e31276241d87d6386aad8d90011117 Mon Sep 17 00:00:00 2001 From: Arash Deshmeh Date: Tue, 3 Apr 2018 17:35:07 -0400 Subject: [PATCH 3/3] feat(helm): Added the ability to handle custom description to client side for install, upgrade, rollback, and delete commands. Updated the documentation according to the changes. Signed-off-by: Arash Deshmeh --- cmd/helm/delete.go | 3 +++ cmd/helm/delete_test.go | 8 ++++++++ cmd/helm/install.go | 5 ++++- cmd/helm/install_test.go | 7 +++++++ cmd/helm/rollback.go | 5 ++++- cmd/helm/rollback_test.go | 6 ++++++ cmd/helm/upgrade.go | 6 +++++- cmd/helm/upgrade_test.go | 16 ++++++++++++++++ docs/helm/helm_delete.md | 3 ++- docs/helm/helm_install.md | 3 ++- docs/helm/helm_rollback.md | 3 ++- docs/helm/helm_upgrade.md | 1 + pkg/helm/fake.go | 21 ++++++++++++++------- pkg/helm/fake_test.go | 17 +++++++++++++++++ pkg/helm/option.go | 28 ++++++++++++++++++++++++++++ 15 files changed, 119 insertions(+), 13 deletions(-) diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go index e0ac8c4f6..46c7abcb1 100755 --- a/cmd/helm/delete.go +++ b/cmd/helm/delete.go @@ -40,6 +40,7 @@ type deleteCmd struct { disableHooks bool purge bool timeout int64 + description string out io.Writer client helm.Interface @@ -81,6 +82,7 @@ func newDeleteCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&del.disableHooks, "no-hooks", false, "prevent hooks from running during deletion") f.BoolVar(&del.purge, "purge", false, "remove the release from the store and make its name free for later use") f.Int64Var(&del.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.StringVar(&del.description, "description", "", "specify a description for the release") return cmd } @@ -91,6 +93,7 @@ func (d *deleteCmd) run() error { helm.DeleteDisableHooks(d.disableHooks), helm.DeletePurge(d.purge), helm.DeleteTimeout(d.timeout), + helm.DeleteDescription(d.description), } res, err := d.client.DeleteRelease(d.name, opts...) if res != nil && res.Info != "" { diff --git a/cmd/helm/delete_test.go b/cmd/helm/delete_test.go index 829d17906..6b5c444b1 100644 --- a/cmd/helm/delete_test.go +++ b/cmd/helm/delete_test.go @@ -61,6 +61,14 @@ func TestDelete(t *testing.T) { resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, }, + { + name: "delete with description", + args: []string{"aeneas"}, + flags: []string{"--description", "foo"}, + expected: "", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"}), + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "aeneas"})}, + }, { name: "delete without release", args: []string{}, diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d1c24c213..6a2107b92 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -129,6 +129,7 @@ type installCmd struct { password string devel bool depUp bool + description string certFile string keyFile string @@ -209,6 +210,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&inst.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") f.BoolVar(&inst.depUp, "dep-up", false, "run helm dependency update before installing the chart") + f.StringVar(&inst.description, "description", "", "specify a description for the release") return cmd } @@ -277,7 +279,8 @@ func (i *installCmd) run() error { helm.InstallDisableHooks(i.disableHooks), helm.InstallDisableCRDHook(i.disableCRDHook), helm.InstallTimeout(i.timeout), - helm.InstallWait(i.wait)) + helm.InstallWait(i.wait), + helm.InstallDescription(i.description)) if err != nil { return prettyError(err) } diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index aa828c6ce..236174bec 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -115,6 +115,13 @@ func TestInstall(t *testing.T) { expected: "FOOBAR", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "FOOBAR"}), }, + { + name: "install with custom description", + args: []string{"testdata/testcharts/alpine"}, + flags: []string{"--name", "virgil", "--description", "foobar"}, + expected: "virgil", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "virgil", Description: "foobar"}), + }, // Install, perform chart verification along the way. { name: "install with verification, missing provenance", diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 889b6ae28..370807cb4 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -45,6 +45,7 @@ type rollbackCmd struct { client helm.Interface timeout int64 wait bool + description string } func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { @@ -83,6 +84,7 @@ func newRollbackCmd(c helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&rollback.disableHooks, "no-hooks", false, "prevent hooks from running during rollback") f.Int64Var(&rollback.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&rollback.wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful. It will wait for as long as --timeout") + f.StringVar(&rollback.description, "description", "", "specify a description for the release") return cmd } @@ -96,7 +98,8 @@ func (r *rollbackCmd) run() error { helm.RollbackDisableHooks(r.disableHooks), helm.RollbackVersion(r.revision), helm.RollbackTimeout(r.timeout), - helm.RollbackWait(r.wait)) + helm.RollbackWait(r.wait), + helm.RollbackDescription(r.description)) if err != nil { return prettyError(err) } diff --git a/cmd/helm/rollback_test.go b/cmd/helm/rollback_test.go index f1479b2eb..62bfd6477 100644 --- a/cmd/helm/rollback_test.go +++ b/cmd/helm/rollback_test.go @@ -45,6 +45,12 @@ func TestRollbackCmd(t *testing.T) { flags: []string{"--wait"}, expected: "Rollback was a success! Happy Helming!", }, + { + name: "rollback a release with description", + args: []string{"funny-honey", "1"}, + flags: []string{"--description", "foo"}, + expected: "Rollback was a success! Happy Helming!", + }, { name: "rollback a release without revision", args: []string{"funny-honey"}, diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 4dd433a39..aaf87b7d0 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -78,6 +78,7 @@ type upgradeCmd struct { username string password string devel bool + description string certFile string keyFile string @@ -139,6 +140,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&upgrade.keyFile, "key-file", "", "identify HTTPS client using this SSL key file") f.StringVar(&upgrade.caFile, "ca-file", "", "verify certificates of HTTPS-enabled servers using this CA bundle") f.BoolVar(&upgrade.devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.") + f.StringVar(&upgrade.description, "description", "", "specify the description to use for the upgrade, rather than the default") f.MarkDeprecated("disable-hooks", "use --no-hooks instead") @@ -190,6 +192,7 @@ func (u *upgradeCmd) run() error { namespace: u.namespace, timeout: u.timeout, wait: u.wait, + description: u.description, } return ic.run() } @@ -224,7 +227,8 @@ func (u *upgradeCmd) run() error { helm.UpgradeTimeout(u.timeout), helm.ResetValues(u.resetValues), helm.ReuseValues(u.reuseValues), - helm.UpgradeWait(u.wait)) + helm.UpgradeWait(u.wait), + helm.UpgradeDescription(u.description)) if err != nil { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go index 187d3593e..032df2f32 100644 --- a/cmd/helm/upgrade_test.go +++ b/cmd/helm/upgrade_test.go @@ -139,6 +139,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch})}, }, + { + name: "install a release with 'upgrade --install' and custom description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"-i", "--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 1, Chart: ch, Description: "foo"})}, + }, { name: "upgrade a release with wait", args: []string{"crazy-bunny", chartPath}, @@ -147,6 +155,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2})}, }, + { + name: "upgrade a release with description", + args: []string{"crazy-bunny", chartPath}, + flags: []string{"--description", "foo"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2}), + expected: "Release \"crazy-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "crazy-bunny", Version: 2, Chart: ch2, Description: "foo"})}, + }, { name: "upgrade a release with missing dependencies", args: []string{"bonkers-bunny", missingDepsPath}, diff --git a/docs/helm/helm_delete.md b/docs/helm/helm_delete.md index 5d41cd7ea..9eee6e8ec 100644 --- a/docs/helm/helm_delete.md +++ b/docs/helm/helm_delete.md @@ -20,6 +20,7 @@ helm delete [flags] RELEASE_NAME [...] ### Options ``` + --description string specify a description for the release --dry-run simulate a delete --no-hooks prevent hooks from running during deletion --purge remove the release from the store and make its name free for later use @@ -45,4 +46,4 @@ helm delete [flags] RELEASE_NAME [...] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 13-Apr-2018 diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 9f1ad86b0..62d02cc38 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -77,6 +77,7 @@ helm install [CHART] --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file --dep-up run helm dependency update before installing the chart + --description string specify a description for the release --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an install --key-file string identify HTTPS client using this SSL key file @@ -118,4 +119,4 @@ helm install [CHART] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 27-Apr-2018 +###### Auto generated by spf13/cobra on 5-Jun-2018 diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 4b6dcbbb2..ae64a0a26 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -20,6 +20,7 @@ helm rollback [flags] [RELEASE] [REVISION] ### Options ``` + --description string specify a description for the release --dry-run simulate a rollback --force force resource update through delete/recreate if needed --no-hooks prevent hooks from running during rollback @@ -47,4 +48,4 @@ helm rollback [flags] [RELEASE] [REVISION] ### SEE ALSO * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 8-Mar-2018 +###### Auto generated by spf13/cobra on 13-Apr-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index c2882265e..b952624a5 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -39,6 +39,7 @@ helm upgrade [RELEASE] [CHART] ``` --ca-file string verify certificates of HTTPS-enabled servers using this CA bundle --cert-file string identify HTTPS client using this SSL certificate file + --description string specify the description to use for the upgrade, rather than the default --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. --dry-run simulate an upgrade --force force resource update through delete/recreate if needed diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 0a9e77c44..aa2bbb4e9 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -69,6 +69,7 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts } releaseName := c.Opts.instReq.Name + releaseDescription := c.Opts.instReq.Description // Check to see if the release already exists. rel, err := c.ReleaseStatus(releaseName, nil) @@ -76,7 +77,7 @@ func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts return nil, errors.New("cannot re-use a name that is still in use") } - release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns}) + release := ReleaseMock(&MockReleaseOptions{Name: releaseName, Namespace: ns, Description: releaseDescription}) c.Rels = append(c.Rels, release) return &rls.InstallReleaseResponse{ @@ -206,11 +207,12 @@ metadata: // MockReleaseOptions allows for user-configurable options on mock release objects. type MockReleaseOptions struct { - Name string - Version int32 - Chart *chart.Chart - StatusCode release.Status_Code - Namespace string + Name string + Version int32 + Chart *chart.Chart + StatusCode release.Status_Code + Namespace string + Description string } // ReleaseMock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing. @@ -232,6 +234,11 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { namespace = "default" } + description := opts.Description + if description == "" { + description = "Release mock" + } + ch := opts.Chart if opts.Chart == nil { ch = &chart.Chart{ @@ -256,7 +263,7 @@ func ReleaseMock(opts *MockReleaseOptions) *release.Release { FirstDeployed: &date, LastDeployed: &date, Status: &release.Status{Code: scode}, - Description: "Release mock", + Description: description, }, Chart: ch, Config: &chart.Config{Raw: `name: "value"`}, diff --git a/pkg/helm/fake_test.go b/pkg/helm/fake_test.go index 9c0a53759..f6de572b5 100644 --- a/pkg/helm/fake_test.go +++ b/pkg/helm/fake_test.go @@ -150,6 +150,23 @@ func TestFakeClient_InstallReleaseFromChart(t *testing.T) { }, wantErr: false, }, + { + name: "Add release with description.", + fields: fields{ + Rels: []*release.Release{}, + }, + args: args{ + ns: "default", + opts: []InstallOption{ReleaseName("new-release"), InstallDescription("foo-bar")}, + }, + want: &rls.InstallReleaseResponse{ + Release: ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + }, + relsAfter: []*release.Release{ + ReleaseMock(&MockReleaseOptions{Name: "new-release", Description: "foo-bar"}), + }, + wantErr: false, + }, { name: "Try to add a release where the name already exists.", fields: fields{ diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 602e1e3a3..4babec073 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -262,6 +262,34 @@ func UpdateValueOverrides(raw []byte) UpdateOption { } } +// InstallDescription specifies the description for the release +func InstallDescription(description string) InstallOption { + return func(opts *options) { + opts.instReq.Description = description + } +} + +// UpgradeDescription specifies the description for the update +func UpgradeDescription(description string) UpdateOption { + return func(opts *options) { + opts.updateReq.Description = description + } +} + +// RollbackDescription specifies the description for the release +func RollbackDescription(description string) RollbackOption { + return func(opts *options) { + opts.rollbackReq.Description = description + } +} + +// DeleteDescription specifies the description for the release +func DeleteDescription(description string) DeleteOption { + return func(opts *options) { + opts.uninstallReq.Description = description + } +} + // DeleteDisableHooks will disable hooks for a deletion operation. func DeleteDisableHooks(disable bool) DeleteOption { return func(opts *options) {