From bc817a1914fb7fd70ee3dfb2c40c2d8f61d1fd18 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 14 May 2018 11:44:49 -0700 Subject: [PATCH 01/56] replace with a link to the latest releases page This removes a step required every time we release Helm, making it simpler to cut a new release. Signed-off-by: jgleonard --- README.md | 7 +------ docs/release_checklist.md | 25 ------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/README.md b/README.md index fb2e16bce..fc091056e 100644 --- a/README.md +++ b/README.md @@ -32,12 +32,7 @@ Think of it like apt/yum/homebrew for Kubernetes. ## Install -Binary downloads of the Helm client can be found at the following links: - -- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-darwin-amd64.tar.gz) -- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-amd64.tar.gz) -- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-linux-386.tar.gz) -- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.2-windows-amd64.tar.gz) +Binary downloads of the Helm client can be found on [the latest Releases page](https://github.com/kubernetes/helm/releases/latest). Unpack the `helm` binary and add it to your PATH and you are good to go! diff --git a/docs/release_checklist.md b/docs/release_checklist.md index 26506985c..d678e7748 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -94,31 +94,6 @@ index 2109a0a..6f5a1a4 100644 BuildMetadata = "unreleased" ``` -The README stores links to the latest release for helm. We want to change the version to the first release candidate which we are releasing (more on that in step 5). - -```shell -$ git diff README.md -diff --git a/README.md b/README.md -index 022afd79..547839e2 100644 ---- a/README.md -+++ b/README.md -@@ -34,10 +34,10 @@ Think of it like apt/yum/homebrew for Kubernetes. - - Binary downloads of the Helm client can be found at the following links: - --- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-darwin-amd64.tar.gz) --- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz) --- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-386.tar.gz) --- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-windows-amd64.tar.gz) -+- [OSX](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-darwin-amd64.tar.gz) -+- [Linux](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-amd64.tar.gz) -+- [Linux 32-bit](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-linux-386.tar.gz) -+- [Windows](https://kubernetes-helm.storage.googleapis.com/helm-v2.8.0-windows-amd64.tar.gz) - - Unpack the `helm` binary and add it to your PATH and you are good to go! - macOS/[homebrew](https://brew.sh/) users can also use `brew install kubernetes-helm`. -``` - For patch releases, the old version number will be the latest patch release, so just bump the patch number, incrementing Z by one. ```shell From 61156e66565aaf5903efabcc5710846989a20f84 Mon Sep 17 00:00:00 2001 From: Rajat Jindal Date: Sat, 12 May 2018 17:37:09 -0700 Subject: [PATCH 02/56] fix lint warning Signed-off-by: jgleonard --- pkg/downloader/manager.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 89a839b54..9ee1f6f6d 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -99,11 +99,7 @@ func (m *Manager) Build() error { } // Now we need to fetch every package here into charts/ - if err := m.downloadAll(lock.Dependencies); err != nil { - return err - } - - return nil + return m.downloadAll(lock.Dependencies) } // Update updates a local charts directory. From 21cce62d53b7a4f2431455bf70312830b994b429 Mon Sep 17 00:00:00 2001 From: AdamDang Date: Thu, 17 May 2018 00:05:06 +0800 Subject: [PATCH 03/56] Update capabilities.go Signed-off-by: jgleonard --- pkg/chartutil/capabilities.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/chartutil/capabilities.go b/pkg/chartutil/capabilities.go index c87c0368e..d26aa1707 100644 --- a/pkg/chartutil/capabilities.go +++ b/pkg/chartutil/capabilities.go @@ -42,7 +42,7 @@ var ( type Capabilities struct { // List of all supported API versions APIVersions VersionSet - // KubeVerison is the Kubernetes version + // KubeVersion is the Kubernetes version KubeVersion *version.Info // TillerVersion is the Tiller version // From ab9349c425ab232992121b1d4a1c547dfdb0294b Mon Sep 17 00:00:00 2001 From: jgleonard Date: Thu, 1 Nov 2018 14:56:46 -0400 Subject: [PATCH 04/56] add child NOTES.txt rendering Signed-off-by: jgleonard --- pkg/tiller/release_install_test.go | 4 ++-- pkg/tiller/release_server.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index a244e4b72..73976571e 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -291,8 +291,8 @@ func TestInstallRelease_WithChartAndDependencyNotes(t *testing.T) { t.Logf("rel: %v", rel) - if rel.Info.Status.Notes != notesText { - t.Fatalf("Expected '%s', got '%s'", notesText, rel.Info.Status.Notes) + if !strings.Contains(rel.Info.Status.Notes, notesText) || !strings.Contains(rel.Info.Status.Notes, notesText+" child") { + t.Fatalf("Expected '%s', got '%s'", notesText+"\n"+notesText+" child", rel.Info.Status.Notes) } if rel.Info.Description != "Install complete" { diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 1a2b3c4da..e223d9f32 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -20,7 +20,6 @@ import ( "bytes" "errors" "fmt" - "path" "regexp" "strings" @@ -289,17 +288,18 @@ func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values // text file. We have to spin through this map because the file contains path information, so we // look for terminating NOTES.txt. We also remove it from the files so that we don't have to skip // it in the sortHooks. - notes := "" + var notesBuffer bytes.Buffer for k, v := range files { if strings.HasSuffix(k, notesFileSuffix) { - // Only apply the notes if it belongs to the parent chart - // Note: Do not use filePath.Join since it creates a path with \ which is not expected - if k == path.Join(ch.Metadata.Name, "templates", notesFileSuffix) { - notes = v + // If buffer contains data, add newline before adding more + if notesBuffer.Len() > 0 { + notesBuffer.WriteString("\n") } + notesBuffer.WriteString(v) delete(files, k) } } + notes := notesBuffer.String() // Sort hooks, manifests, and partials. Only hooks and manifests are returned, // as partials are not used after renderer.Render. Empty manifests are also From 1518f961af426bfb4ce8f4ef515c4d90b1a475fb Mon Sep 17 00:00:00 2001 From: jgleonard Date: Thu, 1 Nov 2018 14:57:01 -0400 Subject: [PATCH 05/56] fix(helm): add --render-subchart-notes flag to 'helm install' and 'helm upgrade' When 'helm --render-subchart-notes ...' is run, this will include the notes from the subchart when rendered via Tiller. Closes #2751 Signed-off-by: jgleonard --- _proto/hapi/services/tiller.proto | 4 + cmd/helm/install.go | 3 + cmd/helm/upgrade.go | 3 + pkg/helm/client.go | 2 + pkg/helm/option.go | 16 +++ pkg/proto/hapi/services/tiller.pb.go | 176 +++++++++++++++------------ pkg/tiller/release_install.go | 2 +- pkg/tiller/release_install_test.go | 35 +++++- pkg/tiller/release_server.go | 15 ++- pkg/tiller/release_server_test.go | 6 + pkg/tiller/release_update.go | 2 +- pkg/urlutil/urlutil_test.go | 4 +- 12 files changed, 179 insertions(+), 89 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 8daef0cb3..e54f60581 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; + // Render subchart notes if enabled + bool subNotes = 12; } // UpdateReleaseResponse is the response to an update request. @@ -273,6 +275,8 @@ message InstallReleaseRequest { bool wait = 9; bool disable_crd_hook = 10; + + bool subNotes = 11; } // InstallReleaseResponse is the response from a release installation. diff --git a/cmd/helm/install.go b/cmd/helm/install.go index d1c24c213..bffb96746 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -129,6 +129,7 @@ type installCmd struct { password string devel bool depUp bool + subNotes bool 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.BoolVar(&inst.subNotes, "render-subchart-notes", false, "render subchart notes along with the parent") return cmd } @@ -276,6 +278,7 @@ func (i *installCmd) run() error { helm.InstallReuseName(i.replace), helm.InstallDisableHooks(i.disableHooks), helm.InstallDisableCRDHook(i.disableCRDHook), + helm.InstallSubNotes(i.subNotes), helm.InstallTimeout(i.timeout), helm.InstallWait(i.wait)) if err != nil { diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 4dd433a39..41a4d7d5c 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -78,6 +78,7 @@ type upgradeCmd struct { username string password string devel bool + subNotes bool 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.BoolVar(&upgrade.subNotes, "render-subchart-notes", false, "render subchart notes along with parent") f.MarkDeprecated("disable-hooks", "use --no-hooks instead") @@ -224,6 +226,7 @@ func (u *upgradeCmd) run() error { helm.UpgradeTimeout(u.timeout), helm.ResetValues(u.resetValues), helm.ReuseValues(u.reuseValues), + helm.UpgradeSubNotes(u.subNotes), helm.UpgradeWait(u.wait)) if err != nil { return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 465ca0af8..3d246086f 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -95,6 +95,7 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ... req := &reqOpts.instReq req.Chart = chart req.Namespace = ns + req.SubNotes = reqOpts.subNotes req.DryRun = reqOpts.dryRun req.DisableHooks = reqOpts.disableHooks req.DisableCrdHook = reqOpts.disableCRDHook @@ -171,6 +172,7 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts req.DryRun = reqOpts.dryRun req.Name = rlsName req.DisableHooks = reqOpts.disableHooks + req.SubNotes = reqOpts.subNotes req.Recreate = reqOpts.recreate req.Force = reqOpts.force req.ResetValues = reqOpts.resetValues diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 602e1e3a3..045d45c1d 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -53,6 +53,8 @@ type options struct { disableHooks bool // if set, skip CRD hook only disableCRDHook bool + // if set, render SubChart Notes + subNotes bool // name of release releaseName string // tls.Config to use for rpc if tls enabled @@ -311,6 +313,20 @@ func InstallReuseName(reuse bool) InstallOption { } } +// InstallSubNotes will (if true) instruct Tiller to render SubChart Notes +func InstallSubNotes(enable bool) InstallOption { + return func(opts *options) { + opts.subNotes = enable + } +} + +// UpgradeSubNotes will (if true) instruct Tiller to render SubChart Notes +func UpgradeSubNotes(enable bool) UpdateOption { + return func(opts *options) { + opts.subNotes = enable + } +} + // RollbackDisableHooks will disable hooks for a rollback operation func RollbackDisableHooks(disable bool) RollbackOption { return func(opts *options) { diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 4d23bcdad..43c8ddcce 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"` + // Render subchart notes if enabled + SubNotes bool `protobuf:"varint,12,opt,name=subNotes" json:"subNotes,omitempty"` } func (m *UpdateReleaseRequest) Reset() { *m = UpdateReleaseRequest{} } @@ -460,6 +462,13 @@ func (m *UpdateReleaseRequest) GetForce() bool { return false } +func (m *UpdateReleaseRequest) GetSubNotes() bool { + if m != nil { + return m.SubNotes + } + return false +} + // UpdateReleaseResponse is the response to an update request. type UpdateReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -601,6 +610,7 @@ 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"` + SubNotes bool `protobuf:"varint,11,opt,name=subNotes" json:"subNotes,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -678,6 +688,13 @@ func (m *InstallReleaseRequest) GetDisableCrdHook() bool { return false } +func (m *InstallReleaseRequest) GetSubNotes() bool { + if m != nil { + return m.SubNotes + } + return false +} + // InstallReleaseResponse is the response from a release installation. type InstallReleaseResponse struct { Release *hapi_release5.Release `protobuf:"bytes,1,opt,name=release" json:"release,omitempty"` @@ -1376,83 +1393,84 @@ 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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 0xcb, 0xcb, 0x63, - 0x5e, 0x6b, 0xb2, 0xd7, 0x90, 0x0b, 0x70, 0xdd, 0x42, 0xd0, 0xe3, 0xdc, 0x84, 0xe8, 0x9d, 0xc7, - 0xea, 0xdd, 0xcd, 0x98, 0x98, 0x58, 0xc2, 0xff, 0x56, 0x5e, 0x63, 0x94, 0x03, 0x4d, 0xf6, 0x68, - 0x62, 0x3d, 0x2b, 0xc8, 0xbd, 0x12, 0x94, 0xec, 0x4a, 0xb7, 0x04, 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, + // 1257 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xdf, 0x6f, 0xe3, 0xc4, + 0x13, 0xaf, 0xf3, 0x3b, 0x93, 0x36, 0xdf, 0x74, 0x9b, 0xb6, 0xae, 0xbf, 0x07, 0x2a, 0x46, 0x70, + 0xb9, 0x83, 0x4b, 0x21, 0xf0, 0x82, 0x84, 0x90, 0x7a, 0xb9, 0xa8, 0x2d, 0x94, 0x9c, 0xe4, 0x5c, + 0x0f, 0x09, 0x01, 0x91, 0x9b, 0x6c, 0x5a, 0x73, 0x8e, 0x1d, 0xbc, 0xeb, 0x72, 0x7d, 0xe5, 0x8d, + 0xff, 0x8a, 0xff, 0x83, 0x57, 0xde, 0xf9, 0x13, 0x40, 0xde, 0x1f, 0xae, 0xd7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, 0x25, 0x44, 0xad, 0x3c, 0x46, 0xef, 0x7e, 0xc5, 0xd8, 0xc5, 0x0a, 0xfe, 0x97, 0x7a, 0xa9, + 0x51, 0x0e, 0x34, 0xd9, 0x6d, 0x8b, 0xf1, 0xac, 0xa0, 0x76, 0xea, 0x50, 0xa2, 0x2a, 0xdd, 0x71, + 0x28, 0xb5, 0xe4, 0xdd, 0x71, 0xa8, 0x54, 0x81, 0x33, 0xd7, 0x90, 0x03, 0x6d, 0x2b, 0xf4, 0x84, + 0xeb, 0xa8, 0x2c, 0xa0, 0x9c, 0xdd, 0xb7, 0xab, 0x9a, 0xf1, 0xa4, 0x80, 0xe6, 0xcd, 0xfd, 0x7e, + 0x0e, 0xdf, 0x37, 0xa4, 0xea, 0x79, 0x8d, 0xfd, 0x6b, 0xfe, 0xec, 0xdf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xbd, 0x2a, 0xa3, 0x1f, 0x23, 0x10, 0x00, 0x00, } diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 0b8f4da5b..d7781c0d9 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -84,7 +84,7 @@ func (s *ReleaseServer) prepareRelease(req *services.InstallReleaseRequest) (*re return nil, err } - hooks, manifestDoc, notesTxt, err := s.renderResources(req.Chart, valuesToRender, caps.APIVersions) + hooks, manifestDoc, notesTxt, err := s.renderResources(req.Chart, valuesToRender, req.SubNotes, caps.APIVersions) if err != nil { // Return a release with partial data so that client can show debugging // information. diff --git a/pkg/tiller/release_install_test.go b/pkg/tiller/release_install_test.go index 73976571e..1d1b08e90 100644 --- a/pkg/tiller/release_install_test.go +++ b/pkg/tiller/release_install_test.go @@ -268,7 +268,7 @@ func TestInstallRelease_WrongTillerVersion(t *testing.T) { } } -func TestInstallRelease_WithChartAndDependencyNotes(t *testing.T) { +func TestInstallRelease_WithChartAndDependencyParentNotes(t *testing.T) { c := helm.NewContext() rs := rsFixture() @@ -291,6 +291,39 @@ func TestInstallRelease_WithChartAndDependencyNotes(t *testing.T) { t.Logf("rel: %v", rel) + if rel.Info.Status.Notes != notesText { + t.Fatalf("Expected '%s', got '%s'", notesText, rel.Info.Status.Notes) + } + + if rel.Info.Description != "Install complete" { + t.Errorf("unexpected description: %s", rel.Info.Description) + } +} + +func TestInstallRelease_WithChartAndDependencyAllNotes(t *testing.T) { + c := helm.NewContext() + rs := rsFixture() + + req := installRequest(withSubNotes(), + withChart( + withNotes(notesText), + withDependency(withNotes(notesText+" child")), + )) + res, err := rs.InstallRelease(c, req) + if err != nil { + t.Fatalf("Failed install: %s", err) + } + if res.Release.Name == "" { + t.Errorf("Expected release name.") + } + + rel, err := rs.env.Releases.Get(res.Release.Name, res.Release.Version) + if err != nil { + t.Errorf("Expected release for %s (%v).", res.Release.Name, rs.env.Releases) + } + + t.Logf("rel: %v", rel) + if !strings.Contains(rel.Info.Status.Notes, notesText) || !strings.Contains(rel.Info.Status.Notes, notesText+" child") { t.Fatalf("Expected '%s', got '%s'", notesText+"\n"+notesText+" child", rel.Info.Status.Notes) } diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index e223d9f32..29379d374 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -20,6 +20,7 @@ import ( "bytes" "errors" "fmt" + "path" "regexp" "strings" @@ -259,7 +260,7 @@ func GetVersionSet(client discovery.ServerGroupsInterface) (chartutil.VersionSet return chartutil.NewVersionSet(versions...), nil } -func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values, vs chartutil.VersionSet) ([]*release.Hook, *bytes.Buffer, string, error) { +func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values, subNotes bool, vs chartutil.VersionSet) ([]*release.Hook, *bytes.Buffer, string, error) { // Guard to make sure Tiller is at the right version to handle this chart. sver := version.GetVersion() if ch.Metadata.TillerVersion != "" && @@ -291,14 +292,18 @@ func (s *ReleaseServer) renderResources(ch *chart.Chart, values chartutil.Values var notesBuffer bytes.Buffer for k, v := range files { if strings.HasSuffix(k, notesFileSuffix) { - // If buffer contains data, add newline before adding more - if notesBuffer.Len() > 0 { - notesBuffer.WriteString("\n") + if subNotes || (k == path.Join(ch.Metadata.Name, "templates", notesFileSuffix)) { + + // If buffer contains data, add newline before adding more + if notesBuffer.Len() > 0 { + notesBuffer.WriteString("\n") + } + notesBuffer.WriteString(v) } - notesBuffer.WriteString(v) delete(files, k) } } + notes := notesBuffer.String() // Sort hooks, manifests, and partials. Only hooks and manifests are returned, diff --git a/pkg/tiller/release_server_test.go b/pkg/tiller/release_server_test.go index 96cb84a75..78c16e679 100644 --- a/pkg/tiller/release_server_test.go +++ b/pkg/tiller/release_server_test.go @@ -228,6 +228,12 @@ func withChart(chartOpts ...chartOption) installOption { } } +func withSubNotes() installOption { + return func(opts *installOptions) { + opts.SubNotes = true + } +} + func installRequest(opts ...installOption) *services.InstallReleaseRequest { reqOpts := &installOptions{ &services.InstallReleaseRequest{ diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 6f5d37331..c4e4820e7 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -113,7 +113,7 @@ func (s *ReleaseServer) prepareUpdate(req *services.UpdateReleaseRequest) (*rele return nil, nil, err } - hooks, manifestDoc, notesTxt, err := s.renderResources(req.Chart, valuesToRender, caps.APIVersions) + hooks, manifestDoc, notesTxt, err := s.renderResources(req.Chart, valuesToRender, req.SubNotes, caps.APIVersions) if err != nil { return nil, nil, err } diff --git a/pkg/urlutil/urlutil_test.go b/pkg/urlutil/urlutil_test.go index f0c82c0a9..b3a142392 100644 --- a/pkg/urlutil/urlutil_test.go +++ b/pkg/urlutil/urlutil_test.go @@ -65,8 +65,8 @@ func TestEqual(t *testing.T) { func TestExtractHostname(t *testing.T) { tests := map[string]string{ - "http://example.com": "example.com", - "https://example.com/foo": "example.com", + "http://example.com": "example.com", + "https://example.com/foo": "example.com", "https://example.com:31337/not/with/a/bang/but/a/whimper": "example.com", } for start, expect := range tests { From 66e79227b2ff666ba66f48db992fc1f9c1ff464c Mon Sep 17 00:00:00 2001 From: jgleonard Date: Thu, 1 Nov 2018 15:11:38 -0400 Subject: [PATCH 06/56] make docs Signed-off-by: jgleonard --- docs/helm/helm_install.md | 3 ++- docs/helm/helm_upgrade.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 05cdf1e4a..5406126fa 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -93,6 +93,7 @@ helm install [CHART] [flags] --no-crd-hook prevent CRD hooks from running, but run other hooks --no-hooks prevent hooks from running during install --password string chart repository password where to locate the requested chart + --render-subchart-notes render subchart notes along with the parent --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -128,4 +129,4 @@ helm install [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 1-Nov-2018 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index f18bcf6a7..df5bfe6ca 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -79,6 +79,7 @@ helm upgrade [RELEASE] [CHART] [flags] --no-hooks disable pre/post upgrade hooks --password string chart repository password where to locate the requested chart --recreate-pods performs pods restart for the resource if applicable + --render-subchart-notes render subchart notes along with parent --repo string chart repository url where to locate the requested chart --reset-values when upgrading, reset the values to the ones built into the chart --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. @@ -115,4 +116,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 24-Aug-2018 +###### Auto generated by spf13/cobra on 1-Nov-2018 From 7b66bc7775086cac8fc7ee66ef5af8927e91facf Mon Sep 17 00:00:00 2001 From: jgleonard Date: Thu, 1 Nov 2018 15:12:14 -0400 Subject: [PATCH 07/56] gofmt -s Signed-off-by: jgleonard --- pkg/proto/hapi/services/tiller.pb.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/proto/hapi/services/tiller.pb.go b/pkg/proto/hapi/services/tiller.pb.go index 813f15c33..e8eda8769 100644 --- a/pkg/proto/hapi/services/tiller.pb.go +++ b/pkg/proto/hapi/services/tiller.pb.go @@ -633,7 +633,7 @@ type InstallReleaseRequest struct { 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"` - SubNotes bool `protobuf:"varint,12,opt,name=subNotes" json:"subNotes,omitempty"` + SubNotes bool `protobuf:"varint,12,opt,name=subNotes" json:"subNotes,omitempty"` } func (m *InstallReleaseRequest) Reset() { *m = InstallReleaseRequest{} } @@ -711,7 +711,6 @@ func (m *InstallReleaseRequest) GetDisableCrdHook() bool { return false } - func (m *InstallReleaseRequest) GetSubNotes() bool { if m != nil { return m.SubNotes From b846560f4829ef725a425c43955e2c321755063a Mon Sep 17 00:00:00 2001 From: jgleonard Date: Wed, 7 Nov 2018 13:34:12 -0500 Subject: [PATCH 08/56] formatting Signed-off-by: jgleonard --- _proto/hapi/services/tiller.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index add468c73..1edd86025 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -212,7 +212,7 @@ message UpdateReleaseRequest { bool force = 11; // Description, if set, will set the description for the updated release string description = 12; - // Render subchart notes if enabled + // Render subchart notes if enabled bool subNotes = 13; } @@ -284,7 +284,7 @@ message InstallReleaseRequest { // Description, if set, will set the description for the installed release string description = 11; - bool subNotes = 12; + bool subNotes = 12; } From 9030e7ba7513b44fcdffe060c6a89c11c0f54160 Mon Sep 17 00:00:00 2001 From: jgleonard Date: Wed, 7 Nov 2018 13:35:12 -0500 Subject: [PATCH 09/56] fold subNotes into updateReq and instReq Signed-off-by: jgleonard --- pkg/helm/client.go | 2 -- pkg/helm/option.go | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index fcd30c106..771c7f3d1 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -95,7 +95,6 @@ func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ... req := &reqOpts.instReq req.Chart = chart req.Namespace = ns - req.SubNotes = reqOpts.subNotes req.DryRun = reqOpts.dryRun req.DisableHooks = reqOpts.disableHooks req.DisableCrdHook = reqOpts.disableCRDHook @@ -172,7 +171,6 @@ func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts req.DryRun = reqOpts.dryRun req.Name = rlsName req.DisableHooks = reqOpts.disableHooks - req.SubNotes = reqOpts.subNotes req.Recreate = reqOpts.recreate req.Force = reqOpts.force req.ResetValues = reqOpts.resetValues diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 04d394254..a34c4b8ae 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -54,8 +54,6 @@ type options struct { // if set, skip CRD hook only disableCRDHook bool // if set, render SubChart Notes - subNotes bool - // name of release releaseName string // tls.Config to use for rpc if tls enabled tlsConfig *tls.Config @@ -344,14 +342,14 @@ func InstallReuseName(reuse bool) InstallOption { // InstallSubNotes will (if true) instruct Tiller to render SubChart Notes func InstallSubNotes(enable bool) InstallOption { return func(opts *options) { - opts.subNotes = enable + opts.instReq.SubNotes = enable } } // UpgradeSubNotes will (if true) instruct Tiller to render SubChart Notes func UpgradeSubNotes(enable bool) UpdateOption { return func(opts *options) { - opts.subNotes = enable + opts.updateReq.SubNotes = enable } } From e3c6385959bca1d632ee59d1fccbcb1c612a53c5 Mon Sep 17 00:00:00 2001 From: Taylor Thomas Date: Thu, 3 Jan 2019 10:16:53 -0800 Subject: [PATCH 10/56] doc(release_checklist): Adds steps for categorizing changelogs Closes #5119 Also includes some formatting fixes to wrap lines at 80 chars Signed-off-by: Taylor Thomas --- docs/release_checklist.md | 156 ++++++++++++++++++++++++++++---------- 1 file changed, 117 insertions(+), 39 deletions(-) diff --git a/docs/release_checklist.md b/docs/release_checklist.md index c69db9d21..4011b6675 100644 --- a/docs/release_checklist.md +++ b/docs/release_checklist.md @@ -3,8 +3,8 @@ **IMPORTANT**: If your experience deviates from this document, please document the changes to keep it up-to-date. ## Release Meetings -As part of the release process, two of the weekly developer calls will be co-opted -as "release meetings." +As part of the release process, two of the weekly developer calls will be +co-opted as "release meetings." ### Start of the Release Cycle The first developer call after a release will be used as the release meeting to @@ -17,17 +17,19 @@ identified: - Any other important details for the community All of this information should be added to the GitHub milestone for the given -release. This should give the community and maintainers a clear set of guidelines -to follow when choosing whether or not to add issues and PRs to a given release. +release. This should give the community and maintainers a clear set of +guidelines to follow when choosing whether or not to add issues and PRs to a +given release. ### End (almost) of the Release Cycle The developer call closest to two weeks before the scheduled release date will be used to review any remaining PRs that should be pulled into the release. This -is the place to debate whether or not we should wait before cutting a release and -any other concerns. At the end of this meeting, if the release date has not been -pushed out, the first RC should be cut. Subsequent developer calls in between this -meeting and the release date should have some time set aside to see if any bugs -were found. Once the release date is reached, the final release can be cut +is the place to debate whether or not we should wait before cutting a release +and any other concerns. At the end of this meeting, if the release date has not +been pushed out, the first RC should be cut. Subsequent developer calls in +between this meeting and the release date should have some time set aside to see +if any bugs were found. Once the release date is reached, the final release can +be cut ## A Maintainer's Guide to Releasing Helm @@ -37,17 +39,28 @@ So you're in charge of a new release for Helm? Cool. Here's what to do... Just kidding! :trollface: -All releases will be of the form vX.Y.Z where X is the major version number, Y is the minor version number and Z is the patch release number. This project strictly follows [semantic versioning](http://semver.org/) so following this step is critical. +All releases will be of the form vX.Y.Z where X is the major version number, Y +is the minor version number and Z is the patch release number. This project +strictly follows [semantic versioning](http://semver.org/) so following this +step is critical. -It is important to note that this document assumes that the git remote in your repository that corresponds to "https://github.com/helm/helm" is named "upstream". If yours is not (for example, if you've chosen to name it "origin" or something similar instead), be sure to adjust the listed snippets for your local environment accordingly. If you are not sure what your upstream remote is named, use a command like `git remote -v` to find out. +It is important to note that this document assumes that the git remote in your +repository that corresponds to "https://github.com/helm/helm" is named +"upstream". If yours is not (for example, if you've chosen to name it "origin" +or something similar instead), be sure to adjust the listed snippets for your +local environment accordingly. If you are not sure what your upstream remote is +named, use a command like `git remote -v` to find out. -If you don't have an upstream remote, you can add one easily using something like: +If you don't have an upstream remote, you can add one easily using something +like: ```shell git remote add upstream git@github.com:helm/helm.git ``` -In this doc, we are going to reference a few environment variables as well, which you may want to set for convenience. For major/minor releases, use the following: +In this doc, we are going to reference a few environment variables as well, +which you may want to set for convenience. For major/minor releases, use the +following: ```shell export RELEASE_NAME=vX.Y.0 @@ -68,7 +81,10 @@ export RELEASE_CANDIDATE_NAME="$RELEASE_NAME-rc.1" ### Major/Minor Releases -Major releases are for new feature additions and behavioral changes *that break backwards compatibility*. Minor releases are for new feature additions that do not break backwards compatibility. To create a major or minor release, start by creating a `release-vX.Y.0` branch from master. +Major releases are for new feature additions and behavioral changes *that break +backwards compatibility*. Minor releases are for new feature additions that do +not break backwards compatibility. To create a major or minor release, start by +creating a `release-vX.Y.0` branch from master. ```shell git fetch upstream @@ -76,11 +92,13 @@ git checkout upstream/master git checkout -b $RELEASE_BRANCH_NAME ``` -This new branch is going to be the base for the release, which we are going to iterate upon later. +This new branch is going to be the base for the release, which we are going to +iterate upon later. ### Patch releases -Patch releases are a few critical cherry-picked fixes to existing releases. Start by creating a `release-vX.Y.Z` branch from the latest patch release. +Patch releases are a few critical cherry-picked fixes to existing releases. +Start by creating a `release-vX.Y.Z` branch from the latest patch release. ```shell git fetch upstream --tags @@ -88,7 +106,8 @@ git checkout $PREVIOUS_PATCH_RELEASE git checkout -b $RELEASE_BRANCH_NAME ``` -From here, we can cherry-pick the commits we want to bring into the patch release: +From here, we can cherry-pick the commits we want to bring into the patch +release: ```shell # get the commits ids we want to cherry-pick @@ -98,11 +117,13 @@ git cherry-pick -x git cherry-pick -x ``` -This new branch is going to be the base for the release, which we are going to iterate upon later. +This new branch is going to be the base for the release, which we are going to +iterate upon later. ## 2. Change the Version Number in Git -When doing a minor release, make sure to update pkg/version/version.go with the new release version. +When doing a minor release, make sure to update pkg/version/version.go with the +new release version. ```shell $ git diff pkg/version/version.go @@ -128,28 +149,36 @@ git commit -m "bump version to $RELEASE_CANDIDATE_NAME" ## 3. Commit and Push the Release Branch -In order for others to start testing, we can now push the release branch upstream and start the test process. +In order for others to start testing, we can now push the release branch +upstream and start the test process. ```shell git push upstream $RELEASE_BRANCH_NAME ``` -Make sure to check [helm on CircleCI](https://circleci.com/gh/helm/helm) and make sure the release passed CI before proceeding. +Make sure to check [helm on CircleCI](https://circleci.com/gh/helm/helm) and +make sure the release passed CI before proceeding. -If anyone is available, let others peer-review the branch before continuing to ensure that all the proper changes have been made and all of the commits for the release are there. +If anyone is available, let others peer-review the branch before continuing to +ensure that all the proper changes have been made and all of the commits for the +release are there. ## 4. Create a Release Candidate -Now that the release branch is out and ready, it is time to start creating and iterating on release candidates. +Now that the release branch is out and ready, it is time to start creating and +iterating on release candidates. ```shell git tag --sign --annotate "${RELEASE_CANDIDATE_NAME}" --message "Helm release ${RELEASE_CANDIDATE_NAME}" git push upstream $RELEASE_CANDIDATE_NAME ``` -CircleCI will automatically create a tagged release image and client binary to test with. +CircleCI will automatically create a tagged release image and client binary to +test with. -For testers, the process to start testing after CircleCI finishes building the artifacts involves the following steps to grab the client from Google Cloud Storage: +For testers, the process to start testing after CircleCI finishes building the +artifacts involves the following steps to grab the client from Google Cloud +Storage: linux/amd64, using /bin/bash: @@ -169,21 +198,35 @@ windows/amd64, using PowerShell: PS C:\> Invoke-WebRequest -Uri "https://kubernetes-helm.storage.googleapis.com/helm-$RELEASE_CANDIDATE_NAME-windows-amd64.zip" -OutFile "helm-$ReleaseCandidateName-windows-amd64.zip" ``` -Then, unpack and move the binary to somewhere on your $PATH, or move it somewhere and add it to your $PATH (e.g. /usr/local/bin/helm for linux/macOS, C:\Program Files\helm\helm.exe for Windows). +Then, unpack and move the binary to somewhere on your $PATH, or move it +somewhere and add it to your $PATH (e.g. /usr/local/bin/helm for linux/macOS, +C:\Program Files\helm\helm.exe for Windows). ## 5. Iterate on Successive Release Candidates -Spend several days explicitly investing time and resources to try and break helm in every possible way, documenting any findings pertinent to the release. This time should be spent testing and finding ways in which the release might have caused various features or upgrade environments to have issues, not coding. During this time, the release is in code freeze, and any additional code changes will be pushed out to the next release. +Spend several days explicitly investing time and resources to try and break helm +in every possible way, documenting any findings pertinent to the release. This +time should be spent testing and finding ways in which the release might have +caused various features or upgrade environments to have issues, not coding. +During this time, the release is in code freeze, and any additional code changes +will be pushed out to the next release. -During this phase, the $RELEASE_BRANCH_NAME branch will keep evolving as you will produce new release candidates. The frequency of new candidates is up to the release manager: use your best judgement taking into account the severity of reported issues, testers' availability, and the release deadline date. Generally speaking, it is better to let a release roll over the deadline than to ship a broken release. +During this phase, the $RELEASE_BRANCH_NAME branch will keep evolving as you +will produce new release candidates. The frequency of new candidates is up to +the release manager: use your best judgement taking into account the severity of +reported issues, testers' availability, and the release deadline date. Generally +speaking, it is better to let a release roll over the deadline than to ship a +broken release. -Each time you'll want to produce a new release candidate, you will start by adding commits to the branch by cherry-picking from master: +Each time you'll want to produce a new release candidate, you will start by +adding commits to the branch by cherry-picking from master: ```shell git cherry-pick -x ``` -You will also want to update the release version number and the CHANGELOG as we did in steps 2 and 3 as separate commits. +You will also want to update the release version number and the CHANGELOG as we +did in steps 2 and 3 as separate commits. After that, tag it and notify users of the new release candidate: @@ -197,7 +240,9 @@ From here on just repeat this process, continuously testing until you're happy w ## 6. Finalize the Release -When you're finally happy with the quality of a release candidate, you can move on and create the real thing. Double-check one last time to make sure everything is in order, then finally push the release tag. +When you're finally happy with the quality of a release candidate, you can move +on and create the real thing. Double-check one last time to make sure everything +is in order, then finally push the release tag. ```shell git checkout $RELEASE_BRANCH_NAME @@ -207,9 +252,13 @@ git push upstream $RELEASE_NAME ## 7. Write the Release Notes -We will auto-generate a changelog based on the commits that occurred during a release cycle, but it is usually more beneficial to the end-user if the release notes are hand-written by a human being/marketing team/dog. +We will auto-generate a changelog based on the commits that occurred during a +release cycle, but it is usually more beneficial to the end-user if the release +notes are hand-written by a human being/marketing team/dog. -If you're releasing a major/minor release, listing notable user-facing features is usually sufficient. For patch releases, do the same, but make note of the symptoms and who is affected. +If you're releasing a major/minor release, listing notable user-facing features +is usually sufficient. For patch releases, do the same, but make note of the +symptoms and who is affected. An example release note for a minor release would look like this: @@ -226,6 +275,13 @@ The community keeps growing, and we'd love to see you there! - Hang out at the Public Developer Call: Thursday, 9:30 Pacific via [Zoom](https://zoom.us/j/696660622) - Test, debug, and contribute charts: [GitHub/helm/charts](https://github.com/helm/charts) +## Features and Changes + +- Major +- features +- list +- here + ## Installation and Upgrading Download Helm X.Y. The common platform binaries are here: @@ -250,23 +306,45 @@ The [Quickstart Guide](https://docs.helm.sh/using_helm/#quickstart-guide) will g ## Changelog -- chore(*): bump version to v2.7.0 08c1144f5eb3e3b636d9775617287cc26e53dba4 (Adam Reese) +### Features +- ref(*): kubernetes v1.11 support efadbd88035654b2951f3958167afed014c46bc6 (Adam Reese) +- feat(helm): add $HELM_KEY_PASSPHRASE environment variable for signing helm charts (#4778) 1e26b5300b5166fabb90002535aacd2f9cc7d787 + +### Bug fixes - fix circle not building tags f4f932fabd197f7e6d608c8672b33a483b4b76fa (Matthew Fisher) + +### Code cleanup +- ref(kube): Gets rid of superfluous Sprintf call 3071a16f5eb3a2b646d9795617287cc26e53dba4 (Taylor Thomas) +- chore(*): bump version to v2.7.0 08c1144f5eb3e3b636d9775617287cc26e53dba4 (Adam Reese) + +### Documentation Changes +- docs(release_checklist): fix changelog generation command (#4694) 8442851a5c566a01d9b4c69b368d64daa04f6a7f (Matthew Fisher) ``` -The changelog at the bottom of the release notes can be generated with this command: +The changelog at the bottom of the release notes can be generated with this +command: ```shell PREVIOUS_RELEASE=vX.Y.Z git log --no-merges --pretty=format:'- %s %H (%aN)' $PREVIOUS_RELEASE..$RELEASE_NAME ``` -Once finished, go into GitHub and edit the release notes for the tagged release with the notes written here. +After generating the changelog, you will need to categorize the changes as shown +in the example above. + +Once finished, go into GitHub and edit the release notes for the tagged release +with the notes written here. ## 8. Evangelize -Congratulations! You're done. Go grab yourself a $DRINK_OF_CHOICE. You've earned it. +Congratulations! You're done. Go grab yourself a $DRINK_OF_CHOICE. You've earned +it. -After enjoying a nice $DRINK_OF_CHOICE, go forth and announce the glad tidings of the new release in Slack and on Twitter. You should also notify any key partners in the helm community such as the homebrew formula maintainers, the owners of incubator projects (e.g. ChartMuseum) and any other interested parties. +After enjoying a nice $DRINK_OF_CHOICE, go forth and announce the glad tidings +of the new release in Slack and on Twitter. You should also notify any key +partners in the helm community such as the homebrew formula maintainers, the +owners of incubator projects (e.g. ChartMuseum) and any other interested +parties. -Optionally, write a blog post about the new release and showcase some of the new features on there! +Optionally, write a blog post about the new release and showcase some of the new +features on there! From 4634f5f2faa0caa7de390c95c7d27be22d56a156 Mon Sep 17 00:00:00 2001 From: Eric Thiebaut-George Date: Tue, 8 Jan 2019 16:14:43 +0000 Subject: [PATCH 11/56] Recommend using crd-install instead of pre-install (#5139) * 5138 Recommended using crd-install instead of pre-install Signed-off-by: Eric Thiebaut-George * 5138 Updated section title Signed-off-by: Eric Thiebaut-George --- docs/chart_best_practices/custom_resource_definitions.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/chart_best_practices/custom_resource_definitions.md b/docs/chart_best_practices/custom_resource_definitions.md index 96690dc9b..ee6fcf470 100644 --- a/docs/chart_best_practices/custom_resource_definitions.md +++ b/docs/chart_best_practices/custom_resource_definitions.md @@ -28,10 +28,10 @@ resources that use that CRD in _another_ chart. In this method, each chart must be installed separately. -### Method 2: Pre-install Hooks +### Method 2: Crd-install Hooks -To package the two together, add a `pre-install` hook to the CRD definition so +To package the two together, add a `crd-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 +Note that if you create the CRD with a `crd-install` hook, that CRD definition will not be deleted when `helm delete` is run. From e70bea6adb6825e4f0cce1917121e6e000bf9049 Mon Sep 17 00:00:00 2001 From: JoeWrightss <42261994+JoeWrightss@users.noreply.github.com> Date: Thu, 10 Jan 2019 05:09:50 +0800 Subject: [PATCH 12/56] Fix some spelling errors (#5114) Signed-off-by: JoeWrightss --- _proto/hapi/services/tiller.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_proto/hapi/services/tiller.proto b/_proto/hapi/services/tiller.proto index 8eba963e4..e00c50caf 100644 --- a/_proto/hapi/services/tiller.proto +++ b/_proto/hapi/services/tiller.proto @@ -76,7 +76,7 @@ service ReleaseService { rpc RollbackRelease(RollbackReleaseRequest) returns (RollbackReleaseResponse) { } - // ReleaseHistory retrieves a releasse's history. + // ReleaseHistory retrieves a release's history. rpc GetHistory(GetHistoryRequest) returns (GetHistoryResponse) { } @@ -298,7 +298,7 @@ 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 + // Description, if set, will set the description for the uninstalled release string description = 5; } From 8015fc35707050ae4578000cfe89fcba66112f07 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Thu, 10 Jan 2019 08:09:55 -0800 Subject: [PATCH 13/56] bump version to v2.12 (#4991) (cherry picked from commit 657557947c62efca6c9b8f81a62540e27901717b) Signed-off-by: Matthew Fisher --- pkg/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/version/version.go b/pkg/version/version.go index dae739500..692167b83 100644 --- a/pkg/version/version.go +++ b/pkg/version/version.go @@ -26,7 +26,7 @@ var ( // Increment major number for new feature additions and behavioral changes. // Increment minor number for bug fixes and performance enhancements. // Increment patch number for critical fixes to existing releases. - Version = "v2.11" + Version = "v2.12" // BuildMetadata is extra build time data BuildMetadata = "unreleased" From 893c3b61f6594232a57f232034afc418d2466878 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20K=C3=B6hler?= <9337156+axdotl@users.noreply.github.com> Date: Thu, 10 Jan 2019 18:05:44 +0100 Subject: [PATCH 14/56] Add chart name check to lint (#3773) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Axel Köhler --- .gitignore | 1 + pkg/lint/rules/chartfile.go | 12 ++++++++++-- pkg/lint/rules/chartfile_test.go | 16 +++++++++++++--- pkg/lint/rules/testdata/badnamechart/Chart.yaml | 4 ++++ pkg/lint/rules/testdata/badnamechart/values.yaml | 1 + 5 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 pkg/lint/rules/testdata/badnamechart/Chart.yaml create mode 100644 pkg/lint/rules/testdata/badnamechart/values.yaml diff --git a/.gitignore b/.gitignore index 7fdfdcf2a..2414f7f2b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ rootfs/rudder vendor/ *.exe .idea/ +*.iml \ No newline at end of file diff --git a/pkg/lint/rules/chartfile.go b/pkg/lint/rules/chartfile.go index 12f028af1..95ee38f0b 100644 --- a/pkg/lint/rules/chartfile.go +++ b/pkg/lint/rules/chartfile.go @@ -46,7 +46,8 @@ func Chartfile(linter *support.Linter) { return } - linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartName(chartFile)) + linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartNamePresence(chartFile)) + linter.RunLinterRule(support.WarningSev, chartFileName, validateChartNameFormat(chartFile)) linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartNameDirMatch(linter.ChartDir, chartFile)) // Chart metadata @@ -74,13 +75,20 @@ func validateChartYamlFormat(chartFileError error) error { return nil } -func validateChartName(cf *chart.Metadata) error { +func validateChartNamePresence(cf *chart.Metadata) error { if cf.Name == "" { return errors.New("name is required") } return nil } +func validateChartNameFormat(cf *chart.Metadata) error { + if strings.Contains(cf.Name, ".") { + return errors.New("name should be lower case letters and numbers. Words may be separated with dashes") + } + return nil +} + func validateChartNameDirMatch(chartDir string, cf *chart.Metadata) error { if cf.Name != filepath.Base(chartDir) { return fmt.Errorf("directory name (%s) and chart name (%s) must be the same", filepath.Base(chartDir), cf.Name) diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index 235e5fc4c..2422a2d10 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -29,17 +29,20 @@ import ( ) const ( - badChartDir = "testdata/badchartfile" - goodChartDir = "testdata/goodone" + badChartDir = "testdata/badchartfile" + badNameChartDir = "testdata/badnamechart" + goodChartDir = "testdata/goodone" ) var ( badChartFilePath = filepath.Join(badChartDir, "Chart.yaml") + badNameChartFilePath = filepath.Join(badNameChartDir, "Chart.yaml") goodChartFilePath = filepath.Join(goodChartDir, "Chart.yaml") nonExistingChartFilePath = filepath.Join(os.TempDir(), "Chart.yaml") ) var badChart, chatLoadRrr = chartutil.LoadChartfile(badChartFilePath) +var badNameChart, _ = chartutil.LoadChartfile(badNameChartFilePath) var goodChart, _ = chartutil.LoadChartfile(goodChartFilePath) // Validation functions Test @@ -66,12 +69,19 @@ func TestValidateChartYamlFormat(t *testing.T) { } func TestValidateChartName(t *testing.T) { - err := validateChartName(badChart) + err := validateChartNamePresence(badChart) if err == nil { t.Errorf("validateChartName to return a linter error, got no error") } } +func TestValidateChartNameFormat(t *testing.T) { + err := validateChartNameFormat(badNameChart) + if err == nil { + t.Errorf("validateChartNameFormat to return a linter error, got no error") + } +} + func TestValidateChartNameDirMatch(t *testing.T) { err := validateChartNameDirMatch(goodChartDir, goodChart) if err != nil { diff --git a/pkg/lint/rules/testdata/badnamechart/Chart.yaml b/pkg/lint/rules/testdata/badnamechart/Chart.yaml new file mode 100644 index 000000000..6ac6cfa42 --- /dev/null +++ b/pkg/lint/rules/testdata/badnamechart/Chart.yaml @@ -0,0 +1,4 @@ +name: bad.chart.name +description: A Helm chart for Kubernetes +version: 0.1.0 +icon: http://riverrun.io diff --git a/pkg/lint/rules/testdata/badnamechart/values.yaml b/pkg/lint/rules/testdata/badnamechart/values.yaml new file mode 100644 index 000000000..54deecf74 --- /dev/null +++ b/pkg/lint/rules/testdata/badnamechart/values.yaml @@ -0,0 +1 @@ +# Default values for badchartname. From 5603fe8d3e6ca9347ea0c2a94b2b33a55f5134cd Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Mon, 14 Jan 2019 10:03:35 -0700 Subject: [PATCH 15/56] fix: perform extra validation on paths in tar archives (#5165) * fix: perform extra validation on paths in tar archives Signed-off-by: Matt Butcher * fix: Cover a few Windows cases and also remove a duplicate tar reader Signed-off-by: Matt Butcher * fix: removed debug output Signed-off-by: Matt Butcher * fix: Expand again preserves the files verbatim Also added tests for Expand Signed-off-by: Matt Butcher * fix: add license block and remove println Signed-off-by: Matt Butcher --- pkg/chartutil/expand.go | 64 +++++++++--------- pkg/chartutil/expand_test.go | 121 +++++++++++++++++++++++++++++++++++ pkg/chartutil/load.go | 43 +++++++++++-- pkg/chartutil/load_test.go | 97 ++++++++++++++++++++++++++++ 4 files changed, 289 insertions(+), 36 deletions(-) create mode 100644 pkg/chartutil/expand_test.go diff --git a/pkg/chartutil/expand.go b/pkg/chartutil/expand.go index 1d49b159f..9ed021d9c 100644 --- a/pkg/chartutil/expand.go +++ b/pkg/chartutil/expand.go @@ -17,58 +17,60 @@ limitations under the License. package chartutil import ( - "archive/tar" - "compress/gzip" + "errors" "io" + "io/ioutil" "os" "path/filepath" + + securejoin "github.com/cyphar/filepath-securejoin" ) // Expand uncompresses and extracts a chart into the specified directory. func Expand(dir string, r io.Reader) error { - gr, err := gzip.NewReader(r) + files, err := loadArchiveFiles(r) if err != nil { return err } - defer gr.Close() - tr := tar.NewReader(gr) - for { - header, err := tr.Next() - if err == io.EOF { - break - } else if err != nil { - return err - } - //split header name and create missing directories - d, _ := filepath.Split(header.Name) - fullDir := filepath.Join(dir, d) - _, err = os.Stat(fullDir) - if err != nil && d != "" { - if err := os.MkdirAll(fullDir, 0700); err != nil { + // Get the name of the chart + var chartName string + for _, file := range files { + if file.Name == "Chart.yaml" { + ch, err := UnmarshalChartfile(file.Data) + if err != nil { return err } + chartName = ch.GetName() } + } + if chartName == "" { + return errors.New("chart name not specified") + } - path := filepath.Clean(filepath.Join(dir, header.Name)) - info := header.FileInfo() - if info.IsDir() { - if err = os.MkdirAll(path, info.Mode()); err != nil { - return err - } - continue - } + // Find the base directory + chartdir, err := securejoin.SecureJoin(dir, chartName) + if err != nil { + return err + } - file, err := os.OpenFile(path, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, info.Mode()) + // Copy all files verbatim. We don't parse these files because parsing can remove + // comments. + for _, file := range files { + outpath, err := securejoin.SecureJoin(chartdir, file.Name) if err != nil { return err } - _, err = io.Copy(file, tr) - if err != nil { - file.Close() + + // Make sure the necessary subdirs get created. + basedir := filepath.Dir(outpath) + if err := os.MkdirAll(basedir, 0755); err != nil { + return err + } + + if err := ioutil.WriteFile(outpath, file.Data, 0644); err != nil { return err } - file.Close() } return nil } diff --git a/pkg/chartutil/expand_test.go b/pkg/chartutil/expand_test.go new file mode 100644 index 000000000..80fd4416b --- /dev/null +++ b/pkg/chartutil/expand_test.go @@ -0,0 +1,121 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package chartutil + +import ( + "io/ioutil" + "os" + "path/filepath" + "testing" +) + +func TestExpand(t *testing.T) { + dest, err := ioutil.TempDir("", "helm-testing-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dest) + + reader, err := os.Open("testdata/frobnitz-1.2.3.tgz") + if err != nil { + t.Fatal(err) + } + + if err := Expand(dest, reader); err != nil { + t.Fatal(err) + } + + expectedChartPath := filepath.Join(dest, "frobnitz") + fi, err := os.Stat(expectedChartPath) + if err != nil { + t.Fatal(err) + } + if !fi.IsDir() { + t.Fatalf("expected a chart directory at %s", expectedChartPath) + } + + dir, err := os.Open(expectedChartPath) + if err != nil { + t.Fatal(err) + } + + fis, err := dir.Readdir(0) + if err != nil { + t.Fatal(err) + } + + expectLen := 12 + if len(fis) != expectLen { + t.Errorf("Expected %d files, but got %d", expectLen, len(fis)) + } + + for _, fi := range fis { + expect, err := os.Stat(filepath.Join("testdata", "frobnitz", fi.Name())) + if err != nil { + t.Fatal(err) + } + if fi.Size() != expect.Size() { + t.Errorf("Expected %s to have size %d, got %d", fi.Name(), expect.Size(), fi.Size()) + } + } +} + +func TestExpandFile(t *testing.T) { + dest, err := ioutil.TempDir("", "helm-testing-") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(dest) + + if err := ExpandFile(dest, "testdata/frobnitz-1.2.3.tgz"); err != nil { + t.Fatal(err) + } + + expectedChartPath := filepath.Join(dest, "frobnitz") + fi, err := os.Stat(expectedChartPath) + if err != nil { + t.Fatal(err) + } + if !fi.IsDir() { + t.Fatalf("expected a chart directory at %s", expectedChartPath) + } + + dir, err := os.Open(expectedChartPath) + if err != nil { + t.Fatal(err) + } + + fis, err := dir.Readdir(0) + if err != nil { + t.Fatal(err) + } + + expectLen := 12 + if len(fis) != expectLen { + t.Errorf("Expected %d files, but got %d", expectLen, len(fis)) + } + + for _, fi := range fis { + expect, err := os.Stat(filepath.Join("testdata", "frobnitz", fi.Name())) + if err != nil { + t.Fatal(err) + } + if fi.Size() != expect.Size() { + t.Errorf("Expected %s to have size %d, got %d", fi.Name(), expect.Size(), fi.Size()) + } + } +} diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index 9f1c80c85..f4741516e 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -25,7 +25,9 @@ import ( "io" "io/ioutil" "os" + "path" "path/filepath" + "regexp" "strings" "github.com/golang/protobuf/ptypes/any" @@ -63,11 +65,13 @@ type BufferedFile struct { Data []byte } -// LoadArchive loads from a reader containing a compressed tar archive. -func LoadArchive(in io.Reader) (*chart.Chart, error) { +var drivePathPattern = regexp.MustCompile(`^[a-zA-Z]:/`) + +// loadArchiveFiles loads files out of an archive +func loadArchiveFiles(in io.Reader) ([]*BufferedFile, error) { unzipped, err := gzip.NewReader(in) if err != nil { - return &chart.Chart{}, err + return nil, err } defer unzipped.Close() @@ -80,7 +84,7 @@ func LoadArchive(in io.Reader) (*chart.Chart, error) { break } if err != nil { - return &chart.Chart{}, err + return nil, err } if hd.FileInfo().IsDir() { @@ -101,12 +105,33 @@ func LoadArchive(in io.Reader) (*chart.Chart, error) { // Normalize the path to the / delimiter n = strings.Replace(n, delimiter, "/", -1) + if path.IsAbs(n) { + return nil, errors.New("chart illegally contains absolute paths") + } + + n = path.Clean(n) + if n == "." { + // In this case, the original path was relative when it should have been absolute. + return nil, errors.New("chart illegally contains empty path") + } + if strings.HasPrefix(n, "..") { + return nil, errors.New("chart illegally references parent directory") + } + + // In some particularly arcane acts of path creativity, it is possible to intermix + // UNIX and Windows style paths in such a way that you produce a result of the form + // c:/foo even after all the built-in absolute path checks. So we explicitly check + // for this condition. + if drivePathPattern.MatchString(n) { + return nil, errors.New("chart contains illegally named files") + } + if parts[0] == "Chart.yaml" { return nil, errors.New("chart yaml not in base directory") } if _, err := io.Copy(b, tr); err != nil { - return &chart.Chart{}, err + return files, err } files = append(files, &BufferedFile{Name: n, Data: b.Bytes()}) @@ -116,7 +141,15 @@ func LoadArchive(in io.Reader) (*chart.Chart, error) { if len(files) == 0 { return nil, errors.New("no files in chart archive") } + return files, nil +} +// LoadArchive loads from a reader containing a compressed tar archive. +func LoadArchive(in io.Reader) (*chart.Chart, error) { + files, err := loadArchiveFiles(in) + if err != nil { + return nil, err + } return LoadFiles(files) } diff --git a/pkg/chartutil/load_test.go b/pkg/chartutil/load_test.go index 5cb15fbdc..c031a6a96 100644 --- a/pkg/chartutil/load_test.go +++ b/pkg/chartutil/load_test.go @@ -17,8 +17,14 @@ limitations under the License. package chartutil import ( + "archive/tar" + "compress/gzip" + "io/ioutil" + "os" "path" + "path/filepath" "testing" + "time" "k8s.io/helm/pkg/proto/hapi/chart" ) @@ -43,6 +49,97 @@ func TestLoadFile(t *testing.T) { verifyRequirements(t, c) } +func TestLoadArchive_InvalidArchive(t *testing.T) { + tmpdir, err := ioutil.TempDir("", "helm-test-") + if err != nil { + t.Fatal(err) + } + defer os.Remove(tmpdir) + + writeTar := func(filename, internalPath string, body []byte) { + dest, err := os.Create(filename) + if err != nil { + t.Fatal(err) + } + zipper := gzip.NewWriter(dest) + tw := tar.NewWriter(zipper) + + h := &tar.Header{ + Name: internalPath, + Mode: 0755, + Size: int64(len(body)), + ModTime: time.Now(), + } + if err := tw.WriteHeader(h); err != nil { + t.Fatal(err) + } + if _, err := tw.Write(body); err != nil { + t.Fatal(err) + } + tw.Close() + zipper.Close() + dest.Close() + } + + for _, tt := range []struct { + chartname string + internal string + expectError string + }{ + {"illegal-dots.tgz", "../../malformed-helm-test", "chart illegally references parent directory"}, + {"illegal-dots2.tgz", "/foo/../../malformed-helm-test", "chart illegally references parent directory"}, + {"illegal-dots3.tgz", "/../../malformed-helm-test", "chart illegally references parent directory"}, + {"illegal-dots4.tgz", "./../../malformed-helm-test", "chart illegally references parent directory"}, + {"illegal-name.tgz", "./.", "chart illegally contains empty path"}, + {"illegal-name2.tgz", "/./.", "chart illegally contains empty path"}, + {"illegal-name3.tgz", "missing-leading-slash", "chart illegally contains empty path"}, + {"illegal-name4.tgz", "/missing-leading-slash", "chart metadata (Chart.yaml) missing"}, + {"illegal-abspath.tgz", "//foo", "chart illegally contains absolute paths"}, + {"illegal-abspath2.tgz", "///foo", "chart illegally contains absolute paths"}, + {"illegal-abspath3.tgz", "\\\\foo", "chart illegally contains absolute paths"}, + {"illegal-abspath3.tgz", "\\..\\..\\foo", "chart illegally references parent directory"}, + + // Under special circumstances, this can get normalized to things that look like absolute Windows paths + {"illegal-abspath4.tgz", "\\.\\c:\\\\foo", "chart contains illegally named files"}, + {"illegal-abspath5.tgz", "/./c://foo", "chart contains illegally named files"}, + {"illegal-abspath6.tgz", "\\\\?\\Some\\windows\\magic", "chart illegally contains absolute paths"}, + } { + illegalChart := filepath.Join(tmpdir, tt.chartname) + writeTar(illegalChart, tt.internal, []byte("hello: world")) + _, err = Load(illegalChart) + if err == nil { + t.Fatal("expected error when unpacking illegal files") + } + if err.Error() != tt.expectError { + t.Errorf("Expected %q, got %q for %s", tt.expectError, err.Error(), tt.chartname) + } + } + + // Make sure that absolute path gets interpreted as relative + illegalChart := filepath.Join(tmpdir, "abs-path.tgz") + writeTar(illegalChart, "/Chart.yaml", []byte("hello: world")) + _, err = Load(illegalChart) + if err.Error() != "invalid chart (Chart.yaml): name must not be empty" { + t.Error(err) + } + + // And just to validate that the above was not spurious + illegalChart = filepath.Join(tmpdir, "abs-path2.tgz") + writeTar(illegalChart, "files/whatever.yaml", []byte("hello: world")) + _, err = Load(illegalChart) + if err.Error() != "chart metadata (Chart.yaml) missing" { + t.Error(err) + } + + // Finally, test that drive letter gets stripped off on Windows + illegalChart = filepath.Join(tmpdir, "abs-winpath.tgz") + writeTar(illegalChart, "c:\\Chart.yaml", []byte("hello: world")) + _, err = Load(illegalChart) + if err.Error() != "invalid chart (Chart.yaml): name must not be empty" { + t.Error(err) + } +} + func TestLoadFiles(t *testing.T) { goodFiles := []*BufferedFile{ { From 315ed81116235882967f4021b739eafa44ebec5e Mon Sep 17 00:00:00 2001 From: Jon Leonard Date: Wed, 16 Jan 2019 11:32:54 -0500 Subject: [PATCH 16/56] Restore comment text Signed-off-by: Jon Leonard --- pkg/helm/option.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/helm/option.go b/pkg/helm/option.go index a34c4b8ae..391913094 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -53,7 +53,7 @@ type options struct { disableHooks bool // if set, skip CRD hook only disableCRDHook bool - // if set, render SubChart Notes + // name of release releaseName string // tls.Config to use for rpc if tls enabled tlsConfig *tls.Config From a4bc9fd7330fc3886caba52d1a33f0c8a907e4d4 Mon Sep 17 00:00:00 2001 From: Deepak Sattiraju Date: Thu, 17 Jan 2019 22:04:32 +0530 Subject: [PATCH 17/56] Fixing helm search display format #5148 (#5162) Signed-off-by: ds-ms --- cmd/helm/search.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/search.go b/cmd/helm/search.go index 84f328d41..2e7611609 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -154,7 +154,7 @@ func (s *searchCmd) buildIndex() (*search.Index, error) { f := s.helmhome.CacheIndex(n) ind, err := repo.LoadIndexFile(f) if err != nil { - fmt.Fprintf(s.out, "WARNING: Repo %q is corrupt or missing. Try 'helm repo update'.", n) + fmt.Fprintf(s.out, "WARNING: Repo %q is corrupt or missing. Try 'helm repo update'.\n", n) continue } From 6453dbe575eeea92c5d40a9898a24a22b517b780 Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Mon, 21 Jan 2019 11:49:43 +0000 Subject: [PATCH 18/56] Add content on how community members can help review PRs Updated text to better elaborate on he process and also some small other nits/updates. Signed-off-by: Martin Hickey --- CONTRIBUTING.md | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aba3388a6..7736cbd6b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -84,12 +84,12 @@ your PR will be rejected by the automated DCO check. Whether you are a user or contributor, official support channels include: -- GitHub [issues](https://github.com/helm/helm/issues/new) -- Slack [Kubernetes Slack](http://slack.kubernetes.io/): - - User: #helm-users - - Contributor: #helm-dev +- [Issues](https://github.com/helm/helm/issues) +- Slack: + - User: [#helm-users](https://kubernetes.slack.com/messages/C0NH30761/details/) + - Contributor: [#helm-dev](https://kubernetes.slack.com/messages/C51E88VDG/) -Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the issue you're facing, or it's a known issue that we're already aware of. +Before opening a new issue or submitting a new pull request, it's helpful to search the project - it's likely that another user has already reported the issue you're facing, or it's a known issue that we're already aware of. It is also worth asking on the Slack channels. ## Milestones @@ -180,33 +180,33 @@ contributing to Helm. All issue types follow the same general lifecycle. Differe Coding conventions and standards are explained in the official developer docs: [Developers Guide](docs/developers.md) -The next section contains more information on the workflow followed for PRs +The next section contains more information on the workflow followed for Pull Requests. ## Pull Requests -Like any good open source project, we use Pull Requests to track code changes +Like any good open source project, we use Pull Requests (PRs) to track code changes. ### PR Lifecycle 1. PR creation + - PRs are usually created to fix or else be a subset of other PRs that fix a particular issue. - We more than welcome PRs that are currently in progress. They are a great way to keep track of important work that is in-flight, but useful for others to see. If a PR is a work in progress, it **must** be prefaced with "WIP: [title]". Once the PR is ready for review, remove "WIP" from the title. - - It is preferred, but not required, to have a PR tied to a specific issue. + - It is preferred, but not required, to have a PR tied to a specific issue. There can be + circumstances where if it is a quick fix then an issue might be overkill. The details provided + in the PR description would suffice in this case. 2. Triage - The maintainer in charge of triaging will apply the proper labels for the issue. This should include at least a size label, `bug` or `feature`, and `awaiting review` once all labels are applied. - See the [Labels section](#labels) for full details on the definitions of labels + See the [Labels section](#labels) for full details on the definitions of labels. - Add the PR to the correct milestone. This should be the same as the issue the PR closes. 3. Assigning reviews - Once a review has the `awaiting review` label, maintainers will review them as schedule permits. The maintainer who takes the issue should self-request a review. - - Reviews from others in the community, especially those who have encountered a bug or have - requested a feature, are highly encouraged, but not required. Maintainer reviews **are** required - before any merge - Any PR with the `size/large` label requires 2 review approvals from maintainers before it can be - merged. Those with `size/medium` are per the judgement of the maintainers + merged. Those with `size/medium` or `size/small` are per the judgement of the maintainers. 4. Reviewing/Discussion - Once a maintainer begins reviewing a PR, they will remove the `awaiting review` label and add the `in progress` label so the person submitting knows that it is being worked on. This is @@ -214,17 +214,24 @@ Like any good open source project, we use Pull Requests to track code changes - All reviews will be completed using Github review tool. - A "Comment" review should be used when there are questions about the code that should be answered, but that don't involve code changes. This type of review does not count as approval. - - A "Changes Requested" review indicates that changes to the code need to be made before they will be merged. - - Reviewers should update labels as needed (such as `needs rebase`) -5. Address comments by answering questions or changing code + - A "Changes Requested" review indicates that changes to the code need to be made before they will be + merged. + - Reviewers (maintainers) should update labels as needed (such as `needs rebase`). + - Reviews are also welcome from others in the community, especially those who have encountered a bug or + have requested a feature. In the code review, a message can be added, as well as `LGTM` if the PR is + good to merge. It’s also possible to add comments to specific lines in a file, for giving context + to the comment. +5. PR owner should try to be responsive to comments by answering questions or changing code. If the + owner is unsure of any comment, reach out to the person who added the comment in + [#helm-dev](https://kubernetes.slack.com/messages/C51E88VDG/). Once all comments have been addressed, + the PR is ready to be merged. 6. Merge or close - PRs should stay open until merged or if they have not been active for more than 30 days. This will help keep the PR queue to a manageable size and reduce noise. Should the PR need to stay open (like in the case of a WIP), the `keep open` label can be added. - - If the owner of the PR is listed in `OWNERS`, that user **must** merge their own PRs - or explicitly request another OWNER do that for them. - - If the owner of a PR is _not_ listed in `OWNERS`, any core committer may - merge the PR once it is approved. + - If the owner of the PR is listed in `OWNERS`, that user **must** merge their own PRs or explicitly + request another OWNER do that for them. + - If the owner of a PR is _not_ listed in `OWNERS`, any maintainer may merge the PR once it is approved. #### Documentation PRs From 812b74aca5f14ea67b531a41687abfee8a6399a6 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Tue, 22 Jan 2019 08:58:07 +0900 Subject: [PATCH 19/56] Fix delete.go file permission (#5194) The 'cmd/helm/delete.go' file permission is 755, change to same as another file. Signed-off-by: Koichi Shiraishi --- cmd/helm/delete.go | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 cmd/helm/delete.go diff --git a/cmd/helm/delete.go b/cmd/helm/delete.go old mode 100755 new mode 100644 From 581e6cdbb8e42753556ae48ccba8cef84c40f736 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Mon, 21 Jan 2019 15:58:57 -0800 Subject: [PATCH 20/56] fix: use RFC 1123 subdomains for name verification (#5132) As noted in Slack by a community member, release names with periods are considered usable. Switching to RFC 1123 subdomain verification continues to block bad release names like BAD_NAME, but allows names like good.name to continue working. Signed-off-by: Matthew Fisher --- cmd/helm/install.go | 4 ++-- cmd/helm/install_test.go | 1 - cmd/helm/template.go | 4 ++-- cmd/helm/template_test.go | 8 ++++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index f33747ac4..5ddb31054 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -251,8 +251,8 @@ func (i *installCmd) run() error { fmt.Printf("FINAL NAME: %s\n", i.name) } - if msgs := validation.IsDNS1123Label(i.name); i.name != "" && len(msgs) > 0 { - return fmt.Errorf("release name %s is not a valid DNS label: %s", i.name, strings.Join(msgs, ";")) + if msgs := validation.IsDNS1123Subdomain(i.name); i.name != "" && len(msgs) > 0 { + return fmt.Errorf("release name %s is invalid: %s", i.name, strings.Join(msgs, ";")) } // Check chart requirements to make sure all dependencies are present in /charts diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 4a2055640..5f7ffdb50 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -169,7 +169,6 @@ func TestInstall(t *testing.T) { name: "install chart with release name using periods", args: []string{"testdata/testcharts/alpine"}, flags: []string{"--name", "foo.bar"}, - err: true, }, { name: "install chart with release name using underscores", diff --git a/cmd/helm/template.go b/cmd/helm/template.go index d776f2989..1838bb758 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -147,8 +147,8 @@ func (t *templateCmd) run(cmd *cobra.Command, args []string) error { } } - if msgs := validation.IsDNS1123Label(t.releaseName); t.releaseName != "" && len(msgs) > 0 { - return fmt.Errorf("release name %s is not a valid DNS label: %s", t.releaseName, strings.Join(msgs, ";")) + if msgs := validation.IsDNS1123Subdomain(t.releaseName); t.releaseName != "" && len(msgs) > 0 { + return fmt.Errorf("release name %s is invalid: %s", t.releaseName, strings.Join(msgs, ";")) } // Check chart requirements to make sure all dependencies are present in /charts diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 98044eff0..3c5026b08 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -112,21 +112,21 @@ func TestTemplateCmd(t *testing.T) { desc: "verify the release name using capitals is invalid", args: []string{subchart1ChartPath, "--name", "FOO"}, expectKey: "subchart1/templates/service.yaml", - expectError: "is not a valid DNS label", + expectError: "is invalid", }, { name: "check_invalid_name_uppercase", desc: "verify the release name using periods is invalid", args: []string{subchart1ChartPath, "--name", "foo.bar"}, expectKey: "subchart1/templates/service.yaml", - expectError: "is not a valid DNS label", + expectValue: "release-name: \"foo.bar\"", }, { name: "check_invalid_name_uppercase", desc: "verify the release name using underscores is invalid", args: []string{subchart1ChartPath, "--name", "foo_bar"}, expectKey: "subchart1/templates/service.yaml", - expectError: "is not a valid DNS label", + expectError: "is invalid", }, { name: "check_release_is_install", @@ -160,7 +160,7 @@ func TestTemplateCmd(t *testing.T) { name: "check_invalid_name_template", desc: "verify the relase name generate by template is invalid", args: []string{subchart1ChartPath, "--name-template", "foobar-{{ b64enc \"abc\" }}-baz"}, - expectError: "is not a valid DNS label", + expectError: "is invalid", }, { name: "check_name_template", From af4c14b593f03190b08863da65e04ff5aa593020 Mon Sep 17 00:00:00 2001 From: Patrick Lang Date: Mon, 21 Jan 2019 21:33:57 -0800 Subject: [PATCH 21/56] Update docs/examples to use multi-arch tagged images (#5099) * update nginx example to work multi-arch Signed-off-by: Patrick Lang * Fix alpine to use a multiarch tag Signed-off-by: Patrick Lang --- docs/examples/alpine/values.yaml | 2 +- docs/examples/nginx/templates/post-install-job.yaml | 2 +- docs/examples/nginx/values.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/examples/alpine/values.yaml b/docs/examples/alpine/values.yaml index afe8cc6c0..225e0472a 100644 --- a/docs/examples/alpine/values.yaml +++ b/docs/examples/alpine/values.yaml @@ -1,6 +1,6 @@ image: repository: alpine - tag: 3.3 + tag: latest pullPolicy: IfNotPresent restartPolicy: Never diff --git a/docs/examples/nginx/templates/post-install-job.yaml b/docs/examples/nginx/templates/post-install-job.yaml index 6e32086ab..3562e6cf5 100644 --- a/docs/examples/nginx/templates/post-install-job.yaml +++ b/docs/examples/nginx/templates/post-install-job.yaml @@ -32,6 +32,6 @@ spec: restartPolicy: {{ .Values.restartPolicy }} containers: - name: post-install-job - image: "alpine:3.3" + image: "alpine:latest" # All we're going to do is sleep for a while, then exit. command: ["/bin/sleep", "{{ .Values.sleepyTime }}"] diff --git a/docs/examples/nginx/values.yaml b/docs/examples/nginx/values.yaml index b40208cce..36f2505af 100644 --- a/docs/examples/nginx/values.yaml +++ b/docs/examples/nginx/values.yaml @@ -14,7 +14,7 @@ index: >- image: repository: nginx - tag: 1.11.0 + tag: alpine pullPolicy: IfNotPresent service: From 05a365358f43a452e523d3f76b1107b6f4ff2aa7 Mon Sep 17 00:00:00 2001 From: Geoff Baskwill Date: Tue, 22 Jan 2019 10:03:01 -0500 Subject: [PATCH 22/56] fix: ignore pax header "file"s in chart validation Signed-off-by: Geoff Baskwill --- pkg/chartutil/load.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/chartutil/load.go b/pkg/chartutil/load.go index f4741516e..b0927a5cf 100644 --- a/pkg/chartutil/load.go +++ b/pkg/chartutil/load.go @@ -93,6 +93,12 @@ func loadArchiveFiles(in io.Reader) ([]*BufferedFile, error) { continue } + switch hd.Typeflag { + // We don't want to process these extension header files. + case tar.TypeXGlobalHeader, tar.TypeXHeader: + continue + } + // Archive could contain \ if generated on Windows delimiter := "/" if strings.ContainsRune(hd.Name, '\\') { From 197e68ec1f5cde7a78fc5053a798f939378f4158 Mon Sep 17 00:00:00 2001 From: JoeWrightss <42261994+JoeWrightss@users.noreply.github.com> Date: Sat, 26 Jan 2019 02:46:24 +0800 Subject: [PATCH 23/56] Fix some typos in comment (#5215) Signed-off-by: zhoulin xie --- pkg/helm/client.go | 2 +- pkg/helm/fake.go | 2 +- pkg/helm/option.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/helm/client.go b/pkg/helm/client.go index 771c7f3d1..0d4d16039 100644 --- a/pkg/helm/client.go +++ b/pkg/helm/client.go @@ -302,7 +302,7 @@ func (h *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-ch return h.test(ctx, req) } -// PingTiller pings the Tiller pod and ensure's that it is up and running +// PingTiller pings the Tiller pod and ensures that it is up and running func (h *Client) PingTiller() error { ctx := NewContext() return h.ping(ctx) diff --git a/pkg/helm/fake.go b/pkg/helm/fake.go index 46be7d398..c8ce91f44 100644 --- a/pkg/helm/fake.go +++ b/pkg/helm/fake.go @@ -257,7 +257,7 @@ func (c *FakeClient) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) ( return results, errc } -// PingTiller pings the Tiller pod and ensure's that it is up and running +// PingTiller pings the Tiller pod and ensures that it is up and running func (c *FakeClient) PingTiller() error { return nil } diff --git a/pkg/helm/option.go b/pkg/helm/option.go index 121f71c83..1f5cf6904 100644 --- a/pkg/helm/option.go +++ b/pkg/helm/option.go @@ -474,7 +474,7 @@ type VersionOption func(*options) // the defaults used when running the `helm upgrade` command. type UpdateOption func(*options) -// RollbackOption allows specififying various settings configurable +// RollbackOption allows specifying various settings configurable // by the helm client user for overriding the defaults used when // running the `helm rollback` command. type RollbackOption func(*options) From 0dfe2b865a9b4900ef41fc141fc88c11bd728c57 Mon Sep 17 00:00:00 2001 From: shibataka000 Date: Sun, 27 Jan 2019 02:54:12 +0900 Subject: [PATCH 24/56] Itemize text in docs/securing_installation.md (#5217) Signed-off-by: Takao Shibata --- docs/securing_installation.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/securing_installation.md b/docs/securing_installation.md index d47a98bcc..56ebad62c 100644 --- a/docs/securing_installation.md +++ b/docs/securing_installation.md @@ -69,9 +69,10 @@ When Helm clients are connecting from outside of the cluster, the security betwe Contrary to the previous [Enabling TLS](#enabling-tls) section, this section does not involve running a tiller server pod in your cluster (for what it's worth, that lines up with the current [helm v3 proposal](https://github.com/helm/community/blob/master/helm-v3/000-helm-v3.md)), thus there is no gRPC endpoint (and thus there's no need to create & manage TLS certificates to secure each gRPC endpoint). Steps: - * Fetch the latest helm release tarball from the [GitHub release page](https://github.com/helm/helm/releases), and extract and move `helm` and `tiller` somewhere on your `$PATH`. - * "Server": Run `tiller --storage=secret`. (Note that `tiller` has a default value of ":44134" for the `--listen` argument.) - * Client: In another terminal (and on the same host that the aforementioned `tiller` command was run for the previous bullet): Run `export HELM_HOST=:44134`, and then run `helm` commands as usual. + +- Fetch the latest helm release tarball from the [GitHub release page](https://github.com/helm/helm/releases), and extract and move `helm` and `tiller` somewhere on your `$PATH`. +- "Server": Run `tiller --storage=secret`. (Note that `tiller` has a default value of ":44134" for the `--listen` argument.) +- Client: In another terminal (and on the same host that the aforementioned `tiller` command was run for the previous bullet): Run `export HELM_HOST=:44134`, and then run `helm` commands as usual. ### Tiller's Release Information From 8a5c7f157106d9ba0fe1e0ab01498d454c47bb0e Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Wed, 9 Jan 2019 12:33:37 +0200 Subject: [PATCH 25/56] Implement "atomic" upgrade/install Add possibility to put "--safe" argument to install and upgrade command that restores the state of cluster in case of failed install/upgrade attempt Signed-off-by: Alexander Nesterenko --- cmd/helm/install.go | 18 ++++++++++++++++++ cmd/helm/upgrade.go | 26 ++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 5ddb31054..9e0b19487 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -131,6 +131,7 @@ type installCmd struct { version string timeout int64 wait bool + safe bool repoURL string username string password string @@ -190,6 +191,8 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } inst.chartPath = cp inst.client = ensureHelmClient(inst.client) + inst.wait = inst.wait || inst.safe + return inst.run() }, } @@ -212,6 +215,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.version, "version", "", "specify the exact chart version to install. If this is not specified, the latest version is installed") f.Int64Var(&inst.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&inst.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.BoolVar(&inst.safe, "safe", false, "if set, upgrade process rolls back changes made in case of failed upgrade") f.StringVar(&inst.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&inst.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&inst.password, "password", "", "chart repository password where to locate the requested chart") @@ -307,6 +311,20 @@ func (i *installCmd) run() error { helm.InstallWait(i.wait), helm.InstallDescription(i.description)) if err != nil { + if i.safe { + fmt.Fprintf(os.Stdout, "INSTALL FAILED\nPURGING CHART\nError: %v", prettyError(err)) + deleteSideEffects := &deleteCmd{ + name: i.name, + disableHooks: i.disableHooks, + purge: true, + timeout: i.timeout, + description: "", + dryRun: i.dryRun, + out: i.out, + client: i.client, + } + if err := deleteSideEffects.run(); err != nil { return err } + } return prettyError(err) } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index d6c915c3a..a20a1003a 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -105,6 +105,7 @@ type upgradeCmd struct { resetValues bool reuseValues bool wait bool + safe bool repoURL string username string password string @@ -142,6 +143,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { upgrade.release = args[0] upgrade.chart = args[1] upgrade.client = ensureHelmClient(upgrade.client) + upgrade.wait = upgrade.wait || upgrade.safe return upgrade.run() }, @@ -167,6 +169,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.resetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.") f.BoolVar(&upgrade.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.BoolVar(&upgrade.safe, "safe", false, "if set, upgrade process rolls back changes made in case of failed upgrade") f.StringVar(&upgrade.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&upgrade.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&upgrade.password, "password", "", "chart repository password where to locate the requested chart") @@ -191,6 +194,8 @@ func (u *upgradeCmd) run() error { return err } + releaseHistory, err := u.client.ReleaseHistory(u.release, helm.WithMaxHistory(1)) + if u.install { // If a release does not exist, install it. If another error occurs during // the check, ignore the error and continue with the upgrade. @@ -198,7 +203,6 @@ func (u *upgradeCmd) run() error { // The returned error is a grpc.rpcError that wraps the message from the original error. // So we're stuck doing string matching against the wrapped error, which is nested somewhere // inside of the grpc.rpcError message. - releaseHistory, err := u.client.ReleaseHistory(u.release, helm.WithMaxHistory(1)) if err == nil { if u.namespace == "" { @@ -232,6 +236,7 @@ func (u *upgradeCmd) run() error { timeout: u.timeout, wait: u.wait, description: u.description, + safe: u.safe, } return ic.run() } @@ -270,7 +275,24 @@ func (u *upgradeCmd) run() error { helm.UpgradeWait(u.wait), helm.UpgradeDescription(u.description)) if err != nil { - return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) + fmt.Fprintf(u.out, "UPGRADE FAILED\nROLLING BACK\nError: %v", prettyError(err)) + if u.safe { + rollback := &rollbackCmd { + out: u.out, + client: u.client, + name: u.release, + dryRun: u.dryRun, + recreate: u.recreate, + force: u.force, + timeout: u.timeout, + wait: u.wait, + description: "", + revision: releaseHistory.Releases[0].Version, + disableHooks: u.disableHooks, + } + if err := rollback.run(); err != nil { return err } + } + return fmt.Errorf("UPGRADE FAILED: %v\n", prettyError(err)) } if settings.Debug { From 869efd59be7a960466055bc30966ebd572a4ee09 Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Wed, 9 Jan 2019 13:39:09 +0200 Subject: [PATCH 26/56] Fix codestyle and update docs Signed-off-by: Alexander Nesterenko --- cmd/helm/install.go | 4 +++- cmd/helm/upgrade.go | 10 ++++++---- docs/helm/helm_install.md | 3 ++- docs/helm/helm_upgrade.md | 5 +++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 9e0b19487..0316b14bf 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -323,7 +323,9 @@ func (i *installCmd) run() error { out: i.out, client: i.client, } - if err := deleteSideEffects.run(); err != nil { return err } + if err := deleteSideEffects.run(); err != nil { + return err + } } return prettyError(err) } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index a20a1003a..527867e47 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -275,9 +275,9 @@ func (u *upgradeCmd) run() error { helm.UpgradeWait(u.wait), helm.UpgradeDescription(u.description)) if err != nil { - fmt.Fprintf(u.out, "UPGRADE FAILED\nROLLING BACK\nError: %v", prettyError(err)) + fmt.Fprintf(u.out, "UPGRADE FAILED\nROLLING BACK\nError: %v\n", prettyError(err)) if u.safe { - rollback := &rollbackCmd { + rollback := &rollbackCmd{ out: u.out, client: u.client, name: u.release, @@ -290,9 +290,11 @@ func (u *upgradeCmd) run() error { revision: releaseHistory.Releases[0].Version, disableHooks: u.disableHooks, } - if err := rollback.run(); err != nil { return err } + if err := rollback.run(); err != nil { + return err + } } - return fmt.Errorf("UPGRADE FAILED: %v\n", prettyError(err)) + return fmt.Errorf("UPGRADE FAILED: %v", prettyError(err)) } if settings.Debug { diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 5406126fa..499e3222d 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -96,6 +96,7 @@ helm install [CHART] [flags] --render-subchart-notes render subchart notes along with the parent --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart + --safe if set, upgrade process rolls back changes made in case of failed upgrade --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -129,4 +130,4 @@ helm install [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 1-Nov-2018 +###### Auto generated by spf13/cobra on 9-Jan-2019 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index df5bfe6ca..081123278 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -19,7 +19,7 @@ To customize the chart values, use any of - '--set-string' to provide key=val forcing val to be stored as a string, - '--set-file' to provide key=path to read a single large value from a file at path. -To edit or append to the existing customized values, add the +To edit or append to the existing customized values, add the '--reuse-values' flag, otherwise any existing customized values are ignored. If no chart value arguments are provided on the command line, any existing customized values are carried @@ -83,6 +83,7 @@ helm upgrade [RELEASE] [CHART] [flags] --repo string chart repository url where to locate the requested chart --reset-values when upgrading, reset the values to the ones built into the chart --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. + --safe if set, upgrade process rolls back changes made in case of failed upgrade --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -116,4 +117,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 1-Nov-2018 +###### Auto generated by spf13/cobra on 9-Jan-2019 From e137c55a3ae58a4ef6770259d7cc2249fbf0c0a4 Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Wed, 23 Jan 2019 17:24:51 +0200 Subject: [PATCH 27/56] [#3338] Rename "safe" to "atomic" which gives more clear understanding, what it does Signed-off-by: Alexander Nesterenko --- cmd/helm/install.go | 11 ++++++----- cmd/helm/upgrade.go | 12 ++++++------ docs/helm/helm_install.md | 4 ++-- docs/helm/helm_upgrade.md | 4 ++-- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 0316b14bf..a6d6b0812 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -131,7 +131,7 @@ type installCmd struct { version string timeout int64 wait bool - safe bool + atomic bool repoURL string username string password string @@ -191,7 +191,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { } inst.chartPath = cp inst.client = ensureHelmClient(inst.client) - inst.wait = inst.wait || inst.safe + inst.wait = inst.wait || inst.atomic return inst.run() }, @@ -215,7 +215,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.version, "version", "", "specify the exact chart version to install. If this is not specified, the latest version is installed") f.Int64Var(&inst.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&inst.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.BoolVar(&inst.safe, "safe", false, "if set, upgrade process rolls back changes made in case of failed upgrade") + f.BoolVar(&inst.atomic, "atomic", false, "if set, installation process purges chart on fail") f.StringVar(&inst.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&inst.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&inst.password, "password", "", "chart repository password where to locate the requested chart") @@ -311,8 +311,8 @@ func (i *installCmd) run() error { helm.InstallWait(i.wait), helm.InstallDescription(i.description)) if err != nil { - if i.safe { - fmt.Fprintf(os.Stdout, "INSTALL FAILED\nPURGING CHART\nError: %v", prettyError(err)) + if i.atomic { + fmt.Fprintf(os.Stdout, "INSTALL FAILED\nPURGING CHART\nError: %v\n", prettyError(err)) deleteSideEffects := &deleteCmd{ name: i.name, disableHooks: i.disableHooks, @@ -326,6 +326,7 @@ func (i *installCmd) run() error { if err := deleteSideEffects.run(); err != nil { return err } + fmt.Fprintf(os.Stdout, "Successfully purged a chart!\n") } return prettyError(err) } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 527867e47..5184a97ff 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -44,7 +44,7 @@ To customize the chart values, use any of - '--set-string' to provide key=val forcing val to be stored as a string, - '--set-file' to provide key=path to read a single large value from a file at path. -To edit or append to the existing customized values, add the +To edit or append to the existing customized values, add the '--reuse-values' flag, otherwise any existing customized values are ignored. If no chart value arguments are provided on the command line, any existing customized values are carried @@ -105,7 +105,7 @@ type upgradeCmd struct { resetValues bool reuseValues bool wait bool - safe bool + atomic bool repoURL string username string password string @@ -143,7 +143,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { upgrade.release = args[0] upgrade.chart = args[1] upgrade.client = ensureHelmClient(upgrade.client) - upgrade.wait = upgrade.wait || upgrade.safe + upgrade.wait = upgrade.wait || upgrade.atomic return upgrade.run() }, @@ -169,7 +169,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.resetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.") f.BoolVar(&upgrade.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.BoolVar(&upgrade.safe, "safe", false, "if set, upgrade process rolls back changes made in case of failed upgrade") + f.BoolVar(&upgrade.atomic, "atomic", false, "if set, upgrade process rolls back changes made in case of failed upgrade") f.StringVar(&upgrade.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&upgrade.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&upgrade.password, "password", "", "chart repository password where to locate the requested chart") @@ -236,7 +236,7 @@ func (u *upgradeCmd) run() error { timeout: u.timeout, wait: u.wait, description: u.description, - safe: u.safe, + atomic: u.atomic, } return ic.run() } @@ -276,7 +276,7 @@ func (u *upgradeCmd) run() error { helm.UpgradeDescription(u.description)) if err != nil { fmt.Fprintf(u.out, "UPGRADE FAILED\nROLLING BACK\nError: %v\n", prettyError(err)) - if u.safe { + if u.atomic { rollback := &rollbackCmd{ out: u.out, client: u.client, diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 499e3222d..5d0130286 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -78,6 +78,7 @@ helm install [CHART] [flags] ### Options ``` + --atomic if set, upgrade process rolls back changes made in case of failed upgrade --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 @@ -96,7 +97,6 @@ helm install [CHART] [flags] --render-subchart-notes render subchart notes along with the parent --replace re-use the given name, even if that name is already used. This is unsafe in production --repo string chart repository url where to locate the requested chart - --safe if set, upgrade process rolls back changes made in case of failed upgrade --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -130,4 +130,4 @@ helm install [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Jan-2019 +###### Auto generated by spf13/cobra on 23-Jan-2019 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index 081123278..ac2ab316a 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -65,6 +65,7 @@ helm upgrade [RELEASE] [CHART] [flags] ### Options ``` + --atomic if set, upgrade process rolls back changes made in case of failed upgrade --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 @@ -83,7 +84,6 @@ helm upgrade [RELEASE] [CHART] [flags] --repo string chart repository url where to locate the requested chart --reset-values when upgrading, reset the values to the ones built into the chart --reuse-values when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored. - --safe if set, upgrade process rolls back changes made in case of failed upgrade --set stringArray set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) --set-file stringArray set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2) --set-string stringArray set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2) @@ -117,4 +117,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 9-Jan-2019 +###### Auto generated by spf13/cobra on 23-Jan-2019 From 599bce8b13e5b11e931f8a0f106d4b9232be203c Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Sun, 27 Jan 2019 11:22:36 +0200 Subject: [PATCH 28/56] Upgrade installation docs Signed-off-by: Alexander Nesterenko --- docs/helm/helm_install.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 5d0130286..75a3c0502 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -78,7 +78,7 @@ helm install [CHART] [flags] ### Options ``` - --atomic if set, upgrade process rolls back changes made in case of failed upgrade + --atomic if set, installation process purges chart on fail --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 @@ -130,4 +130,4 @@ helm install [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 23-Jan-2019 +###### Auto generated by spf13/cobra on 27-Jan-2019 From 5744af51e8abc402927c2196ea2a16833353037b Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Sun, 27 Jan 2019 12:49:01 +0200 Subject: [PATCH 29/56] Add smoke tests Signed-off-by: Alexander Nesterenko --- cmd/helm/install_test.go | 8 ++++++++ cmd/helm/upgrade_test.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 5f7ffdb50..24a5abe68 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -113,6 +113,14 @@ func TestInstall(t *testing.T) { expected: "apollo", resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "apollo"}), }, + // Install, with atomic + { + name: "install with a atomic", + args: []string{"testdata/testcharts/alpine"}, + flags: strings.Split("--name apollo", " "), + expected: "apollo", + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "apollo"}), + }, // Install, using the name-template { name: "install with name-template", diff --git a/cmd/helm/upgrade_test.go b/cmd/helm/upgrade_test.go index 60b529f63..c2b1b4ea6 100644 --- a/cmd/helm/upgrade_test.go +++ b/cmd/helm/upgrade_test.go @@ -123,6 +123,14 @@ func TestUpgradeCmd(t *testing.T) { expected: "Release \"funny-bunny\" has been upgraded. Happy Helming!\n", rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "funny-bunny", Version: 5, Chart: ch2})}, }, + { + name: "install a release with 'upgrade --atomic'", + args: []string{"funny-bunny", chartPath}, + flags: []string{"--atomic"}, + resp: helm.ReleaseMock(&helm.MockReleaseOptions{Name: "funny-bunny", Version: 6, Chart: ch}), + expected: "Release \"funny-bunny\" has been upgraded. Happy Helming!\n", + rels: []*release.Release{helm.ReleaseMock(&helm.MockReleaseOptions{Name: "funny-bunny", Version: 6, Chart: ch})}, + }, { name: "install a release with 'upgrade --install'", args: []string{"zany-bunny", chartPath}, From 2332b480c9cb70a0d8a85247992d6155fbe82416 Mon Sep 17 00:00:00 2001 From: Alexander Nesterenko Date: Mon, 28 Jan 2019 20:06:31 +0200 Subject: [PATCH 30/56] Update docs to include information about setting `--wait flag` Signed-off-by: Alexander Nesterenko --- cmd/helm/install.go | 2 +- cmd/helm/upgrade.go | 2 +- docs/helm/helm_install.md | 4 ++-- docs/helm/helm_upgrade.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index a6d6b0812..4602ea9fd 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -215,7 +215,7 @@ func newInstallCmd(c helm.Interface, out io.Writer) *cobra.Command { f.StringVar(&inst.version, "version", "", "specify the exact chart version to install. If this is not specified, the latest version is installed") f.Int64Var(&inst.timeout, "timeout", 300, "time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&inst.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.BoolVar(&inst.atomic, "atomic", false, "if set, installation process purges chart on fail") + f.BoolVar(&inst.atomic, "atomic", false, "if set, installation process purges chart on fail, also sets --wait flag") f.StringVar(&inst.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&inst.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&inst.password, "password", "", "chart repository password where to locate the requested chart") diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index 5184a97ff..044ec045d 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -169,7 +169,7 @@ func newUpgradeCmd(client helm.Interface, out io.Writer) *cobra.Command { f.BoolVar(&upgrade.resetValues, "reset-values", false, "when upgrading, reset the values to the ones built into the chart") f.BoolVar(&upgrade.reuseValues, "reuse-values", false, "when upgrading, reuse the last release's values and merge in any overrides from the command line via --set and -f. If '--reset-values' is specified, this is ignored.") f.BoolVar(&upgrade.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.BoolVar(&upgrade.atomic, "atomic", false, "if set, upgrade process rolls back changes made in case of failed upgrade") + f.BoolVar(&upgrade.atomic, "atomic", false, "if set, upgrade process rolls back changes made in case of failed upgrade, also sets --wait flag") f.StringVar(&upgrade.repoURL, "repo", "", "chart repository url where to locate the requested chart") f.StringVar(&upgrade.username, "username", "", "chart repository username where to locate the requested chart") f.StringVar(&upgrade.password, "password", "", "chart repository password where to locate the requested chart") diff --git a/docs/helm/helm_install.md b/docs/helm/helm_install.md index 75a3c0502..12ae81b78 100644 --- a/docs/helm/helm_install.md +++ b/docs/helm/helm_install.md @@ -78,7 +78,7 @@ helm install [CHART] [flags] ### Options ``` - --atomic if set, installation process purges chart on fail + --atomic if set, installation process purges chart on fail, also sets --wait flag --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 @@ -130,4 +130,4 @@ helm install [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 27-Jan-2019 +###### Auto generated by spf13/cobra on 28-Jan-2019 diff --git a/docs/helm/helm_upgrade.md b/docs/helm/helm_upgrade.md index ac2ab316a..676c26595 100644 --- a/docs/helm/helm_upgrade.md +++ b/docs/helm/helm_upgrade.md @@ -65,7 +65,7 @@ helm upgrade [RELEASE] [CHART] [flags] ### Options ``` - --atomic if set, upgrade process rolls back changes made in case of failed upgrade + --atomic if set, upgrade process rolls back changes made in case of failed upgrade, also sets --wait flag --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 @@ -117,4 +117,4 @@ helm upgrade [RELEASE] [CHART] [flags] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 23-Jan-2019 +###### Auto generated by spf13/cobra on 28-Jan-2019 From 074dbcde4f51473eab19dea5a0d843981bb2f72a Mon Sep 17 00:00:00 2001 From: Bort Verwilst Date: Tue, 29 Jan 2019 19:41:34 +0100 Subject: [PATCH 31/56] Switch to numeric user id (#5203) Signed-off-by: Bart Verwilst --- rootfs/Dockerfile | 2 +- rootfs/Dockerfile.experimental | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rootfs/Dockerfile b/rootfs/Dockerfile index 82dfa0d4c..f918c4d51 100644 --- a/rootfs/Dockerfile +++ b/rootfs/Dockerfile @@ -22,6 +22,6 @@ COPY helm /helm COPY tiller /tiller EXPOSE 44134 -USER nobody +USER 65534 ENTRYPOINT ["/tiller"] diff --git a/rootfs/Dockerfile.experimental b/rootfs/Dockerfile.experimental index ca0c87f30..61e49ab67 100644 --- a/rootfs/Dockerfile.experimental +++ b/rootfs/Dockerfile.experimental @@ -21,6 +21,6 @@ ENV HOME /tmp COPY tiller /tiller EXPOSE 44134 -USER nobody +USER 65534 ENTRYPOINT ["/tiller", "--experimental-release"] From 7871ea9f736d4ec02db6512b779089219c9f0e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20K=C5=82opotek?= Date: Tue, 29 Jan 2019 19:43:38 +0100 Subject: [PATCH 32/56] Update documentation with option to install helm on Windows via scoop (#5207) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Kłopotek --- docs/install.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/install.md b/docs/install.md index b47aea6f1..b9626a43a 100755 --- a/docs/install.md +++ b/docs/install.md @@ -45,7 +45,7 @@ brew install kubernetes-helm (Note: There is also a formula for emacs-helm, which is a different project.) -### From Chocolatey (Windows) +### From Chocolatey or scoop (Windows) Members of the Kubernetes community have contributed a [Helm package](https://chocolatey.org/packages/kubernetes-helm) build to [Chocolatey](https://chocolatey.org/). This package is generally up to date. @@ -54,6 +54,12 @@ Members of the Kubernetes community have contributed a [Helm package](https://ch choco install kubernetes-helm ``` +The binary can also be installed via [`scoop`](https://scoop.sh) command-line installer. + +``` +scoop install helm +``` + ## From Script Helm now has an installer script that will automatically grab the latest version From a47a35814973bbaa7d37eec9fa5e30ac8c863daf Mon Sep 17 00:00:00 2001 From: Maor Friedman Date: Tue, 29 Jan 2019 10:44:25 -0800 Subject: [PATCH 33/56] [docs/related] add helm tiller-info plugin, related to #5111 (#5154) Signed-off-by: Maor --- docs/related.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/related.md b/docs/related.md index 5c027cc36..4fc4d9737 100644 --- a/docs/related.md +++ b/docs/related.md @@ -53,6 +53,7 @@ or [pull request](https://github.com/helm/helm/pulls). - [helm-stop](https://github.com/IBM/helm-stop) - Plugin for stopping a release pods - [helm-template](https://github.com/technosophos/helm-template) - Debug/render templates client-side - [helm-tiller](https://github.com/adamreese/helm-tiller) - Additional commands to work with Tiller +- [helm-tiller-info](https://github.com/maorfr/helm-tiller-info) - Plugin which prints information about Tiller - [helm-unittest](https://github.com/lrills/helm-unittest) - Plugin for unit testing chart locally with YAML - [Tillerless Helm v2](https://github.com/rimusz/helm-tiller) - Helm plugin for using Tiller locally and in CI/CD pipelines From f8ae371388df01aa770a4f6e9511fe92d0f1d770 Mon Sep 17 00:00:00 2001 From: Christian Hildebrando Hercules Date: Tue, 29 Jan 2019 10:54:02 -0800 Subject: [PATCH 34/56] Updating SAP example of gathering charts in one place (#5125) Signed-off-by: Christian H Hercules --- docs/charts_tips_and_tricks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index e948d3bcf..9f9cc84a6 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -255,9 +255,9 @@ embed each of the components. Two strong design patterns are illustrated by these projects: -**SAP's [OpenStack chart](https://github.com/sapcc/openstack-helm):** This chart -installs a full OpenStack IaaS on Kubernetes. All of the charts are collected -together in one GitHub repository. +**SAP's [Converged charts](https://github.com/sapcc/helm-charts):** These charts +install SAP Converged Cloud a full OpenStack IaaS on Kubernetes. All of the charts are collected +together in one GitHub repository, except for a few submodules. **Deis's [Workflow](https://github.com/deis/workflow/tree/master/charts/workflow):** This chart exposes the entire Deis PaaS system with one chart. But it's different From 4c1edcf0492f7e6a315dbeced3c008e96a40bc47 Mon Sep 17 00:00:00 2001 From: Peter Stalman Date: Tue, 29 Jan 2019 10:54:51 -0800 Subject: [PATCH 35/56] Fixes #5046, zsh completion (#5072) Signed-off-by: Peter Stalman --- cmd/helm/completion.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/helm/completion.go b/cmd/helm/completion.go index 2181e723c..d0249b2ea 100644 --- a/cmd/helm/completion.go +++ b/cmd/helm/completion.go @@ -212,6 +212,7 @@ __helm_convert_bash_to_zsh() { -e "s/${LWORD}compopt${RWORD}/__helm_compopt/g" \ -e "s/${LWORD}declare${RWORD}/__helm_declare/g" \ -e "s/\\\$(type${RWORD}/\$(__helm_type/g" \ + -e 's/aliashash\["\(\w\+\)"\]/aliashash[\1]/g' \ <<'BASH_COMPLETION_EOF' ` out.Write([]byte(zshInitialization)) From 6ceaef446f70ac125b9a6d02b1a7a46956b104af Mon Sep 17 00:00:00 2001 From: Laski Date: Tue, 29 Jan 2019 16:15:38 -0300 Subject: [PATCH 36/56] Clarify section title (#5226) As stated by @schollii in https://github.com/helm/helm/issues/4505#issuecomment-415886732 "Overriding Values from a Parent Chart" is unclear. This changes that text to "Overriding Values of a Child Chart". See @scholli's comment for justification. Signed-off-by: Nahuel Lascano --- docs/chart_template_guide/subcharts_and_globals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_template_guide/subcharts_and_globals.md b/docs/chart_template_guide/subcharts_and_globals.md index 1954df39a..b37a82bca 100644 --- a/docs/chart_template_guide/subcharts_and_globals.md +++ b/docs/chart_template_guide/subcharts_and_globals.md @@ -63,7 +63,7 @@ data: dessert: cake ``` -## Overriding Values from a Parent Chart +## Overriding Values of a Child Chart Our original chart, `mychart` is now the _parent_ chart of `mysubchart`. This relationship is based entirely on the fact that `mysubchart` is within `mychart/charts`. From 5cf932c140fd5b3557d1c345aaa5168e58fd82b1 Mon Sep 17 00:00:00 2001 From: Amim Knabben Date: Tue, 29 Jan 2019 18:00:51 -0200 Subject: [PATCH 37/56] Changing deprecated library reference and setting delete propagation background policy (#5161) Signed-off-by: Amim Knabben --- cmd/helm/installer/uninstall.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/helm/installer/uninstall.go b/cmd/helm/installer/uninstall.go index db824ca0b..87fbd4050 100644 --- a/cmd/helm/installer/uninstall.go +++ b/cmd/helm/installer/uninstall.go @@ -47,10 +47,11 @@ func deleteService(client corev1.ServicesGetter, namespace string) error { } // deleteDeployment deletes the Tiller Deployment resource -// We need to use the reaper instead of the kube API because GC for deployment dependents -// is not yet supported at the k8s server level (<= 1.5) func deleteDeployment(client kubernetes.Interface, namespace string) error { - err := client.Extensions().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{}) + policy := metav1.DeletePropagationBackground + err := client.AppsV1().Deployments(namespace).Delete(deploymentName, &metav1.DeleteOptions{ + PropagationPolicy: &policy, + }) return ingoreNotFound(err) } From ab0ba3aa630f64e0fd46cdd6726645a7e3520db9 Mon Sep 17 00:00:00 2001 From: James Ravn Date: Tue, 29 Jan 2019 20:04:17 +0000 Subject: [PATCH 38/56] fix(tiller): respect resource policy on upgrade (#5225) Don't delete a resource on upgrade if it is annotated with helm.io/resource-policy=keep. This can cause data loss for users if the annotation is ignored (e.g. for a PVC). Closes #3673 Signed-off-by: James Ravn --- pkg/kube/client.go | 18 +++++++++++++++++- pkg/kube/client_test.go | 15 +++++++++++++++ pkg/kube/resource_policy.go | 26 ++++++++++++++++++++++++++ pkg/tiller/resource_policy.go | 13 ++----------- 4 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 pkg/kube/resource_policy.go diff --git a/pkg/kube/client.go b/pkg/kube/client.go index 4a387d524..e897aced6 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -23,11 +23,12 @@ import ( goerrors "errors" "fmt" "io" + "k8s.io/apimachinery/pkg/api/meta" "log" "strings" "time" - jsonpatch "github.com/evanphx/json-patch" + "github.com/evanphx/json-patch" appsv1 "k8s.io/api/apps/v1" appsv1beta1 "k8s.io/api/apps/v1beta1" appsv1beta2 "k8s.io/api/apps/v1beta2" @@ -60,6 +61,8 @@ const MissingGetHeader = "==> MISSING\nKIND\t\tNAME\n" // ErrNoObjectsVisited indicates that during a visit operation, no matching objects were found. var ErrNoObjectsVisited = goerrors.New("no objects visited") +var metadataAccessor = meta.NewAccessor() + // Client represents a client capable of communicating with the Kubernetes API. type Client struct { cmdutil.Factory @@ -308,6 +311,19 @@ func (c *Client) Update(namespace string, originalReader, targetReader io.Reader for _, info := range original.Difference(target) { c.Log("Deleting %q in %s...", info.Name, info.Namespace) + + if err := info.Get(); err != nil { + c.Log("Unable to get obj %q, err: %s", info.Name, err) + } + annotations, err := metadataAccessor.Annotations(info.Object) + if err != nil { + c.Log("Unable to get annotations on %q, err: %s", info.Name, err) + } + if annotations != nil && annotations[ResourcePolicyAnno] == KeepPolicy { + c.Log("Skipping delete of %q due to annotation [%s=%s]", info.Name, ResourcePolicyAnno, KeepPolicy) + continue + } + if err := deleteResource(info); err != nil { c.Log("Failed to delete %q, err: %s", info.Name, err) } diff --git a/pkg/kube/client_test.go b/pkg/kube/client_test.go index de33881c8..aa21b937c 100644 --- a/pkg/kube/client_test.go +++ b/pkg/kube/client_test.go @@ -151,6 +151,8 @@ func TestUpdate(t *testing.T) { return newResponse(200, &listB.Items[1]) case p == "/namespaces/default/pods/squid" && m == "DELETE": return newResponse(200, &listB.Items[1]) + case p == "/namespaces/default/pods/squid" && m == "GET": + return newResponse(200, &listA.Items[2]) default: t.Fatalf("unexpected request: %s %s", req.Method, req.URL.Path) return nil, nil @@ -183,6 +185,7 @@ func TestUpdate(t *testing.T) { "/namespaces/default/pods/otter:GET", "/namespaces/default/pods/dolphin:GET", "/namespaces/default/pods:POST", + "/namespaces/default/pods/squid:GET", "/namespaces/default/pods/squid:DELETE", } if len(expectedActions) != len(actions) { @@ -194,6 +197,18 @@ func TestUpdate(t *testing.T) { t.Errorf("expected %s request got %s", v, actions[k]) } } + + // Test resource policy is respected + actions = nil + listA.Items[2].ObjectMeta.Annotations = map[string]string{ResourcePolicyAnno: KeepPolicy} + if err := c.Update(v1.NamespaceDefault, objBody(&listA), objBody(&listB), false, false, 0, false); err != nil { + t.Fatal(err) + } + for _, v := range actions { + if v == "/namespaces/default/pods/squid:DELETE" { + t.Errorf("should not have deleted squid - it has helm.sh/resource-policy=keep") + } + } } func TestBuild(t *testing.T) { diff --git a/pkg/kube/resource_policy.go b/pkg/kube/resource_policy.go new file mode 100644 index 000000000..45cebcba8 --- /dev/null +++ b/pkg/kube/resource_policy.go @@ -0,0 +1,26 @@ +/* +Copyright The Helm Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package kube + +// ResourcePolicyAnno is the annotation name for a resource policy +const ResourcePolicyAnno = "helm.sh/resource-policy" + +// KeepPolicy is the resource policy type for keep +// +// This resource policy type allows resources to skip being deleted +// during an uninstallRelease action. +const KeepPolicy = "keep" diff --git a/pkg/tiller/resource_policy.go b/pkg/tiller/resource_policy.go index cca2391d8..aa9c5d2bd 100644 --- a/pkg/tiller/resource_policy.go +++ b/pkg/tiller/resource_policy.go @@ -24,15 +24,6 @@ import ( "k8s.io/helm/pkg/tiller/environment" ) -// resourcePolicyAnno is the annotation name for a resource policy -const resourcePolicyAnno = "helm.sh/resource-policy" - -// keepPolicy is the resource policy type for keep -// -// This resource policy type allows resources to skip being deleted -// during an uninstallRelease action. -const keepPolicy = "keep" - func filterManifestsToKeep(manifests []Manifest) ([]Manifest, []Manifest) { remaining := []Manifest{} keep := []Manifest{} @@ -43,14 +34,14 @@ func filterManifestsToKeep(manifests []Manifest) ([]Manifest, []Manifest) { continue } - resourcePolicyType, ok := m.Head.Metadata.Annotations[resourcePolicyAnno] + resourcePolicyType, ok := m.Head.Metadata.Annotations[kube.ResourcePolicyAnno] if !ok { remaining = append(remaining, m) continue } resourcePolicyType = strings.ToLower(strings.TrimSpace(resourcePolicyType)) - if resourcePolicyType == keepPolicy { + if resourcePolicyType == kube.KeepPolicy { keep = append(keep, m) } From 51a7a4487b28a359738ac6b3135f6fbe7a0d95d6 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 29 Jan 2019 12:34:33 -0800 Subject: [PATCH 39/56] docs: add note on rolling back to the previous release (#5228) While deving at a Microsoft Open Hack my group discovered this useful piece of information in this issue comment: https://github.com/helm/helm/issues/1796#issuecomment-311385728 We found it very useful for our Blue Green CD pipeline and thought others might find it useful as well. Signed-off-by: Ethan Arrowood Signed-off-by: Matthew Fisher --- cmd/helm/rollback.go | 3 ++- docs/helm/helm_rollback.md | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/helm/rollback.go b/cmd/helm/rollback.go index 0c46fa818..78d79659d 100644 --- a/cmd/helm/rollback.go +++ b/cmd/helm/rollback.go @@ -31,7 +31,8 @@ This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the second is a revision (version) number. To see revision numbers, run -'helm history RELEASE'. +'helm history RELEASE'. If you'd like to rollback to the previous release use +'helm rollback [RELEASE] 0'. ` type rollbackCmd struct { diff --git a/docs/helm/helm_rollback.md b/docs/helm/helm_rollback.md index 5862b180a..80fc83a83 100644 --- a/docs/helm/helm_rollback.md +++ b/docs/helm/helm_rollback.md @@ -9,7 +9,8 @@ This command rolls back a release to a previous revision. The first argument of the rollback command is the name of a release, and the second is a revision (version) number. To see revision numbers, run -'helm history RELEASE'. +'helm history RELEASE'. If you'd like to rollback to the previous release use +'helm rollback [RELEASE] 0'. ``` @@ -51,4 +52,4 @@ helm rollback [flags] [RELEASE] [REVISION] * [helm](helm.md) - The Helm package manager for Kubernetes. -###### Auto generated by spf13/cobra on 10-Aug-2018 +###### Auto generated by spf13/cobra on 29-Jan-2019 From 9596dc768ad4b44aa3f6772a64912f8d04c4ea44 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 29 Jan 2019 12:35:44 -0800 Subject: [PATCH 40/56] add missing "and" (#5227) Signed-off-by: Matthew Fisher --- docs/chart_template_guide/variables.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/chart_template_guide/variables.md b/docs/chart_template_guide/variables.md index d924fe2cf..dda92559b 100644 --- a/docs/chart_template_guide/variables.md +++ b/docs/chart_template_guide/variables.md @@ -98,10 +98,7 @@ data: Variables are normally not "global". They are scoped to the block in which they are declared. Earlier, we assigned `$relname` in the top level of the template. That variable will be in scope for the entire template. But in our last example, `$key` and `$val` will only be in scope inside of the `{{range...}}{{end}}` block. -However, there is one variable that is always global - `$` - this -variable will always point to the root context. This can be very -useful when you are looping in a range need to know the chart's release -name. +However, there is one variable that is always global - `$` - this variable will always point to the root context. This can be very useful when you are looping in a range and need to know the chart's release name. An example illustrating this: ```yaml @@ -111,8 +108,8 @@ kind: Secret metadata: name: {{ .name }} labels: - # Many helm templates would use `.` below, but that will not work, - # however `$` will work here + # Many helm templates would use `.` below, but that will not work, + # however `$` will work here app.kubernetes.io/name: {{ template "fullname" $ }} # I cannot reference .Chart.Name, but I can do $.Chart.Name helm.sh/chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" From 36d2c716b3194cceb4b22f32259990a04014b5f5 Mon Sep 17 00:00:00 2001 From: Patrick Stegmann Date: Wed, 30 Jan 2019 00:21:47 +0100 Subject: [PATCH 41/56] Adds the tip that you can pass custom objects (#3916) --- docs/charts_tips_and_tricks.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/charts_tips_and_tricks.md b/docs/charts_tips_and_tricks.md index 9f9cc84a6..e2c73b14f 100644 --- a/docs/charts_tips_and_tricks.md +++ b/docs/charts_tips_and_tricks.md @@ -36,6 +36,12 @@ is required, and will print an error message when that entry is missing: value: {{ required "A valid .Values.who entry required!" .Values.who }} ``` +When using the `include` function, you can pass it a custom object tree built from the current context by using the `dict` function: + +```yaml +{{- include "mytpl" (dict "key1" .Values.originalKey1 "key2" .Values.originalKey2) }} +``` + ## Quote Strings, Don't Quote Integers When you are working with string data, you are always safer quoting the From abd3659b649d6a463c5cd6c6aefd265590a138e2 Mon Sep 17 00:00:00 2001 From: "Pablo M. Canseco" Date: Tue, 29 Jan 2019 22:03:30 -0700 Subject: [PATCH 42/56] Update using_helm.md (#4690) * Update using_helm.md In docs/using_helm.md, it says on line 214 that you can pass in a YAML formatted file, but the example commands following that sentence create JSON code but names the file with a .yml extension. For clarity, I propose saying that it will accept JSON or YAML but clarify in the code that for the example we're making a JSON file. Signed-off-by: Pablo Canseco * update using_helm.md to accurately say that helm install -f only takes a yaml-formatted file. Signed-off-by: Pablo Canseco * updated wording to reflect the fact that -f / --values only accepts YAML Signed-off-by: Pablo Canseco --- docs/using_helm.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/using_helm.md b/docs/using_helm.md index 5716a1302..db723d993 100755 --- a/docs/using_helm.md +++ b/docs/using_helm.md @@ -1,4 +1,4 @@ -# Using Helm +# Using Helm This guide explains the basics of using Helm (and Tiller) to manage packages on your Kubernetes cluster. It assumes that you have already @@ -215,7 +215,10 @@ You can then override any of these settings in a YAML formatted file, and then pass that file during installation. ```console -$ echo '{mariadbUser: user0, mariadbDatabase: user0db}' > config.yaml +$ cat << EOF > config.yaml +mariadbUser: user0 +mariadbDatabase: user0db +EOF $ helm install -f config.yaml stable/mariadb ``` From 048b220205c581378b393155896ca5e862ee0480 Mon Sep 17 00:00:00 2001 From: Jacob Silva Date: Wed, 30 Jan 2019 01:11:07 -0500 Subject: [PATCH 43/56] Removed link for Cabin mobile app (#5231) Signed-off-by: Jacob Silva --- docs/related.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/related.md b/docs/related.md index 4fc4d9737..ba1b0dfbf 100644 --- a/docs/related.md +++ b/docs/related.md @@ -89,7 +89,6 @@ Tools layered on top of Helm or Tiller. Platforms, distributions, and services that include Helm support. -- [Cabin](http://www.skippbox.com/cabin/) - Mobile App for Managing Kubernetes - [Fabric8](https://fabric8.io) - Integrated development platform for Kubernetes - [Jenkins X](http://jenkins-x.io/) - open source automated CI/CD for Kubernetes which uses Helm for [promoting](http://jenkins-x.io/about/features/#promotion) applications through [environments via GitOps](http://jenkins-x.io/about/features/#environments) - [Kubernetic](https://kubernetic.com/) - Kubernetes Desktop Client From a2b1afc66bfc2b3d0a876ef7a2a25f38f12c1415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20K=C5=82opotek?= Date: Wed, 30 Jan 2019 16:06:24 +0100 Subject: [PATCH 44/56] Update README with scoop install option (#5234) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Kłopotek --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7e68df5c3..1889e818e 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ If you want to use a package manager: - [Homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. - [Chocolatey](https://chocolatey.org/) users can use `choco install kubernetes-helm`. +- [Scoop](https://scoop.sh/) users can use `scoop install helm`. - [GoFish](https://gofi.sh/) users can use `gofish install helm`. To rapidly get Helm up and running, start with the [Quick Start Guide](https://docs.helm.sh/using_helm/#quickstart-guide). From 7161095f79e2c9a35350d301ad820e57e56182ec Mon Sep 17 00:00:00 2001 From: lIuDuI <1693291525@qq.com> Date: Thu, 31 Jan 2019 12:10:26 +0800 Subject: [PATCH 45/56] Update func name (#5241) Signed-off-by: xichengliudui <1693291525@qq.com> --- cmd/helm/installer/install.go | 2 +- cmd/helm/installer/options.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/installer/install.go b/cmd/helm/installer/install.go index 6027fdba8..d6d24eec4 100644 --- a/cmd/helm/installer/install.go +++ b/cmd/helm/installer/install.go @@ -183,7 +183,7 @@ func generateLabels(labels map[string]string) map[string]string { return labels } -// parseNodeSelectors parses a comma delimited list of key=values pairs into a map. +// parseNodeSelectorsInto parses a comma delimited list of key=values pairs into a map. func parseNodeSelectorsInto(labels string, m map[string]string) error { kv := strings.Split(labels, ",") for _, v := range kv { diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index 196ad8de4..dbcb376c5 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -50,7 +50,7 @@ type Options struct { // AutoMountServiceAccountToken determines whether or not the service account should be added to Tiller. AutoMountServiceAccountToken bool - // Force allows to force upgrading tiller if deployed version is greater than current version + // ForceUpgrade allows to force upgrading tiller if deployed version is greater than current version ForceUpgrade bool // ImageSpec identifies the image Tiller will use when deployed. From 251a6a2b580158b5dfb34e8b08b10071e6353c1a Mon Sep 17 00:00:00 2001 From: Dean Coakley Date: Fri, 1 Feb 2019 05:32:40 +0000 Subject: [PATCH 46/56] Fix code syntax highlighting in docs (#5245) * Added yaml to undelcared code blocks * Changed YAML->yaml for consistency * Added console syntax highlighting Signed-off-by: Dean Coakley --- docs/chart_template_guide/control_structures.md | 6 +++--- docs/chart_template_guide/debugging.md | 4 ++-- docs/chart_template_guide/functions_and_pipelines.md | 4 ++-- docs/chart_template_guide/values_files.md | 4 ++-- docs/chart_template_guide/yaml_techniques.md | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 61d9ef9e2..68820dfa7 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -20,7 +20,7 @@ The first control structure we'll look at is for conditionally including blocks The basic structure for a conditional looks like this: -``` +```yaml {{ if PIPELINE }} # Do something {{ else if OTHER PIPELINE }} @@ -115,7 +115,7 @@ data: `mug` is incorrectly indented. Let's simply out-dent that one line, and re-run: -``` +```yaml apiVersion: v1 kind: ConfigMap metadata: @@ -224,7 +224,7 @@ The next control structure to look at is the `with` action. This controls variab The syntax for `with` is similar to a simple `if` statement: -``` +```yaml {{ with PIPELINE }} # restricted scope {{ end }} diff --git a/docs/chart_template_guide/debugging.md b/docs/chart_template_guide/debugging.md index fac788cc4..23a6ae70b 100644 --- a/docs/chart_template_guide/debugging.md +++ b/docs/chart_template_guide/debugging.md @@ -12,7 +12,7 @@ When your YAML is failing to parse, but you want to see what is generated, one easy way to retrieve the YAML is to comment out the problem section in the template, and then re-run `helm install --dry-run --debug`: -```YAML +```yaml apiVersion: v1 # some: problem section # {{ .Values.foo | quote }} @@ -20,7 +20,7 @@ apiVersion: v1 The above will be rendered and returned with the comments intact: -```YAML +```yaml apiVersion: v1 # some: problem section # "bar" diff --git a/docs/chart_template_guide/functions_and_pipelines.md b/docs/chart_template_guide/functions_and_pipelines.md index 66176fc59..fe9c92d6e 100644 --- a/docs/chart_template_guide/functions_and_pipelines.md +++ b/docs/chart_template_guide/functions_and_pipelines.md @@ -4,7 +4,7 @@ So far, we've seen how to place information into a template. But that informatio Let's start with a best practice: When injecting strings from the `.Values` object into the template, we ought to quote these strings. We can do that by calling the `quote` function in the template directive: -``` +```yaml apiVersion: v1 kind: ConfigMap metadata: @@ -104,7 +104,7 @@ drink: {{ .Values.favorite.drink | default "tea" | quote }} If we run this as normal, we'll get our `coffee`: -``` +```yaml # Source: mychart/templates/configmap.yaml apiVersion: v1 kind: ConfigMap diff --git a/docs/chart_template_guide/values_files.md b/docs/chart_template_guide/values_files.md index a15047667..218da19dc 100644 --- a/docs/chart_template_guide/values_files.md +++ b/docs/chart_template_guide/values_files.md @@ -54,7 +54,7 @@ data: Because `favoriteDrink` is set in the default `values.yaml` file to `coffee`, that's the value displayed in the template. We can easily override that by adding a `--set` flag in our call to `helm install`: -``` +```console helm install --dry-run --debug --set favoriteDrink=slurm ./mychart SERVER: "localhost:44134" CHART PATH: /Users/mattbutcher/Code/Go/src/k8s.io/helm/_scratch/mychart @@ -85,7 +85,7 @@ favorite: Now we would have to modify the template slightly: -``` +```yaml apiVersion: v1 kind: ConfigMap metadata: diff --git a/docs/chart_template_guide/yaml_techniques.md b/docs/chart_template_guide/yaml_techniques.md index 44c41f903..00b33b674 100644 --- a/docs/chart_template_guide/yaml_techniques.md +++ b/docs/chart_template_guide/yaml_techniques.md @@ -177,7 +177,7 @@ Now the value of `coffee` will be `Latte\nCappuccino\nEspresso\n\n\n`. Indentation inside of a text block is preserved, and results in the preservation of line breaks, too: -``` +```yaml coffee: |- Latte 12 oz @@ -336,7 +336,7 @@ reference is expanded and then discarded. So if we were to decode and then re-encode the example above, the resulting YAML would be: -```YAML +```yaml coffee: yes, please favorite: Cappucino coffees: From 9e18364fea6cc8a2cd97a2fa1b40650583b1eeff Mon Sep 17 00:00:00 2001 From: JoeWrightss <42261994+JoeWrightss@users.noreply.github.com> Date: Fri, 1 Feb 2019 13:33:04 +0800 Subject: [PATCH 47/56] Fix some spelling errors in comment (#5246) Signed-off-by: zhoulin xie --- pkg/repo/repotest/server.go | 2 +- pkg/storage/driver/secrets.go | 2 +- pkg/tiller/release_list.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/repo/repotest/server.go b/pkg/repo/repotest/server.go index 36ab10d70..394294bcd 100644 --- a/pkg/repo/repotest/server.go +++ b/pkg/repo/repotest/server.go @@ -148,7 +148,7 @@ func (s *Server) URL() string { return s.srv.URL } -// LinkIndices links the index created with CreateIndex and makes a symboic link to the repositories/cache directory. +// LinkIndices links the index created with CreateIndex and makes a symbolic link to the repositories/cache directory. // // This makes it possible to simulate a local cache of a repository. func (s *Server) LinkIndices() error { diff --git a/pkg/storage/driver/secrets.go b/pkg/storage/driver/secrets.go index b79a84272..606d7960b 100644 --- a/pkg/storage/driver/secrets.go +++ b/pkg/storage/driver/secrets.go @@ -45,7 +45,7 @@ type Secrets struct { Log func(string, ...interface{}) } -// NewSecrets initializes a new Secrets wrapping an implmenetation of +// NewSecrets initializes a new Secrets wrapping an implementation of // the kubernetes SecretsInterface. func NewSecrets(impl corev1.SecretInterface) *Secrets { return &Secrets{ diff --git a/pkg/tiller/release_list.go b/pkg/tiller/release_list.go index 3299d3ef2..6d62c7bc4 100644 --- a/pkg/tiller/release_list.go +++ b/pkg/tiller/release_list.go @@ -140,7 +140,7 @@ func (s *ReleaseServer) partition(rels []*release.Release, cap int) <-chan []*re // Over-cap, push chunk onto channel to send over gRPC stream s.Log("partitioned at %d with %d releases (cap=%d)", fill, len(chunk), cap) chunks <- chunk - // reset paritioning state + // reset partitioning state chunk = nil fill = 0 } From 147dc225e2a0cc7f5e08a46ea9b59a1d78217f1c Mon Sep 17 00:00:00 2001 From: lIuDuI <1693291525@qq.com> Date: Fri, 1 Feb 2019 22:33:59 +0800 Subject: [PATCH 48/56] Update func name (#5250) * Update func name Signed-off-by: xichengliudui <1693291525@qq.com> * update pull request Signed-off-by: xichengliudui <1693291525@qq.com> --- pkg/tiller/environment/environment.go | 2 +- pkg/tiller/release_server.go | 2 +- pkg/urlutil/urlutil.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/tiller/environment/environment.go b/pkg/tiller/environment/environment.go index 86d077b89..290337d7b 100644 --- a/pkg/tiller/environment/environment.go +++ b/pkg/tiller/environment/environment.go @@ -119,7 +119,7 @@ type KubeClient interface { // by "\n---\n"). Delete(namespace string, reader io.Reader) error - // Watch the resource in reader until it is "ready". + // WatchUntilReady watch the resource in reader until it is "ready". // // For Jobs, "ready" means the job ran to completion (excited without error). // For all other kinds, it means the kind was created or modified without diff --git a/pkg/tiller/release_server.go b/pkg/tiller/release_server.go index 680c39dac..b85118cd2 100644 --- a/pkg/tiller/release_server.go +++ b/pkg/tiller/release_server.go @@ -456,7 +456,7 @@ func (s *ReleaseServer) deleteHookByPolicy(h *release.Hook, policy string, name, return nil } -// hookShouldBeDeleted determines whether the defined hook deletion policy matches the hook deletion polices +// hookHasDeletePolicy determines whether the defined hook deletion policy matches the hook deletion polices // supported by helm. If so, mark the hook as one should be deleted. func hookHasDeletePolicy(h *release.Hook, policy string) bool { if dp, ok := deletePolices[policy]; ok { diff --git a/pkg/urlutil/urlutil.go b/pkg/urlutil/urlutil.go index 272907de0..96b691c92 100644 --- a/pkg/urlutil/urlutil.go +++ b/pkg/urlutil/urlutil.go @@ -73,7 +73,7 @@ func ExtractHostname(addr string) (string, error) { return stripPort(u.Host), nil } -// Backported from Go 1.8 because Circle is still on 1.7 +// stripPort from Go 1.8 because Circle is still on 1.7 func stripPort(hostport string) string { colon := strings.IndexByte(hostport, ':') if colon == -1 { From d3373f568c63e48c3af3b181bca81ca61967e289 Mon Sep 17 00:00:00 2001 From: ahmadali shafiee Date: Fri, 1 Feb 2019 19:38:28 +0330 Subject: [PATCH 49/56] making ingress path configurations more customizable (#5175) * making ingress path configurations more customizable Signed-off-by: Ahmadali Shafiee * update notes ingress reference Signed-off-by: Ahmadali Shafiee --- pkg/chartutil/create.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index 8f713fcd1..9af4b8f45 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -75,9 +75,10 @@ ingress: annotations: {} # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" - paths: [] hosts: - - chart-example.local + - host: chart-example.local + paths: [] + tls: [] # - secretName: chart-example-tls # hosts: @@ -128,7 +129,6 @@ const defaultIgnore = `# Patterns to ignore when building packages. const defaultIngress = `{{- if .Values.ingress.enabled -}} {{- $fullName := include ".fullname" . -}} -{{- $ingressPaths := .Values.ingress.paths -}} apiVersion: extensions/v1beta1 kind: Ingress metadata: @@ -155,10 +155,10 @@ spec: {{- end }} rules: {{- range .Values.ingress.hosts }} - - host: {{ . | quote }} + - host: {{ .host | quote }} http: paths: - {{- range $ingressPaths }} + {{- range .paths }} - path: {{ . }} backend: serviceName: {{ $fullName }} @@ -245,8 +245,8 @@ spec: const defaultNotes = `1. Get the application URL by running these commands: {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} - {{- range $.Values.ingress.paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} From 69c7ba320e041894c073f7f62a98075b72c6bfd8 Mon Sep 17 00:00:00 2001 From: Flavian Date: Fri, 1 Feb 2019 17:12:46 +0100 Subject: [PATCH 50/56] Fix: type conversion for zero values (#5151) * added test for zero values Signed-off-by: Flavian * implemented case for zero values Signed-off-by: Flavian --- pkg/strvals/parser.go | 4 ++++ pkg/strvals/parser_test.go | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/pkg/strvals/parser.go b/pkg/strvals/parser.go index 9d52f34c0..d0a647c67 100644 --- a/pkg/strvals/parser.go +++ b/pkg/strvals/parser.go @@ -393,6 +393,10 @@ func typedVal(v []rune, st bool) interface{} { return nil } + if strings.EqualFold(val, "0") { + return int64(0) + } + // If this value does not start with zero, try parsing it to an int if len(val) != 0 && val[0] != '0' { if iv, err := strconv.ParseInt(val, 10, 64); err == nil { diff --git a/pkg/strvals/parser_test.go b/pkg/strvals/parser_test.go index a096f16d2..5d77aed18 100644 --- a/pkg/strvals/parser_test.go +++ b/pkg/strvals/parser_test.go @@ -85,6 +85,11 @@ func TestParseSet(t *testing.T) { expect: map[string]interface{}{"is_null": "null"}, err: false, }, + { + str: "zero=0", + expect: map[string]interface{}{"zero": "0"}, + err: false, + }, } tests := []struct { str string @@ -123,6 +128,10 @@ func TestParseSet(t *testing.T) { str: "leading_zeros=00009", expect: map[string]interface{}{"leading_zeros": "00009"}, }, + { + str: "zero_int=0", + expect: map[string]interface{}{"zero_int": 0}, + }, { str: "long_int=1234567890", expect: map[string]interface{}{"long_int": 1234567890}, From 7a70459ca1913fcffeb374eca4446c5f97427da9 Mon Sep 17 00:00:00 2001 From: Alex Speaks Date: Fri, 1 Feb 2019 08:18:10 -0800 Subject: [PATCH 51/56] Fix incorrect flow example and improve operator documentation (#4919) * Fix incorrect flow example and improve operator documentation Signed-off-by: Alex * Use golang comment format Signed-off-by: Alex --- docs/chart_template_guide/control_structures.md | 2 +- .../functions_and_pipelines.md | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/chart_template_guide/control_structures.md b/docs/chart_template_guide/control_structures.md index 68820dfa7..e2f9ca89d 100644 --- a/docs/chart_template_guide/control_structures.md +++ b/docs/chart_template_guide/control_structures.md @@ -53,7 +53,7 @@ data: myvalue: "Hello World" drink: {{ .Values.favorite.drink | default "tea" | quote }} food: {{ .Values.favorite.food | upper | quote }} - {{ if and (.Values.favorite.drink) (eq .Values.favorite.drink "coffee") }}mug: true{{ end }} + {{ if and .Values.favorite.drink (eq .Values.favorite.drink "coffee") }}mug: true{{ end }} ``` Note that `.Values.favorite.drink` must be defined or else it will throw an error when comparing it to "coffee". Since we commented out `drink: coffee` in our last example, the output should not include a `mug: true` flag. But if we add that line back into our `values.yaml` file, the output should look like this: diff --git a/docs/chart_template_guide/functions_and_pipelines.md b/docs/chart_template_guide/functions_and_pipelines.md index fe9c92d6e..fe5a3c2b2 100644 --- a/docs/chart_template_guide/functions_and_pipelines.md +++ b/docs/chart_template_guide/functions_and_pipelines.md @@ -150,6 +150,19 @@ Template functions and pipelines are a powerful way to transform information and ## Operators are functions -For templates, the operators (`eq`, `ne`, `lt`, `gt`, `and`, `or` and so on) are all implemented as functions. In pipelines, operations can be grouped with parentheses (`(`, and `)`). +Operators are implemented as functions that return a boolean value. To use `eq`, `ne`, `lt`, `gt`, `and`, `or`, `not` etcetera place the operator at the front of the statement followed by its parameters just as you would a function. To chain multiple operations together, separate individual functions by surrounding them with paranthesis. + +```yaml +{{/* include the body of this if statement when the variable .Values.fooString exists and is set to "foo" */}} +{{ if and .Values.fooString (eq .Values.fooString "foo") }} + {{ ... }} +{{ end }} + + +{{/* do not include the body of this if statement because unset variables evaluate to false and .Values.setVariable was negated with the not function. */}} +{{ if or .Values.anUnsetVariable (not .Values.aSetVariable) }} + {{ ... }} +{{ end }} +``` Now we can turn from functions and pipelines to flow control with conditions, loops, and scope modifiers. From c9dfd2507129fa392e9c8b57ade7e2dbb33b063c Mon Sep 17 00:00:00 2001 From: Ryan Hartje Date: Fri, 1 Feb 2019 10:45:54 -0600 Subject: [PATCH 52/56] added warning and set default image for unreleased versions of helm for #3770 (#3781) * added warning and set default image for unreleased versions of helm * changed to BuildMetadata * changed to BuildMetadata * added check for clientOnly flag --- cmd/helm/init.go | 9 +++++++++ cmd/helm/installer/install_test.go | 4 ++++ cmd/helm/installer/options.go | 3 +++ 3 files changed, 16 insertions(+) diff --git a/cmd/helm/init.go b/cmd/helm/init.go index b628dc008..db35ef037 100644 --- a/cmd/helm/init.go +++ b/cmd/helm/init.go @@ -36,6 +36,7 @@ import ( "k8s.io/helm/pkg/helm/helmpath" "k8s.io/helm/pkg/helm/portforwarder" "k8s.io/helm/pkg/repo" + "k8s.io/helm/pkg/version" ) const initDesc = ` @@ -315,6 +316,14 @@ func (i *initCmd) run() error { fmt.Fprintln(i.out, "Not installing Tiller due to 'client-only' flag having been set") } + needsDefaultImage := !i.clientOnly && !i.opts.UseCanary && len(i.opts.ImageSpec) == 0 && version.BuildMetadata == "unreleased" + if needsDefaultImage { + fmt.Fprintf(i.out, "\nWarning: You appear to be using an unreleased version of Helm. Please either use the\n"+ + "--canary-image flag, or specify your desired tiller version with --tiller-image.\n\n"+ + "Ex:\n"+ + "$ helm init --tiller-image gcr.io/kubernetes-helm/tiller:v2.8.2\n\n") + } + fmt.Fprintln(i.out, "Happy Helming!") return nil } diff --git a/cmd/helm/installer/install_test.go b/cmd/helm/installer/install_test.go index 561b3ed6d..50cc8b1d8 100644 --- a/cmd/helm/installer/install_test.go +++ b/cmd/helm/installer/install_test.go @@ -53,6 +53,10 @@ func TestDeployment(t *testing.T) { t.Fatalf("%s: error %q", tt.name, err) } + // Unreleased versions of helm don't have a release image. See issue 3370 + if tt.name == "default" && version.BuildMetadata == "unreleased" { + tt.expect = "gcr.io/kubernetes-helm/tiller:canary" + } if got := dep.Spec.Template.Spec.Containers[0].Image; got != tt.expect { t.Errorf("%s: expected image %q, got %q", tt.name, tt.expect, got) } diff --git a/cmd/helm/installer/options.go b/cmd/helm/installer/options.go index dbcb376c5..186286ec2 100644 --- a/cmd/helm/installer/options.go +++ b/cmd/helm/installer/options.go @@ -105,6 +105,9 @@ func (opts *Options) SelectImage() string { case opts.UseCanary: return defaultImage + ":canary" case opts.ImageSpec == "": + if version.BuildMetadata == "unreleased" { + return defaultImage + ":canary" + } return fmt.Sprintf("%s:%s", defaultImage, version.Version) default: return opts.ImageSpec From f5df47b1c855e02c66f57756af224bc9b1055b09 Mon Sep 17 00:00:00 2001 From: Alexander Matyushentsev Date: Fri, 1 Feb 2019 09:02:06 -0800 Subject: [PATCH 53/56] Fix: kind sorter incorrectly compares unknown and namespace (#5186) Signed-off-by: Alexander Matyushentsev --- pkg/tiller/kind_sorter.go | 17 ++++++++++++----- pkg/tiller/kind_sorter_test.go | 21 +++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/pkg/tiller/kind_sorter.go b/pkg/tiller/kind_sorter.go index 8aff4e6c1..ceeb0f928 100644 --- a/pkg/tiller/kind_sorter.go +++ b/pkg/tiller/kind_sorter.go @@ -124,14 +124,16 @@ func (k *kindSorter) Less(i, j int) bool { b := k.manifests[j] first, aok := k.ordering[a.Head.Kind] second, bok := k.ordering[b.Head.Kind] - // if same kind (including unknown) sub sort alphanumeric - if first == second { - // if both are unknown and of different kind sort by kind alphabetically - if !aok && !bok && a.Head.Kind != b.Head.Kind { + + if !aok && !bok { + // if both are unknown then sort alphabetically by kind and name + if a.Head.Kind != b.Head.Kind { return a.Head.Kind < b.Head.Kind + } else { + return a.Name < b.Name } - return a.Name < b.Name } + // unknown kind is last if !aok { return false @@ -139,6 +141,11 @@ func (k *kindSorter) Less(i, j int) bool { if !bok { return true } + + // if same kind sub sort alphanumeric + if first == second { + return a.Name < b.Name + } // sort different kinds return first < second } diff --git a/pkg/tiller/kind_sorter_test.go b/pkg/tiller/kind_sorter_test.go index 1c187e90d..56822f995 100644 --- a/pkg/tiller/kind_sorter_test.go +++ b/pkg/tiller/kind_sorter_test.go @@ -223,3 +223,24 @@ func TestKindSorterSubSort(t *testing.T) { }) } } + +func TestKindSorterNamespaceAgainstUnknown(t *testing.T) { + unknown := Manifest{ + Name: "a", + Head: &util.SimpleHead{Kind: "Unknown"}, + } + namespace := Manifest{ + Name: "b", + Head: &util.SimpleHead{Kind: "Namespace"}, + } + + manifests := []Manifest{unknown, namespace} + sortByKind(manifests, InstallOrder) + + expectedOrder := []Manifest{namespace, unknown} + for i, manifest := range manifests { + if expectedOrder[i].Name != manifest.Name { + t.Errorf("Expected %s, got %s", expectedOrder[i].Name, manifest.Name) + } + } +} From 3953f0e884afd85a68ab4d8b4488cec735e2bc58 Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Fri, 1 Feb 2019 12:12:03 -0500 Subject: [PATCH 54/56] fix(helm): add test for repo update strict flag (#5183) While adding the test, noticed a race in the repo update code, due to multiple go routines potentially incrementing the error counter. Included the required mutex in the repo update code in the same commit, since the new test uncovered the race condition. Signed-off-by: Arash Deshmeh --- cmd/helm/repo_update.go | 7 +++++++ cmd/helm/repo_update_test.go | 27 +++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/cmd/helm/repo_update.go b/cmd/helm/repo_update.go index 526300343..1a239b407 100644 --- a/cmd/helm/repo_update.go +++ b/cmd/helm/repo_update.go @@ -93,21 +93,28 @@ func updateCharts(repos []*repo.ChartRepository, out io.Writer, home helmpath.Ho var ( errorCounter int wg sync.WaitGroup + mu sync.Mutex ) for _, re := range repos { wg.Add(1) go func(re *repo.ChartRepository) { defer wg.Done() if re.Config.Name == localRepository { + mu.Lock() fmt.Fprintf(out, "...Skip %s chart repository\n", re.Config.Name) + mu.Unlock() return } err := re.DownloadIndexFile(home.Cache()) if err != nil { + mu.Lock() errorCounter++ fmt.Fprintf(out, "...Unable to get an update from the %q chart repository (%s):\n\t%s\n", re.Config.Name, re.Config.URL, err) + mu.Unlock() } else { + mu.Lock() fmt.Fprintf(out, "...Successfully got an update from the %q chart repository\n", re.Config.Name) + mu.Unlock() } }(re) } diff --git a/cmd/helm/repo_update_test.go b/cmd/helm/repo_update_test.go index 86af437c5..5b1058008 100644 --- a/cmd/helm/repo_update_test.go +++ b/cmd/helm/repo_update_test.go @@ -105,3 +105,30 @@ func TestUpdateCharts(t *testing.T) { t.Error("Update was not successful") } } + +func TestUpdateCmdStrictFlag(t *testing.T) { + thome, err := tempHelmHome(t) + if err != nil { + t.Fatal(err) + } + + cleanup := resetEnv() + defer func() { + os.RemoveAll(thome.String()) + cleanup() + }() + + settings.Home = thome + + out := bytes.NewBuffer(nil) + cmd := newRepoUpdateCmd(out) + cmd.ParseFlags([]string{"--strict"}) + + if err := cmd.RunE(cmd, []string{}); err == nil { + t.Fatal("expected error due to strict flag") + } + + if got := out.String(); !strings.Contains(got, "Unable to get an update") { + t.Errorf("Expected 'Unable to get an update', got %q", got) + } +} From c2e8720c7258dbfbee7cd2ed73114160a937e8fd Mon Sep 17 00:00:00 2001 From: Jecho Date: Fri, 1 Feb 2019 15:15:16 -0800 Subject: [PATCH 55/56] fixed minor typo in doc (#5249) Signed-off-by: Jecho Ricafrente --- docs/chart_tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/chart_tests.md b/docs/chart_tests.md index 300eeaf73..408656c4a 100644 --- a/docs/chart_tests.md +++ b/docs/chart_tests.md @@ -64,7 +64,7 @@ spec: ``` ## Steps to Run a Test Suite on a Release -1. `$ helm install wordpress` +1. `$ helm install stable/wordpress` ``` NAME: quirky-walrus LAST DEPLOYED: Mon Feb 13 13:50:43 2017 From 1f386a34ea170850f1239a850ce381356fd59ddd Mon Sep 17 00:00:00 2001 From: adshmh <23505281+adshmh@users.noreply.github.com> Date: Fri, 1 Feb 2019 18:44:46 -0500 Subject: [PATCH 56/56] add --devel flag to inspect command (#5141) * fix(helm): add --devel flag to allow inspect on pre-release chart versions Signed-off-by: Arash Deshmeh * fix(helm): remove some duplication from inspect command preparation Signed-off-by: Arash Deshmeh --- cmd/helm/inspect.go | 43 +++++++----- cmd/helm/inspect_test.go | 66 ++++++++++++++++++ .../prerelease-0.2.0-pre-release.tgz | Bin 0 -> 1064 bytes .../testdata/testcharts/prerelease/Chart.yaml | 6 ++ .../testdata/testcharts/prerelease/README.md | 13 ++++ .../prerelease/templates/alpine-pod.yaml | 26 +++++++ docs/helm/helm_inspect.md | 3 +- docs/helm/helm_inspect_chart.md | 3 +- docs/helm/helm_inspect_readme.md | 3 +- docs/helm/helm_inspect_values.md | 3 +- 10 files changed, 146 insertions(+), 20 deletions(-) create mode 100644 cmd/helm/testdata/testcharts/prerelease-0.2.0-pre-release.tgz create mode 100644 cmd/helm/testdata/testcharts/prerelease/Chart.yaml create mode 100644 cmd/helm/testdata/testcharts/prerelease/README.md create mode 100644 cmd/helm/testdata/testcharts/prerelease/templates/alpine-pod.yaml diff --git a/cmd/helm/inspect.go b/cmd/helm/inspect.go index 844116bc5..52e681e48 100644 --- a/cmd/helm/inspect.go +++ b/cmd/helm/inspect.go @@ -59,6 +59,7 @@ type inspectCmd struct { repoURL string username string password string + devel bool certFile string keyFile string @@ -88,12 +89,9 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, - insp.certFile, insp.keyFile, insp.caFile) - if err != nil { + if err := insp.prepare(args[0]); err != nil { return err } - insp.chartpath = cp return insp.run() }, } @@ -107,12 +105,9 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, - insp.certFile, insp.keyFile, insp.caFile) - if err != nil { + if err := insp.prepare(args[0]); err != nil { return err } - insp.chartpath = cp return insp.run() }, } @@ -126,12 +121,9 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, - insp.certFile, insp.keyFile, insp.caFile) - if err != nil { + if err := insp.prepare(args[0]); err != nil { return err } - insp.chartpath = cp return insp.run() }, } @@ -145,12 +137,9 @@ func newInspectCmd(out io.Writer) *cobra.Command { if err := checkArgsLength(len(args), "chart name"); err != nil { return err } - cp, err := locateChartPath(insp.repoURL, insp.username, insp.password, args[0], insp.version, insp.verify, insp.keyring, - insp.certFile, insp.keyFile, insp.caFile) - if err != nil { + if err := insp.prepare(args[0]); err != nil { return err } - insp.chartpath = cp return insp.run() }, } @@ -193,6 +182,12 @@ func newInspectCmd(out io.Writer) *cobra.Command { valuesSubCmd.Flags().StringVar(&insp.password, password, "", passworddesc) chartSubCmd.Flags().StringVar(&insp.password, password, "", passworddesc) + develFlag := "devel" + develDesc := "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored." + for _, subCmd := range cmds { + subCmd.Flags().BoolVar(&insp.devel, develFlag, false, develDesc) + } + certFile := "cert-file" certFiledesc := "verify certificates of HTTPS-enabled servers using this CA bundle" for _, subCmd := range cmds { @@ -218,6 +213,22 @@ func newInspectCmd(out io.Writer) *cobra.Command { return inspectCommand } +func (i *inspectCmd) prepare(chart string) error { + debug("Original chart version: %q", i.version) + if i.version == "" && i.devel { + debug("setting version to >0.0.0-0") + i.version = ">0.0.0-0" + } + + cp, err := locateChartPath(i.repoURL, i.username, i.password, chart, i.version, i.verify, i.keyring, + i.certFile, i.keyFile, i.caFile) + if err != nil { + return err + } + i.chartpath = cp + return nil +} + func (i *inspectCmd) run() error { chrt, err := chartutil.Load(i.chartpath) if err != nil { diff --git a/cmd/helm/inspect_test.go b/cmd/helm/inspect_test.go index b9dbf2ab6..c4ce005b0 100644 --- a/cmd/helm/inspect_test.go +++ b/cmd/helm/inspect_test.go @@ -19,8 +19,11 @@ package main import ( "bytes" "io/ioutil" + "os" "strings" "testing" + + "k8s.io/helm/pkg/repo/repotest" ) func TestInspect(t *testing.T) { @@ -78,3 +81,66 @@ func TestInspect(t *testing.T) { t.Errorf("expected empty values buffer, got %q", b.String()) } } + +func TestInspectPreReleaseChart(t *testing.T) { + hh, err := tempHelmHome(t) + if err != nil { + t.Fatal(err) + } + cleanup := resetEnv() + defer func() { + os.RemoveAll(hh.String()) + cleanup() + }() + + settings.Home = hh + + srv := repotest.NewServer(hh.String()) + defer srv.Stop() + + if _, err := srv.CopyCharts("testdata/testcharts/*.tgz*"); err != nil { + t.Fatal(err) + } + if err := srv.LinkIndices(); err != nil { + t.Fatal(err) + } + + tests := []struct { + name string + args []string + flags []string + fail bool + expectedErr string + }{ + { + name: "inspect pre-release chart", + args: []string{"prerelease"}, + fail: true, + expectedErr: "chart \"prerelease\" not found", + }, + { + name: "inspect pre-release chart with 'devel' flag", + args: []string{"prerelease"}, + flags: []string{"--devel"}, + fail: false, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + tt.flags = append(tt.flags, "--repo", srv.URL()) + cmd := newInspectCmd(ioutil.Discard) + cmd.SetArgs(tt.args) + cmd.ParseFlags(tt.flags) + if err := cmd.RunE(cmd, tt.args); err != nil { + if tt.fail { + if !strings.Contains(err.Error(), tt.expectedErr) { + t.Errorf("%q expected error: %s, got: %s", tt.name, tt.expectedErr, err.Error()) + } + return + } + t.Errorf("%q reported error: %s", tt.name, err) + } + }) + } +} diff --git a/cmd/helm/testdata/testcharts/prerelease-0.2.0-pre-release.tgz b/cmd/helm/testdata/testcharts/prerelease-0.2.0-pre-release.tgz new file mode 100644 index 0000000000000000000000000000000000000000..36c8f02da06c1b6b36342b1757e719074282c712 GIT binary patch literal 1064 zcmV+@1lRi?iwG0|00000|0w_~VMtOiV@ORlOnEsqVl!4SWK%V1T2nbTPgYhoO;>Dc zVQyr3R8em|NM&qo0PI&ykJ~mA-m`wiK)J@UY`yD!>)WCU(4cJ)Y=ZzrQNUwyY!RkN zl|xzUI{xnkNonnMw#cE24T^d$hDpvdADnrHYAjh&giPb_E3_`#VXdy7SMog1Z?3Py zZ=UDpzxlK%t|rC*CfAeMO)kmL1xw{2$vo5AI(gg1EG@ank5H zyrD*!9Uv@`WeK;ck(%HqsoQ&Kj7Ta|(;O=28lI2GoBwkr&A1{}CmQ|Ev6vDztu2Y? z$>`zyTDq!TW~HfvPE_2I)M5@Fj7Vy7DA3_N0f^n5?)TYUtd;CN)^s?G z_WSG;s+PE4ND}~sOH%CB0A9hziXg4XN{4Go<0eRkmPvp!;4GFK=qg!O;EYiq0tb-* zgtgp~hBAz$9`2p%l~=8Tm9c=LmYSif40NcShh!q?Ds<2nHUmO~*2%I}XoHm=O)^;G z#%PvHMIJBO!KTSJ?UJk}M}g#O)VL-wTJGj>l7?T%Ze>aE8UAREBRCvR!|v^;P#V1@ z?Ku`|+z^9wK*+n007-y@t9}8M0i{PQcPyz3>!~2l1 zN4W4A&J2euespI3ly`lPpE;R;H|tPpvf>g{{`TA=k%)}OOimLbdN!|LxweJvSA{%UNMkh z-|n!e0(hWwh@7wp7zB&s^K$`0S}L8fyMbXm9d60)1}D8Q!!U$Sx(YBUP3yPJ%FjWp z$&uv&d>a|ezh)P(l8TPNUywA1IpFDaarO{iz~E$-B)^&#O4JYrsZ!uh6A?p?;SL9c iDS6x<7~a^6?80>yxyVJnk^B_^0RR8mc}r0M6aWC+uN4~r literal 0 HcmV?d00001 diff --git a/cmd/helm/testdata/testcharts/prerelease/Chart.yaml b/cmd/helm/testdata/testcharts/prerelease/Chart.yaml new file mode 100644 index 000000000..d8d901473 --- /dev/null +++ b/cmd/helm/testdata/testcharts/prerelease/Chart.yaml @@ -0,0 +1,6 @@ +description: Deploy a basic Alpine Linux pod +home: https://k8s.io/helm +name: prerelease +sources: +- https://github.com/helm/helm +version: 0.2.0-pre-release diff --git a/cmd/helm/testdata/testcharts/prerelease/README.md b/cmd/helm/testdata/testcharts/prerelease/README.md new file mode 100644 index 000000000..3c32de5db --- /dev/null +++ b/cmd/helm/testdata/testcharts/prerelease/README.md @@ -0,0 +1,13 @@ +#Alpine: A simple Helm chart + +Run a single pod of Alpine Linux. + +This example was generated using the command `helm create alpine`. + +The `templates/` directory contains a very simple pod resource with a +couple of parameters. + +The `values.yaml` file contains the default values for the +`alpine-pod.yaml` template. + +You can install this example using `helm install docs/examples/alpine`. diff --git a/cmd/helm/testdata/testcharts/prerelease/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/prerelease/templates/alpine-pod.yaml new file mode 100644 index 000000000..f569d556c --- /dev/null +++ b/cmd/helm/testdata/testcharts/prerelease/templates/alpine-pod.yaml @@ -0,0 +1,26 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{.Release.Name}}-{{.Values.Name}}" + labels: + # The "heritage" label is used to track which tool deployed a given chart. + # It is useful for admins who want to see what releases a particular tool + # is responsible for. + app.kubernetes.io/managed-by: {{.Release.Service | quote }} + # The "release" convention makes it easy to tie a release to all of the + # Kubernetes resources that were created as part of that release. + app.kubernetes.io/instance: {{.Release.Name | quote }} + # This makes it easy to audit chart usage. + helm.sh/chart: "{{.Chart.Name}}-{{.Chart.Version}}" + annotations: + "helm.sh/created": {{.Release.Time.Seconds | quote }} +spec: + # This shows how to use a simple value. This will look for a passed-in value + # called restartPolicy. If it is not found, it will use the default value. + # {{default "Never" .restartPolicy}} is a slightly optimized version of the + # more conventional syntax: {{.restartPolicy | default "Never"}} + restartPolicy: {{default "Never" .Values.restartPolicy}} + containers: + - name: waiter + image: "alpine:3.3" + command: ["/bin/sleep","9000"] diff --git a/docs/helm/helm_inspect.md b/docs/helm/helm_inspect.md index 86689eeaa..8bdf1092d 100644 --- a/docs/helm/helm_inspect.md +++ b/docs/helm/helm_inspect.md @@ -20,6 +20,7 @@ helm inspect [CHART] [flags] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. -h, --help help for inspect --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") @@ -49,4 +50,4 @@ helm inspect [CHART] [flags] * [helm inspect readme](helm_inspect_readme.md) - shows inspect readme * [helm inspect values](helm_inspect_values.md) - shows inspect values -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 8-Jan-2019 diff --git a/docs/helm/helm_inspect_chart.md b/docs/helm/helm_inspect_chart.md index 2b9adbb7e..1cd13fc72 100644 --- a/docs/helm/helm_inspect_chart.md +++ b/docs/helm/helm_inspect_chart.md @@ -18,6 +18,7 @@ helm inspect chart [CHART] [flags] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. -h, --help help for chart --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") @@ -44,4 +45,4 @@ helm inspect chart [CHART] [flags] * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 8-Jan-2019 diff --git a/docs/helm/helm_inspect_readme.md b/docs/helm/helm_inspect_readme.md index d222cd53a..9570d19d6 100644 --- a/docs/helm/helm_inspect_readme.md +++ b/docs/helm/helm_inspect_readme.md @@ -18,6 +18,7 @@ helm inspect readme [CHART] [flags] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. -h, --help help for readme --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") @@ -42,4 +43,4 @@ helm inspect readme [CHART] [flags] * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 8-Jan-2019 diff --git a/docs/helm/helm_inspect_values.md b/docs/helm/helm_inspect_values.md index 9cca2fc32..a634134dd 100644 --- a/docs/helm/helm_inspect_values.md +++ b/docs/helm/helm_inspect_values.md @@ -18,6 +18,7 @@ helm inspect values [CHART] [flags] ``` --ca-file string chart repository url where to locate the requested chart --cert-file string verify certificates of HTTPS-enabled servers using this CA bundle + --devel use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored. -h, --help help for values --key-file string identify HTTPS client using this SSL key file --keyring string path to the keyring containing public verification keys (default "~/.gnupg/pubring.gpg") @@ -44,4 +45,4 @@ helm inspect values [CHART] [flags] * [helm inspect](helm_inspect.md) - inspect a chart -###### Auto generated by spf13/cobra on 1-Aug-2018 +###### Auto generated by spf13/cobra on 8-Jan-2019