From 1c64d8fb8164406e63bf91e263b11485d43a8324 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 29 Oct 2019 13:46:36 -0700 Subject: [PATCH 01/50] fix(version): lift "unreleased" status Signed-off-by: Matthew Fisher --- cmd/helm/testdata/output/version-short.txt | 2 +- cmd/helm/testdata/output/version-template.txt | 2 +- cmd/helm/testdata/output/version.txt | 2 +- internal/version/version.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/helm/testdata/output/version-short.txt b/cmd/helm/testdata/output/version-short.txt index 5e7749489..d9fb9c736 100644 --- a/cmd/helm/testdata/output/version-short.txt +++ b/cmd/helm/testdata/output/version-short.txt @@ -1 +1 @@ -v3.0+unreleased +v3.0 diff --git a/cmd/helm/testdata/output/version-template.txt b/cmd/helm/testdata/output/version-template.txt index c12e29c2d..776c1919b 100644 --- a/cmd/helm/testdata/output/version-template.txt +++ b/cmd/helm/testdata/output/version-template.txt @@ -1 +1 @@ -Version: v3.0+unreleased \ No newline at end of file +Version: v3.0 \ No newline at end of file diff --git a/cmd/helm/testdata/output/version.txt b/cmd/helm/testdata/output/version.txt index 0d9b536e6..4b493d31c 100644 --- a/cmd/helm/testdata/output/version.txt +++ b/cmd/helm/testdata/output/version.txt @@ -1 +1 @@ -version.BuildInfo{Version:"v3.0+unreleased", GitCommit:"", GitTreeState:"", GoVersion:""} +version.BuildInfo{Version:"v3.0", GitCommit:"", GitTreeState:"", GoVersion:""} diff --git a/internal/version/version.go b/internal/version/version.go index 131a2b130..22439d11b 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -33,7 +33,7 @@ var ( version = "v3.0" // metadata is extra build time data - metadata = "unreleased" + metadata = "" // gitCommit is the git sha1 gitCommit = "" // gitTreeState is the state of the git tree From f16d3e295ca2dee5aeab0bd36c09400e74dd3f4d Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 31 Oct 2019 13:56:48 -0400 Subject: [PATCH 02/50] fix(comp): Protect against user's aliases If a user has aliases commands that we use in the completion script such as grep, cut, tail, it may cause the script to misbehave. By escaping the commands, we tell the shell not to use any aliases. Signed-off-by: Marc Khouzam --- cmd/helm/root.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/helm/root.go b/cmd/helm/root.go index fac0dc062..80a443972 100644 --- a/cmd/helm/root.go +++ b/cmd/helm/root.go @@ -64,12 +64,12 @@ __helm_override_flags_to_kubectl_flags() # --kubeconfig, -n, --namespace stay the same for kubectl # --kube-context becomes --context for kubectl __helm_debug "${FUNCNAME[0]}: flags to convert: $1" - echo "$1" | sed s/kube-context/context/ + echo "$1" | \sed s/kube-context/context/ } __helm_get_repos() { - eval $(__helm_binary_name) repo list 2>/dev/null | tail +2 | cut -f1 + eval $(__helm_binary_name) repo list 2>/dev/null | \tail +2 | \cut -f1 } __helm_get_contexts() @@ -125,7 +125,7 @@ __helm_zsh_comp_nospace() { # We only do this if there is a single choice left for completion # to reduce the times the user could be presented with the fake completion choice. - out=($(echo ${in[*]} | tr " " "\n" | \grep "^${cur}")) + out=($(echo ${in[*]} | \tr " " "\n" | \grep "^${cur}")) __helm_debug "${FUNCNAME[0]}: out is ${out[*]}" [ ${#out[*]} -eq 1 ] && out+=("${out}.") @@ -145,7 +145,7 @@ __helm_list_charts() for repo in $(__helm_get_repos); do if [[ "${cur}" =~ ^${repo}/.* ]]; then # We are doing completion from within a repo - out=$(eval $(__helm_binary_name) search repo ${cur} 2>/dev/null | cut -f1 | \grep ^${cur}) + out=$(eval $(__helm_binary_name) search repo ${cur} 2>/dev/null | \cut -f1 | \grep ^${cur}) nospace=0 elif [[ ${repo} =~ ^${cur}.* ]]; then # We are completing a repo name @@ -236,7 +236,7 @@ __helm_list_plugins() __helm_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}" local out # Use eval in case helm_binary_name contains a variable (e.g., $HOME/bin/h3) - if out=$(eval $(__helm_binary_name) plugin list 2>/dev/null | tail +2 | cut -f1); then + if out=$(eval $(__helm_binary_name) plugin list 2>/dev/null | \tail +2 | \cut -f1); then COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) ) fi } From 3e09e2fa2831ab0b51678171b7934cf9e6b4f8a7 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Wed, 6 Nov 2019 09:36:29 -0500 Subject: [PATCH 03/50] fix(cli): Sort output of helm env Before this change, running 'helm env' multiple times would generate a different order for the output each time. This is because Go purposely loops over hash maps in a random order. This commit sorts the environment variables by alphabetical order before generating the output. Signed-off-by: Marc Khouzam --- cmd/helm/env.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/cmd/helm/env.go b/cmd/helm/env.go index 1b9cb4012..2687272ba 100644 --- a/cmd/helm/env.go +++ b/cmd/helm/env.go @@ -19,6 +19,7 @@ package main import ( "fmt" "io" + "sort" "helm.sh/helm/v3/pkg/cli" @@ -55,8 +56,18 @@ type envOptions struct { } func (o *envOptions) run(out io.Writer) error { - for k, v := range o.settings.EnvVars() { - fmt.Printf("%s=\"%s\"\n", k, v) + envVars := o.settings.EnvVars() + + // Sort the variables by alphabetical order. + // This allows for a constant output across calls to 'helm env'. + var keys []string + for k := range envVars { + keys = append(keys, k) + } + sort.Strings(keys) + + for _, k := range keys { + fmt.Printf("%s=\"%s\"\n", k, envVars[k]) } return nil } From 9ed2a28eded7678ccc26f2079fa815eefb489683 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Fri, 8 Nov 2019 07:39:57 -0800 Subject: [PATCH 04/50] ref(tlsutil): remove ServerConfig dead code from Tiller days Signed-off-by: Matthew Fisher --- internal/tlsutil/cfg.go | 29 ++--------------------------- internal/tlsutil/tlsutil_test.go | 21 --------------------- 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/internal/tlsutil/cfg.go b/internal/tlsutil/cfg.go index f40258739..8b9d4329f 100644 --- a/internal/tlsutil/cfg.go +++ b/internal/tlsutil/cfg.go @@ -27,18 +27,14 @@ import ( // Options represents configurable options used to create client and server TLS configurations. type Options struct { CaCertFile string - // If either the KeyFile or CertFile is empty, ClientConfig() will not load them, - // preventing Helm from authenticating to Tiller. They are required to be non-empty - // when calling ServerConfig, otherwise an error is returned. + // If either the KeyFile or CertFile is empty, ClientConfig() will not load them. KeyFile string CertFile string // Client-only options InsecureSkipVerify bool - // Server-only options - ClientAuth tls.ClientAuthType } -// ClientConfig retusn a TLS configuration for use by a Helm client. +// ClientConfig returns a TLS configuration for use by a Helm client. func ClientConfig(opts Options) (cfg *tls.Config, err error) { var cert *tls.Certificate var pool *x509.CertPool @@ -60,24 +56,3 @@ func ClientConfig(opts Options) (cfg *tls.Config, err error) { cfg = &tls.Config{InsecureSkipVerify: opts.InsecureSkipVerify, Certificates: []tls.Certificate{*cert}, RootCAs: pool} return cfg, nil } - -// ServerConfig returns a TLS configuration for use by the Tiller server. -func ServerConfig(opts Options) (cfg *tls.Config, err error) { - var cert *tls.Certificate - var pool *x509.CertPool - - if cert, err = CertFromFilePair(opts.CertFile, opts.KeyFile); err != nil { - if os.IsNotExist(err) { - return nil, errors.Wrapf(err, "could not load x509 key pair (cert: %q, key: %q)", opts.CertFile, opts.KeyFile) - } - return nil, errors.Wrapf(err, "could not read x509 key pair (cert: %q, key: %q)", opts.CertFile, opts.KeyFile) - } - if opts.ClientAuth >= tls.VerifyClientCertIfGiven && opts.CaCertFile != "" { - if pool, err = CertPoolFromFile(opts.CaCertFile); err != nil { - return nil, err - } - } - - cfg = &tls.Config{MinVersion: tls.VersionTLS12, ClientAuth: opts.ClientAuth, Certificates: []tls.Certificate{*cert}, ClientCAs: pool} - return cfg, nil -} diff --git a/internal/tlsutil/tlsutil_test.go b/internal/tlsutil/tlsutil_test.go index c2a477272..811d64aa0 100644 --- a/internal/tlsutil/tlsutil_test.go +++ b/internal/tlsutil/tlsutil_test.go @@ -17,7 +17,6 @@ limitations under the License. package tlsutil import ( - "crypto/tls" "path/filepath" "testing" ) @@ -54,26 +53,6 @@ func TestClientConfig(t *testing.T) { } } -func TestServerConfig(t *testing.T) { - opts := Options{ - CaCertFile: testfile(t, testCaCertFile), - CertFile: testfile(t, testCertFile), - KeyFile: testfile(t, testKeyFile), - ClientAuth: tls.RequireAndVerifyClientCert, - } - - cfg, err := ServerConfig(opts) - if err != nil { - t.Fatalf("error building tls server config: %v", err) - } - if got := cfg.MinVersion; got != tls.VersionTLS12 { - t.Errorf("expecting TLS version 1.2, got %d", got) - } - if got := cfg.ClientCAs; got == nil { - t.Errorf("expecting non-nil CA pool") - } -} - func testfile(t *testing.T, file string) (path string) { var err error if path, err = filepath.Abs(filepath.Join(tlsTestDir, file)); err != nil { From 30e8ed2f3df9e776b5a5937d92e8ff45c54f984f Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Fri, 8 Nov 2019 17:22:47 -0500 Subject: [PATCH 05/50] fix(cli): helm list was ignoring some errors If the cluster is not reachable, helm list would not report that error. Signed-off-by: Marc Khouzam --- cmd/helm/list.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 32501530d..83edfe156 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -77,12 +77,15 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { client.SetStateMask() results, err := client.Run() + if err != nil { + return err + } if client.Short { for _, res := range results { fmt.Fprintln(out, res.Name) } - return err + return nil } return outfmt.Write(out, newReleaseListWriter(results)) From e91feed1a3c34ec15ff2bff4d07ee5e275a6d7b4 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 12 Nov 2019 13:12:45 -0800 Subject: [PATCH 06/50] fix(install): log the error when recording the release Signed-off-by: Matthew Fisher --- pkg/action/install.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 8f1b5528b..65c10f636 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -301,7 +301,9 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. // // One possible strategy would be to do a timed retry to see if we can get // this stored in the future. - i.recordRelease(rel) + if err := i.recordRelease(rel); err != nil { + i.cfg.Log("failed to record the release: %s", err) + } return rel, nil } From a9b178758c6c3c3f36f6bbd7a1b4359efae27366 Mon Sep 17 00:00:00 2001 From: flynnduism Date: Tue, 12 Nov 2019 14:27:30 -0800 Subject: [PATCH 07/50] fix(reame): update links to docs Signed-off-by: flynnduism --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9af358e10..fbabf7e44 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,12 @@ If you want to use a package manager: To rapidly get Helm up and running, start with the [Quick Start Guide](https://docs.helm.sh/using_helm/#quickstart-guide). -See the [installation guide](https://docs.helm.sh/using_helm/#installing-helm) for more options, +See the [installation guide](https://helm.sh/docs/intro/install/) for more options, including installing pre-releases. ## Docs -Get started with the [Quick Start guide](https://docs.helm.sh/using_helm/#quickstart-guide) or plunge into the [complete documentation](https://docs.helm.sh) +Get started with the [Quick Start guide](https://helm.sh/docs/intro/quickstart/) or plunge into the [complete documentation](https://helm.sh/docs) ## Roadmap From 8889625af63a93d08909af0c2cfdbddbcd7204db Mon Sep 17 00:00:00 2001 From: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> Date: Wed, 13 Nov 2019 18:29:48 +0100 Subject: [PATCH 08/50] fix: change error message to contain correct field name When reporting an incompatible Kubernetes version, due to a version constraint from the kubeVersion field, the error message should report with the correct field name. Signed-off-by: Daniel Strobusch <1847260+dastrobu@users.noreply.github.com> --- pkg/action/install.go | 2 +- pkg/action/install_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 4019dbc54..11862c57a 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -420,7 +420,7 @@ func (c *Configuration) renderResources(ch *chart.Chart, values chartutil.Values if ch.Metadata.KubeVersion != "" { if !chartutil.IsCompatibleRange(ch.Metadata.KubeVersion, caps.KubeVersion.String()) { - return hs, b, "", errors.Errorf("chart requires kubernetesVersion: %s which is incompatible with Kubernetes %s", ch.Metadata.KubeVersion, caps.KubeVersion.String()) + return hs, b, "", errors.Errorf("chart requires kubeVersion: %s which is incompatible with Kubernetes %s", ch.Metadata.KubeVersion, caps.KubeVersion.String()) } } diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go index bb36b843d..4637a4b10 100644 --- a/pkg/action/install_test.go +++ b/pkg/action/install_test.go @@ -306,7 +306,7 @@ func TestInstallRelease_KubeVersion(t *testing.T) { vals = map[string]interface{}{} _, err = instAction.Run(buildChart(withKube(">=99.0.0")), vals) is.Error(err) - is.Contains(err.Error(), "chart requires kubernetesVersion") + is.Contains(err.Error(), "chart requires kubeVersion") } func TestInstallRelease_Wait(t *testing.T) { From 44f72c4c0a55c8af25a88b363c3567408869aaa0 Mon Sep 17 00:00:00 2001 From: Jonathan Meyers Date: Mon, 18 Nov 2019 13:29:21 +0700 Subject: [PATCH 09/50] homebrew renamed formula to just helm from kubernetes-helm Signed-off-by: Jonathan Meyers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9af358e10..06a53cf4d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Unpack the `helm` binary and add it to your PATH and you are good to go! If you want to use a package manager: -- [Homebrew](https://brew.sh/) users can use `brew install kubernetes-helm`. +- [Homebrew](https://brew.sh/) users can use `brew install 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`. From 27c1ea63c70368d92ca101eac2efc569e3717520 Mon Sep 17 00:00:00 2001 From: Jonathan Meyers Date: Mon, 18 Nov 2019 13:34:41 +0700 Subject: [PATCH 10/50] Signed-off-by: Jonathan Meyers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 06a53cf4d..ff8842962 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Unpack the `helm` binary and add it to your PATH and you are good to go! If you want to use a package manager: -- [Homebrew](https://brew.sh/) users can use `brew install helm`. +- [Homebrew](https://brew.sh/) users can use `brew installhelm`. - [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`. From f65ce9167e08e9677940dce4bc5529db4dcf1665 Mon Sep 17 00:00:00 2001 From: Jonathan Meyers Date: Mon, 18 Nov 2019 13:35:01 +0700 Subject: [PATCH 11/50] Signed-off-by: Jonathan Meyers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff8842962..06a53cf4d 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Unpack the `helm` binary and add it to your PATH and you are good to go! If you want to use a package manager: -- [Homebrew](https://brew.sh/) users can use `brew installhelm`. +- [Homebrew](https://brew.sh/) users can use `brew install 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`. From 8a8463e08d8a52b59fd20739ec3aa98be5bf1177 Mon Sep 17 00:00:00 2001 From: Scott Morgan Date: Tue, 19 Nov 2019 17:18:45 -0600 Subject: [PATCH 12/50] fix(lint): Remove requirement that directory name and chart name match Signed-off-by: Scott Morgan --- pkg/lint/rules/chartfile.go | 8 -------- pkg/lint/rules/chartfile_test.go | 18 ------------------ 2 files changed, 26 deletions(-) diff --git a/pkg/lint/rules/chartfile.go b/pkg/lint/rules/chartfile.go index 35bb81571..70cb83bc5 100644 --- a/pkg/lint/rules/chartfile.go +++ b/pkg/lint/rules/chartfile.go @@ -46,7 +46,6 @@ func Chartfile(linter *support.Linter) { } linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartName(chartFile)) - linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartNameDirMatch(linter.ChartDir, chartFile)) // Chart metadata linter.RunLinterRule(support.ErrorSev, chartFileName, validateChartAPIVersion(chartFile)) @@ -82,13 +81,6 @@ func validateChartName(cf *chart.Metadata) error { return nil } -func validateChartNameDirMatch(chartDir string, cf *chart.Metadata) error { - if cf.Name != filepath.Base(chartDir) { - return errors.Errorf("directory name (%s) and chart name (%s) must be the same", filepath.Base(chartDir), cf.Name) - } - return nil -} - func validateChartAPIVersion(cf *chart.Metadata) error { if cf.APIVersion == "" { return errors.New("apiVersion is required. The value must be either \"v1\" or \"v2\"") diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index ff2a63583..f99299737 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -73,24 +73,6 @@ func TestValidateChartName(t *testing.T) { } } -func TestValidateChartNameDirMatch(t *testing.T) { - err := validateChartNameDirMatch(goodChartDir, goodChart) - if err != nil { - t.Errorf("validateChartNameDirMatch to return no error, gor a linter error") - } - // It has not name - err = validateChartNameDirMatch(badChartDir, badChart) - if err == nil { - t.Errorf("validatechartnamedirmatch to return a linter error, got no error") - } - - // Wrong path - err = validateChartNameDirMatch(badChartDir, goodChart) - if err == nil { - t.Errorf("validatechartnamedirmatch to return a linter error, got no error") - } -} - func TestValidateChartVersion(t *testing.T) { var failTest = []struct { Version string From eb833ccead99ecec15f3c192ad41bb041e284953 Mon Sep 17 00:00:00 2001 From: Scott Morgan Date: Wed, 20 Nov 2019 07:35:11 -0600 Subject: [PATCH 13/50] remove unused variable Signed-off-by: Scott Morgan --- pkg/lint/rules/chartfile_test.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index f99299737..fe306f653 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -30,18 +30,15 @@ import ( ) const ( - badChartDir = "testdata/badchartfile" - goodChartDir = "testdata/goodone" + badChartDir = "testdata/badchartfile" ) var ( badChartFilePath = filepath.Join(badChartDir, "Chart.yaml") - goodChartFilePath = filepath.Join(goodChartDir, "Chart.yaml") nonExistingChartFilePath = filepath.Join(os.TempDir(), "Chart.yaml") ) var badChart, _ = chartutil.LoadChartfile(badChartFilePath) -var goodChart, _ = chartutil.LoadChartfile(goodChartFilePath) // Validation functions Test func TestValidateChartYamlNotDirectory(t *testing.T) { From 32ce016054648f20168a2d7f4ff4b954686e0689 Mon Sep 17 00:00:00 2001 From: Scott Morgan Date: Wed, 20 Nov 2019 08:26:12 -0600 Subject: [PATCH 14/50] fix(lint): Remove requirement that directory name and chart name match Signed-off-by: Scott Morgan --- pkg/lint/lint_test.go | 15 ++++++--------- pkg/lint/rules/chartfile_test.go | 18 +++++++----------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/pkg/lint/lint_test.go b/pkg/lint/lint_test.go index b770704c6..2a982d088 100644 --- a/pkg/lint/lint_test.go +++ b/pkg/lint/lint_test.go @@ -35,12 +35,12 @@ const goodChartDir = "rules/testdata/goodone" func TestBadChart(t *testing.T) { m := All(badChartDir, values, namespace, strict).Messages - if len(m) != 8 { + if len(m) != 7 { t.Errorf("Number of errors %v", len(m)) t.Errorf("All didn't fail with expected errors, got %#v", m) } // There should be one INFO, 2 WARNINGs and one ERROR messages, check for them - var i, w, e, e2, e3, e4, e5, e6 bool + var i, w, e, e2, e3, e4, e5 bool for _, msg := range m { if msg.Severity == support.InfoSev { if strings.Contains(msg.Err.Error(), "icon is recommended") { @@ -59,24 +59,21 @@ func TestBadChart(t *testing.T) { if strings.Contains(msg.Err.Error(), "name is required") { e2 = true } - if strings.Contains(msg.Err.Error(), "directory name (badchartfile) and chart name () must be the same") { - e3 = true - } if strings.Contains(msg.Err.Error(), "apiVersion is required. The value must be either \"v1\" or \"v2\"") { - e4 = true + e3 = true } if strings.Contains(msg.Err.Error(), "chart type is not valid in apiVersion") { - e5 = true + e4 = true } if strings.Contains(msg.Err.Error(), "dependencies are not valid in the Chart file with apiVersion") { - e6 = true + e5 = true } } } - if !e || !e2 || !e3 || !e4 || !e5 || !e6 || !w || !i { + if !e || !e2 || !e3 || !e4 || !e5 || !w || !i { t.Errorf("Didn't find all the expected errors, got %#v", m) } } diff --git a/pkg/lint/rules/chartfile_test.go b/pkg/lint/rules/chartfile_test.go index fe306f653..d032dd12f 100644 --- a/pkg/lint/rules/chartfile_test.go +++ b/pkg/lint/rules/chartfile_test.go @@ -188,36 +188,32 @@ func TestChartfile(t *testing.T) { Chartfile(&linter) msgs := linter.Messages - if len(msgs) != 7 { - t.Errorf("Expected 7 errors, got %d", len(msgs)) + if len(msgs) != 6 { + t.Errorf("Expected 6 errors, got %d", len(msgs)) } if !strings.Contains(msgs[0].Err.Error(), "name is required") { t.Errorf("Unexpected message 0: %s", msgs[0].Err) } - if !strings.Contains(msgs[1].Err.Error(), "directory name (badchartfile) and chart name () must be the same") { + if !strings.Contains(msgs[1].Err.Error(), "apiVersion is required. The value must be either \"v1\" or \"v2\"") { t.Errorf("Unexpected message 1: %s", msgs[1].Err) } - if !strings.Contains(msgs[2].Err.Error(), "apiVersion is required. The value must be either \"v1\" or \"v2\"") { + if !strings.Contains(msgs[2].Err.Error(), "version '0.0.0.0' is not a valid SemVer") { t.Errorf("Unexpected message 2: %s", msgs[2].Err) } - if !strings.Contains(msgs[3].Err.Error(), "version '0.0.0.0' is not a valid SemVer") { + if !strings.Contains(msgs[3].Err.Error(), "icon is recommended") { t.Errorf("Unexpected message 3: %s", msgs[3].Err) } - if !strings.Contains(msgs[4].Err.Error(), "icon is recommended") { + if !strings.Contains(msgs[4].Err.Error(), "chart type is not valid in apiVersion") { t.Errorf("Unexpected message 4: %s", msgs[4].Err) } - if !strings.Contains(msgs[5].Err.Error(), "chart type is not valid in apiVersion") { + if !strings.Contains(msgs[5].Err.Error(), "dependencies are not valid in the Chart file with apiVersion") { t.Errorf("Unexpected message 5: %s", msgs[5].Err) } - if !strings.Contains(msgs[6].Err.Error(), "dependencies are not valid in the Chart file with apiVersion") { - t.Errorf("Unexpected message 6: %s", msgs[6].Err) - } - } From 6473234f43cbec7603124d684cb630dfdc4b1419 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 24 Nov 2019 22:25:10 -0500 Subject: [PATCH 15/50] fix(plugin): Add missing -n known flag Signed-off-by: Marc Khouzam --- cmd/helm/load_plugins.go | 2 +- cmd/helm/plugin_test.go | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index 53e082e96..d68cf46ee 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -127,7 +127,7 @@ func loadPlugins(baseCmd *cobra.Command, out io.Writer) { func manuallyProcessArgs(args []string) ([]string, []string) { known := []string{} unknown := []string{} - kvargs := []string{"--kube-context", "--namespace", "--kubeconfig", "--registry-config", "--repository-cache", "--repository-config"} + kvargs := []string{"--kube-context", "--namespace", "-n", "--kubeconfig", "--registry-config", "--repository-cache", "--repository-config"} knownArg := func(a string) bool { for _, pre := range kvargs { if strings.HasPrefix(a, pre+"=") { diff --git a/cmd/helm/plugin_test.go b/cmd/helm/plugin_test.go index 7bc8fe70c..3fd3a4197 100644 --- a/cmd/helm/plugin_test.go +++ b/cmd/helm/plugin_test.go @@ -30,14 +30,27 @@ func TestManuallyProcessArgs(t *testing.T) { "--debug", "--foo", "bar", "--kubeconfig=/home/foo", + "--kubeconfig", "/home/foo", + "--kube-context=test1", "--kube-context", "test1", + "-n=test2", "-n", "test2", + "--namespace=test2", + "--namespace", "test2", "--home=/tmp", "command", } expectKnown := []string{ - "--debug", "--kubeconfig=/home/foo", "--kube-context", "test1", "-n", "test2", + "--debug", + "--kubeconfig=/home/foo", + "--kubeconfig", "/home/foo", + "--kube-context=test1", + "--kube-context", "test1", + "-n=test2", + "-n", "test2", + "--namespace=test2", + "--namespace", "test2", } expectUnknown := []string{ From 5179f8d698d30b243fd9aa646fac76224510b28b Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 24 Nov 2019 22:50:22 -0500 Subject: [PATCH 16/50] fix(plugin): Avoid duplication of flag list Signed-off-by: Marc Khouzam --- cmd/helm/load_plugins.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index d68cf46ee..ed99a5164 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -136,11 +136,21 @@ func manuallyProcessArgs(args []string) ([]string, []string) { } return false } + + isKnown := func(v string) string { + for _, i := range kvargs { + if i == v { + return v + } + } + return "" + } + for i := 0; i < len(args); i++ { switch a := args[i]; a { case "--debug": known = append(known, a) - case "--kube-context", "--namespace", "-n", "--kubeconfig", "--registry-config", "--repository-cache", "--repository-config": + case isKnown(a): known = append(known, a, args[i+1]) i++ default: From e3f49085ccb7b8f35e988554392d5f7ec5e066ad Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Mon, 25 Nov 2019 12:38:57 +0100 Subject: [PATCH 17/50] chart_downloader: add test to verify that http opts are used correctly. (#7055) Signed-off-by: Andreas Stenius --- pkg/downloader/chart_downloader_test.go | 61 +++++++++++++++++++ pkg/downloader/testdata/repositories.yaml | 7 ++- .../repository/testing-ca-file-index.yaml | 14 +++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 pkg/downloader/testdata/repository/testing-ca-file-index.yaml diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 80249e240..abecf81eb 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -80,6 +80,67 @@ func TestResolveChartRef(t *testing.T) { } } +func TestResolveChartOpts(t *testing.T) { + tests := []struct { + name, ref, version string + expect []getter.Option + }{ + { + name: "repo with CA-file", + ref: "testing-ca-file/foo", + expect: []getter.Option{ + getter.WithURL("https://example.com/foo-1.2.3.tgz"), + getter.WithTLSClientConfig("cert", "key", "ca"), + }, + }, + } + + c := ChartDownloader{ + Out: os.Stderr, + RepositoryConfig: repoConfig, + RepositoryCache: repoCache, + Getters: getter.All(&cli.EnvSettings{ + RepositoryConfig: repoConfig, + RepositoryCache: repoCache, + }), + } + + // snapshot options + snapshot_opts := c.Options + + for _, tt := range tests { + // reset chart downloader options for each test case + c.Options = snapshot_opts + + expect, err := getter.NewHTTPGetter(tt.expect...) + if err != nil { + t.Errorf("%s: failed to setup http client: %s", tt.name, err) + continue + } + + u, err := c.ResolveChartVersion(tt.ref, tt.version) + if err != nil { + t.Errorf("%s: failed with error %s", tt.name, err) + continue + } + + got, err := getter.NewHTTPGetter( + append( + c.Options, + getter.WithURL(u.String()), + )... + ) + if err != nil { + t.Errorf("%s: failed to create http client: %s", tt.name, err) + continue + } + + if got != expect { + t.Errorf("%s: expected %s, got %s", tt.name, expect, got) + } + } +} + func TestVerifyChart(t *testing.T) { v, err := VerifyChart("testdata/signtest-0.1.0.tgz", "testdata/helm-test-key.pub") if err != nil { diff --git a/pkg/downloader/testdata/repositories.yaml b/pkg/downloader/testdata/repositories.yaml index 374d95c8a..430865269 100644 --- a/pkg/downloader/testdata/repositories.yaml +++ b/pkg/downloader/testdata/repositories.yaml @@ -15,4 +15,9 @@ repositories: - name: testing-relative url: "http://example.com/helm" - name: testing-relative-trailing-slash - url: "http://example.com/helm/" \ No newline at end of file + url: "http://example.com/helm/" + - name: testing-ca-file + url: "https://example.com" + certFile: "cert" + keyFile: "key" + caFile: "ca" diff --git a/pkg/downloader/testdata/repository/testing-ca-file-index.yaml b/pkg/downloader/testdata/repository/testing-ca-file-index.yaml new file mode 100644 index 000000000..17cdde1c6 --- /dev/null +++ b/pkg/downloader/testdata/repository/testing-ca-file-index.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +entries: + foo: + - name: foo + description: Foo Chart + home: https://helm.sh/helm + keywords: [] + maintainers: [] + sources: + - https://github.com/helm/charts + urls: + - https://example.com/foo-1.2.3.tgz + version: 1.2.3 + checksum: 0e6661f193211d7a5206918d42f5c2a9470b737d From d6c13616fa7beff70931255cce62ab336ce1531d Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Mon, 25 Nov 2019 13:10:15 +0100 Subject: [PATCH 18/50] chart_downloader: add TLS client config to options from repo config. (#7055) Signed-off-by: Andreas Stenius --- pkg/downloader/chart_downloader.go | 2 ++ pkg/downloader/chart_downloader_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 8e251bc89..9b9293455 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -214,6 +214,8 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, er c.Options = append(c.Options, getter.WithBasicAuth(r.Config.Username, r.Config.Password)) } + c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile)) + // Next, we need to load the index, and actually look up the chart. idxFile := filepath.Join(c.RepositoryCache, helmpath.CacheIndexFile(r.Config.Name)) i, err := repo.LoadIndexFile(idxFile) diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index abecf81eb..71a56d482 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -135,7 +135,7 @@ func TestResolveChartOpts(t *testing.T) { continue } - if got != expect { + if *(got.(*getter.HTTPGetter)) != *(expect.(*getter.HTTPGetter)) { t.Errorf("%s: expected %s, got %s", tt.name, expect, got) } } From d3ad6f9c78113fd4c577b31e41277796220e4c0f Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Mon, 25 Nov 2019 13:23:08 +0100 Subject: [PATCH 19/50] cli/pull: pass TLS config to chart downloader from flags. (#7055) Signed-off-by: Andreas Stenius --- pkg/action/pull.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/action/pull.go b/pkg/action/pull.go index aaf63861e..b0a3d2598 100644 --- a/pkg/action/pull.go +++ b/pkg/action/pull.go @@ -63,6 +63,7 @@ func (p *Pull) Run(chartRef string) (string, error) { Getters: getter.All(p.Settings), Options: []getter.Option{ getter.WithBasicAuth(p.Username, p.Password), + getter.WithTLSClientConfig(p.CertFile, p.KeyFile, p.CaFile), }, RepositoryConfig: p.Settings.RepositoryConfig, RepositoryCache: p.Settings.RepositoryCache, From 0f0aa6b43261b3f4b95fd7ee14107de2630dd446 Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Mon, 25 Nov 2019 13:37:20 +0100 Subject: [PATCH 20/50] chart_downloader: avoid overriding TLS options from command flags when not setup in repo config. Signed-off-by: Andreas Stenius --- pkg/downloader/chart_downloader.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/downloader/chart_downloader.go b/pkg/downloader/chart_downloader.go index 9b9293455..f3d4321c5 100644 --- a/pkg/downloader/chart_downloader.go +++ b/pkg/downloader/chart_downloader.go @@ -214,7 +214,9 @@ func (c *ChartDownloader) ResolveChartVersion(ref, version string) (*url.URL, er c.Options = append(c.Options, getter.WithBasicAuth(r.Config.Username, r.Config.Password)) } - c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile)) + if r.Config.CertFile != "" || r.Config.KeyFile != "" || r.Config.CAFile != "" { + c.Options = append(c.Options, getter.WithTLSClientConfig(r.Config.CertFile, r.Config.KeyFile, r.Config.CAFile)) + } // Next, we need to load the index, and actually look up the chart. idxFile := filepath.Join(c.RepositoryCache, helmpath.CacheIndexFile(r.Config.Name)) From 4c4328398ecc4f6eef07524f4bcddaca153b4570 Mon Sep 17 00:00:00 2001 From: Andreas Stenius Date: Mon, 25 Nov 2019 14:17:24 +0100 Subject: [PATCH 21/50] chart_downloader: fix lint issue. Signed-off-by: Andreas Stenius --- pkg/downloader/chart_downloader_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/downloader/chart_downloader_test.go b/pkg/downloader/chart_downloader_test.go index 71a56d482..e0692c8c8 100644 --- a/pkg/downloader/chart_downloader_test.go +++ b/pkg/downloader/chart_downloader_test.go @@ -87,7 +87,7 @@ func TestResolveChartOpts(t *testing.T) { }{ { name: "repo with CA-file", - ref: "testing-ca-file/foo", + ref: "testing-ca-file/foo", expect: []getter.Option{ getter.WithURL("https://example.com/foo-1.2.3.tgz"), getter.WithTLSClientConfig("cert", "key", "ca"), @@ -106,11 +106,11 @@ func TestResolveChartOpts(t *testing.T) { } // snapshot options - snapshot_opts := c.Options + snapshotOpts := c.Options for _, tt := range tests { // reset chart downloader options for each test case - c.Options = snapshot_opts + c.Options = snapshotOpts expect, err := getter.NewHTTPGetter(tt.expect...) if err != nil { @@ -128,7 +128,7 @@ func TestResolveChartOpts(t *testing.T) { append( c.Options, getter.WithURL(u.String()), - )... + )..., ) if err != nil { t.Errorf("%s: failed to create http client: %s", tt.name, err) From 32b4e2e5e998ee11559d132eae796f2b22fac0f7 Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Sun, 24 Nov 2019 23:08:13 -0500 Subject: [PATCH 22/50] fix(plugin): Avoid crash on missing flag When calling a plugin, if a global flag requiring a parameter was missing the parameter, helm would crash. For example: helm 2to3 --namespace Signed-off-by: Marc Khouzam --- cmd/helm/load_plugins.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/helm/load_plugins.go b/cmd/helm/load_plugins.go index ed99a5164..f2fb5c01d 100644 --- a/cmd/helm/load_plugins.go +++ b/cmd/helm/load_plugins.go @@ -151,8 +151,11 @@ func manuallyProcessArgs(args []string) ([]string, []string) { case "--debug": known = append(known, a) case isKnown(a): - known = append(known, a, args[i+1]) + known = append(known, a) i++ + if i < len(args) { + known = append(known, args[i]) + } default: if knownArg(a) { known = append(known, a) From 48704034a9f37a23eee192b32e15249b299e0767 Mon Sep 17 00:00:00 2001 From: chloel Date: Tue, 26 Nov 2019 16:48:15 -0500 Subject: [PATCH 23/50] fix: ignore pax header files in chart validation Signed-off-by: chloel --- pkg/chart/loader/archive.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/chart/loader/archive.go b/pkg/chart/loader/archive.go index 3c50fe379..7e187a170 100644 --- a/pkg/chart/loader/archive.go +++ b/pkg/chart/loader/archive.go @@ -126,6 +126,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 af59e32654f048d62b053afb0860a3bec77444fb Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Thu, 28 Nov 2019 13:01:20 +0100 Subject: [PATCH 24/50] docs(install): clarify the --replace flag (#7089) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs(install): clarify the --replace flag The description of the `--replace` flag was unclear, as it can’t be used to replace active releases. Signed-off-by: Remco Haszing * docs(install): reword replace flag description Signed-off-by: Remco Haszing --- cmd/helm/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 40935db17..0c14c013b 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -130,7 +130,7 @@ func newInstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { func addInstallFlags(f *pflag.FlagSet, client *action.Install, valueOpts *values.Options) { f.BoolVar(&client.DryRun, "dry-run", false, "simulate an install") f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during install") - f.BoolVar(&client.Replace, "replace", false, "re-use the given name, even if that name is already used. This is unsafe in production") + f.BoolVar(&client.Replace, "replace", false, "re-use the given name, only if that name is a deleted release which remains in the history. This is unsafe in production") f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)") f.BoolVar(&client.Wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.BoolVarP(&client.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)") From b8605c8d36960a552cdf74104f02762ef07e2713 Mon Sep 17 00:00:00 2001 From: Geoff Baskwill Date: Wed, 27 Nov 2019 19:46:34 -0500 Subject: [PATCH 25/50] test(pkg): add unit tests for tar file edge cases Adding unit tests for an issue that has come up multiple times where the archive processing code doesn't take into account the `tar.TypeXHeader` / `tar.TypeXGlobalHeader` entries that GitHub adds when creating a release archive for a chart, for example `https://github.com/org/repo/master.tar.gz`. Signed-off-by: Geoff Baskwill --- pkg/chart/loader/archive_test.go | 110 +++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 pkg/chart/loader/archive_test.go diff --git a/pkg/chart/loader/archive_test.go b/pkg/chart/loader/archive_test.go new file mode 100644 index 000000000..7d8c8b51e --- /dev/null +++ b/pkg/chart/loader/archive_test.go @@ -0,0 +1,110 @@ +/* +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 loader + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "testing" +) + +func TestLoadArchiveFiles(t *testing.T) { + tcs := []struct { + name string + generate func(w *tar.Writer) + check func(t *testing.T, files []*BufferedFile, err error) + }{ + { + name: "empty input should return no files", + generate: func(w *tar.Writer) {}, + check: func(t *testing.T, files []*BufferedFile, err error) { + if err.Error() != "no files in chart archive" { + t.Fatalf(`expected "no files in chart archive", got [%#v]`, err) + } + }, + }, + { + name: "should ignore files with XGlobalHeader type", + generate: func(w *tar.Writer) { + // simulate the presence of a `pax_global_header` file like you would get when + // processing a GitHub release archive. + _ = w.WriteHeader(&tar.Header{ + Typeflag: tar.TypeXGlobalHeader, + Name: "pax_global_header", + }) + + // we need to have at least one file, otherwise we'll get the "no files in chart archive" error + _ = w.WriteHeader(&tar.Header{ + Typeflag: tar.TypeReg, + Name: "dir/empty", + }) + }, + check: func(t *testing.T, files []*BufferedFile, err error) { + if err != nil { + t.Fatalf(`got unwanted error [%#v] for tar file with pax_global_header content`, err) + } + + if len(files) != 1 { + t.Fatalf(`expected to get one file but got [%v]`, files) + } + }, + }, + { + name: "should ignore files with TypeXHeader type", + generate: func(w *tar.Writer) { + // simulate the presence of a `pax_header` file like you might get when + // processing a GitHub release archive. + _ = w.WriteHeader(&tar.Header{ + Typeflag: tar.TypeXHeader, + Name: "pax_header", + }) + + // we need to have at least one file, otherwise we'll get the "no files in chart archive" error + _ = w.WriteHeader(&tar.Header{ + Typeflag: tar.TypeReg, + Name: "dir/empty", + }) + }, + check: func(t *testing.T, files []*BufferedFile, err error) { + if err != nil { + t.Fatalf(`got unwanted error [%#v] for tar file with pax_header content`, err) + } + + if len(files) != 1 { + t.Fatalf(`expected to get one file but got [%v]`, files) + } + }, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + buf := &bytes.Buffer{} + gzw := gzip.NewWriter(buf) + tw := tar.NewWriter(gzw) + + tc.generate(tw) + + _ = tw.Close() + _ = gzw.Close() + + files, err := LoadArchiveFiles(buf) + tc.check(t, files, err) + }) + } +} From 750b870aedd35b69b9ca1e1517635fa70367a309 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E7=9A=84=E6=BE=9C=E8=89=B2?= <33822635+zwwhdls@users.noreply.github.com> Date: Mon, 2 Dec 2019 22:57:51 +0800 Subject: [PATCH 26/50] fix stack overflow error (#7114) * fixed #7111 Signed-off-by: zwwhdls * update error message Signed-off-by: zwwhdls * add test case Signed-off-by: zwwhdls * fix lint error Signed-off-by: zwwhdls --- pkg/engine/engine.go | 8 ++++++++ pkg/engine/engine_test.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/pkg/engine/engine.go b/pkg/engine/engine.go index dae0b6be7..5a7d54993 100644 --- a/pkg/engine/engine.go +++ b/pkg/engine/engine.go @@ -93,11 +93,19 @@ func warnWrap(warn string) string { // initFunMap creates the Engine's FuncMap and adds context-specific functions. func (e Engine) initFunMap(t *template.Template, referenceTpls map[string]renderable) { funcMap := funcMap() + includedNames := make([]string, 0) // Add the 'include' function here so we can close over t. funcMap["include"] = func(name string, data interface{}) (string, error) { var buf strings.Builder + for _, n := range includedNames { + if n == name { + return "", errors.Wrapf(fmt.Errorf("unable to excute template"), "rendering template has a nested reference name: %s", name) + } + } + includedNames = append(includedNames, name) err := t.ExecuteTemplate(&buf, name, data) + includedNames = includedNames[:len(includedNames)-1] return buf.String(), err } diff --git a/pkg/engine/engine_test.go b/pkg/engine/engine_test.go index 031527dd0..f3609fcbd 100644 --- a/pkg/engine/engine_test.go +++ b/pkg/engine/engine_test.go @@ -460,6 +460,15 @@ func TestAlterFuncMap_include(t *testing.T) { }, } + // Check nested reference in include FuncMap + d := &chart.Chart{ + Metadata: &chart.Metadata{Name: "nested"}, + Templates: []*chart.File{ + {Name: "templates/quote", Data: []byte(`{{include "nested/templates/quote" . | indent 2}} dead.`)}, + {Name: "templates/_partial", Data: []byte(`{{.Release.Name}} - he`)}, + }, + } + v := chartutil.Values{ "Values": "", "Chart": c.Metadata, @@ -477,6 +486,12 @@ func TestAlterFuncMap_include(t *testing.T) { if got := out["conrad/templates/quote"]; got != expect { t.Errorf("Expected %q, got %q (%v)", expect, got, out) } + + _, err = Render(d, v) + expectErrName := "nested/templates/quote" + if err == nil { + t.Errorf("Expected err of nested reference name: %v", expectErrName) + } } func TestAlterFuncMap_require(t *testing.T) { From bf4cc97bbe7ca994894a87df63fdf7da6ee0841a Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Tue, 3 Dec 2019 08:48:44 -0500 Subject: [PATCH 27/50] fix(cli): IsReachable check for "get values" The 'helm get values' has its own Run() method in the action package. So, unlike the other 'get' variants, it needs to check for the reachability of the cluster itself. Signed-off-by: Marc Khouzam --- pkg/action/get_values.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/action/get_values.go b/pkg/action/get_values.go index 5bc3a7005..9c32db213 100644 --- a/pkg/action/get_values.go +++ b/pkg/action/get_values.go @@ -39,6 +39,10 @@ func NewGetValues(cfg *Configuration) *GetValues { // Run executes 'helm get values' against the given release. func (g *GetValues) Run(name string) (map[string]interface{}, error) { + if err := g.cfg.KubeClient.IsReachable(); err != nil { + return nil, err + } + rel, err := g.cfg.releaseContent(name, g.Version) if err != nil { return nil, err From cc33e394c7c464be1940a2f737a1f24887e4ca6f Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Thu, 28 Nov 2019 16:26:55 -0500 Subject: [PATCH 28/50] fix(tests): mapfile is not available on MacOS The mapfile command is not available on a standard MacOS install. To faciliate doing `make test` which runs validate-license.sh, let's use an array instead of mapfile. Signed-off-by: Marc Khouzam --- scripts/validate-license.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/validate-license.sh b/scripts/validate-license.sh index 00bd38ea2..dc247436f 100755 --- a/scripts/validate-license.sh +++ b/scripts/validate-license.sh @@ -27,14 +27,16 @@ find_files() { \( -name '*.go' -o -name '*.sh' \) } -mapfile -t failed_license_header < <(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License")') +# Use "|| :" to ignore the error code when grep returns empty +failed_license_header=($(find_files | xargs grep -L 'Licensed under the Apache License, Version 2.0 (the "License")' || :)) if (( ${#failed_license_header[@]} > 0 )); then echo "Some source files are missing license headers." printf '%s\n' "${failed_license_header[@]}" exit 1 fi -mapfile -t failed_copyright_header < <(find_files | xargs grep -L 'Copyright The Helm Authors.') +# Use "|| :" to ignore the error code when grep returns empty +failed_copyright_header=($(find_files | xargs grep -L 'Copyright The Helm Authors.' || :)) if (( ${#failed_copyright_header[@]} > 0 )); then echo "Some source files are missing the copyright header." printf '%s\n' "${failed_copyright_header[@]}" From 01aa1bd3a299f6a456c5472394fd5138a20b87ce Mon Sep 17 00:00:00 2001 From: Graham Goudeau Date: Tue, 3 Dec 2019 14:06:55 -0500 Subject: [PATCH 29/50] Add a flag to allow template to output CRDs Signed-off-by: Graham Goudeau --- cmd/helm/template.go | 9 +++ cmd/helm/template_test.go | 5 ++ .../testdata/output/template-with-crds.txt | 72 +++++++++++++++++++ .../subpop/charts/subchart1/crds/crdA.yaml | 13 ++++ 4 files changed, 99 insertions(+) create mode 100644 cmd/helm/testdata/output/template-with-crds.txt create mode 100644 pkg/chartutil/testdata/subpop/charts/subchart1/crds/crdA.yaml diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 5312d798f..b660cc69f 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -44,6 +44,7 @@ faked locally. Additionally, none of the server-side testing of chart validity func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { var validate bool + var includeCrds bool client := action.NewInstall(cfg) valueOpts := &values.Options{} var extraAPIs []string @@ -67,7 +68,14 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { var manifests bytes.Buffer + if includeCrds { + for _, f := range rel.Chart.CRDs() { + fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", f.Name, f.Data) + } + } + fmt.Fprintln(&manifests, strings.TrimSpace(rel.Manifest)) + if !client.DisableHooks { for _, m := range rel.Hooks { fmt.Fprintf(&manifests, "---\n# Source: %s\n%s\n", m.Path, m.Manifest) @@ -120,6 +128,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.StringArrayVarP(&showFiles, "show-only", "s", []string{}, "only show manifests rendered from the given templates") f.StringVar(&client.OutputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") f.BoolVar(&validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. This is the same validation performed on an install") + f.BoolVar(&includeCrds, "include-crds", false, "include CRDs in the templated output") f.StringArrayVarP(&extraAPIs, "api-versions", "a", []string{}, "Kubernetes api versions used for Capabilities.APIVersions") return cmd diff --git a/cmd/helm/template_test.go b/cmd/helm/template_test.go index 8aa2f6c06..735829432 100644 --- a/cmd/helm/template_test.go +++ b/cmd/helm/template_test.go @@ -79,6 +79,11 @@ func TestTemplateCmd(t *testing.T) { cmd: fmt.Sprintf("template --api-versions helm.k8s.io/test '%s'", chartPath), golden: "output/template-with-api-version.txt", }, + { + name: "template with CRDs", + cmd: fmt.Sprintf("template '%s' --include-crds", chartPath), + golden: "output/template-with-crds.txt", + }, } runTestCmd(t, tests) } diff --git a/cmd/helm/testdata/output/template-with-crds.txt b/cmd/helm/testdata/output/template-with-crds.txt new file mode 100644 index 000000000..9fa1c7e6d --- /dev/null +++ b/cmd/helm/testdata/output/template-with-crds.txt @@ -0,0 +1,72 @@ +--- +# Source: crds/crdA.yaml +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: testCRDs +spec: + group: testCRDGroups + names: + kind: TestCRD + listKind: TestCRDList + plural: TestCRDs + shortNames: + - tc + singular: authconfig + +--- +# Source: subchart1/charts/subcharta/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: subcharta + labels: + helm.sh/chart: "subcharta-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: apache + selector: + app.kubernetes.io/name: subcharta +--- +# Source: subchart1/charts/subchartb/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchartb + labels: + helm.sh/chart: "subchartb-0.1.0" +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchartb +--- +# Source: subchart1/templates/service.yaml +apiVersion: v1 +kind: Service +metadata: + name: subchart1 + labels: + helm.sh/chart: "subchart1-0.1.0" + app.kubernetes.io/instance: "RELEASE-NAME" + kube-version/major: "1" + kube-version/minor: "16" + kube-version/version: "v1.16.0" + kube-api-version/test: v1 +spec: + type: ClusterIP + ports: + - port: 80 + targetPort: 80 + protocol: TCP + name: nginx + selector: + app.kubernetes.io/name: subchart1 diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/crds/crdA.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/crds/crdA.yaml new file mode 100644 index 000000000..fca77fd4b --- /dev/null +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/crds/crdA.yaml @@ -0,0 +1,13 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: testCRDs +spec: + group: testCRDGroups + names: + kind: TestCRD + listKind: TestCRDList + plural: TestCRDs + shortNames: + - tc + singular: authconfig From e062146db3a9a9bec0e64f5db939416441b1af38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E7=9A=84=E6=BE=9C=E8=89=B2?= <33822635+zwwhdls@users.noreply.github.com> Date: Wed, 4 Dec 2019 22:25:50 +0800 Subject: [PATCH 30/50] fix "Chart.lock is out of sync with Chart.yaml" (#7119) * fixed #7101 Signed-off-by: zwwhdls * add test case Signed-off-by: zwwhdls * fix lint error Signed-off-by: zwwhdls * rename testcase Signed-off-by: zwwhdls --- pkg/downloader/manager.go | 7 ++++ pkg/downloader/manager_test.go | 68 ++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 4e9d691d8..81dd53614 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -149,6 +149,13 @@ func (m *Manager) Update() error { return err } + // downloadAll might overwrite dependency version, recalculate lock digest + newDigest, err := resolver.HashReq(req, lock.Dependencies) + if err != nil { + return err + } + lock.Digest = newDigest + // If the lock file hasn't changed, don't write a new one. oldLock := c.Lock if oldLock != nil && oldLock.Digest == lock.Digest { diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index 6e32b3e85..dd83c3dc2 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -181,6 +181,74 @@ func TestGetRepoNames(t *testing.T) { } } +func TestUpdateBeforeBuild(t *testing.T) { + // Set up a fake repo + srv, err := repotest.NewTempServer("testdata/*.tgz*") + if err != nil { + t.Fatal(err) + } + defer srv.Stop() + if err := srv.LinkIndices(); err != nil { + t.Fatal(err) + } + dir := func(p ...string) string { + return filepath.Join(append([]string{srv.Root()}, p...)...) + } + + // Save dep + d := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "dep-chart", + Version: "0.1.0", + APIVersion: "v1", + }, + } + if err := chartutil.SaveDir(d, dir()); err != nil { + t.Fatal(err) + } + // Save a chart + c := &chart.Chart{ + Metadata: &chart.Metadata{ + Name: "with-dependency", + Version: "0.1.0", + APIVersion: "v1", + Dependencies: []*chart.Dependency{{ + Name: d.Metadata.Name, + Version: ">=0.1.0", + Repository: "file://../dep-chart", + }}, + }, + } + if err := chartutil.SaveDir(c, dir()); err != nil { + t.Fatal(err) + } + + // Set-up a manager + b := bytes.NewBuffer(nil) + g := getter.Providers{getter.Provider{ + Schemes: []string{"http", "https"}, + New: getter.NewHTTPGetter, + }} + m := &Manager{ + ChartPath: dir(c.Metadata.Name), + Out: b, + Getters: g, + RepositoryConfig: dir("repositories.yaml"), + RepositoryCache: dir(), + } + + // Update before Build. see issue: https://github.com/helm/helm/issues/7101 + err = m.Update() + if err != nil { + t.Fatal(err) + } + + err = m.Build() + if err != nil { + t.Fatal(err) + } +} + // This function is the skeleton test code of failing tests for #6416 and #6871 and bugs due to #5874. // // This function is used by below tests that ensures success of build operation From a61c930de399e64fdafe5337a9c16a8625843758 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Wed, 4 Dec 2019 10:23:10 -0500 Subject: [PATCH 31/50] Fixing the code of conduct pointer When the v3 branch was started the code of conduct pointed to the Kubernetes one which pointed to the CNCF. Helm moved to be a CNCF project and the v2 code of conduct was pointed directly at the CNCF one. This was missed on the v3 branch. This updates the pointer. Signed-off-by: Matt Farina --- code-of-conduct.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code-of-conduct.md b/code-of-conduct.md index 0d15c00cf..91ccaf035 100644 --- a/code-of-conduct.md +++ b/code-of-conduct.md @@ -1,3 +1,3 @@ -# Kubernetes Community Code of Conduct +# Community Code of Conduct -Please refer to our [Kubernetes Community Code of Conduct](https://git.k8s.io/community/code-of-conduct.md) +Helm follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). From 2a66e1a0e1f9b820309cd658aecf10896ac65ca5 Mon Sep 17 00:00:00 2001 From: Karuppiah Natarajan Date: Wed, 4 Dec 2019 22:43:42 +0530 Subject: [PATCH 32/50] use sigs.k8s.io/yaml instead of gopkg.in/yaml.v2 this is for consistency as everywhere we use sigs.k8s.io/yaml package Signed-off-by: Karuppiah Natarajan --- cmd/helm/repo_add.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/repo_add.go b/cmd/helm/repo_add.go index 1c84ad8d6..e6afce3d5 100644 --- a/cmd/helm/repo_add.go +++ b/cmd/helm/repo_add.go @@ -29,7 +29,7 @@ import ( "github.com/gofrs/flock" "github.com/pkg/errors" "github.com/spf13/cobra" - "gopkg.in/yaml.v2" + "sigs.k8s.io/yaml" "helm.sh/helm/v3/cmd/helm/require" "helm.sh/helm/v3/pkg/getter" From a1dcb3c2e453f778456ed600549a384605e1a692 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Thu, 5 Dec 2019 15:48:02 -0500 Subject: [PATCH 33/50] Restoring fetch-dist and sign Make targets These make targets are used as part of the release process. They had yet to be brought over to the v3 branch from the v2 branch as they were developed after the branching happened. Signed-off-by: Matt Farina --- Makefile | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e48a20fd5..611222e28 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ -BINDIR := $(CURDIR)/bin -DIST_DIRS := find * -type d -exec -TARGETS := darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 -BINNAME ?= helm +BINDIR := $(CURDIR)/bin +DIST_DIRS := find * -type d -exec +TARGETS := darwin/amd64 linux/amd64 linux/386 linux/arm linux/arm64 linux/ppc64le windows/amd64 +TARGET_OBJS ?= darwin-amd64.tar.gz darwin-amd64.tar.gz.sha256 linux-amd64.tar.gz linux-amd64.tar.gz.sha256 linux-386.tar.gz linux-386.tar.gz.sha256 linux-arm.tar.gz linux-arm.tar.gz.sha256 linux-arm64.tar.gz linux-arm64.tar.gz.sha256 linux-ppc64le.tar.gz linux-ppc64le.tar.gz.sha256 windows-amd64.zip windows-amd64.zip.sha256 +BINNAME ?= helm GOPATH = $(shell go env GOPATH) DEP = $(GOPATH)/bin/dep @@ -138,6 +139,20 @@ dist: $(DIST_DIRS) zip -r helm-${VERSION}-{}.zip {} \; \ ) +.PHONY: fetch-dist +fetch-dist: + mkdir -p _dist + cd _dist && \ + for obj in ${TARGET_OBJS} ; do \ + curl -sSL -o helm-${VERSION}-$${obj} https://get.helm.sh/helm-${VERSION}-$${obj} ; \ + done + +.PHONY: sign +sign: + for f in _dist/*.{gz,zip,sha256} ; do \ + gpg --armor --detach-sign $${f} ; \ + done + .PHONY: checksum checksum: for f in _dist/*.{gz,zip} ; do \ From 361db773881415398ce05637f9f56bd6f2820c85 Mon Sep 17 00:00:00 2001 From: Robert Brennan Date: Thu, 5 Dec 2019 16:45:53 -0500 Subject: [PATCH 34/50] Fix godoc badge Signed-off-by: Robert Brennan --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bb1e40ca6..73fd189d7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CircleCI](https://circleci.com/gh/helm/helm.svg?style=shield)](https://circleci.com/gh/helm/helm) [![Go Report Card](https://goreportcard.com/badge/github.com/helm/helm)](https://goreportcard.com/report/github.com/helm/helm) -[![GoDoc](https://godoc.org/helm.sh/helm?status.svg)](https://godoc.org/helm.sh/helm) +[![GoDoc](https://img.shields.io/static/v1?label=godoc&message=reference&color=blue)](https://pkg.go.dev/helm.sh/helm/v3) [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3131/badge)](https://bestpractices.coreinfrastructure.org/projects/3131) Helm is a tool for managing Charts. Charts are packages of pre-configured Kubernetes resources. From 36a8001e2adc0e5cf1bc3a06c75777a0b2ee15b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E7=9A=84=E6=BE=9C=E8=89=B2?= <33822635+zwwhdls@users.noreply.github.com> Date: Fri, 6 Dec 2019 17:32:12 +0800 Subject: [PATCH 35/50] fix this inconsistency in the docs (#7157) Signed-off-by: zwwhdls --- cmd/helm/package.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index dd4bb2d17..f82c0950d 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -36,9 +36,6 @@ This command packages a chart into a versioned chart archive file. If a path is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory. -If no path is given, this will look in the present working directory for a -Chart.yaml file, and (if found) build the current directory into a chart. - Versioned chart archives are used by Helm package repositories. ` From 0e42a77ae6ae266cfa299de3b3bfd204f35b9f7a Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Fri, 6 Dec 2019 09:14:39 -0700 Subject: [PATCH 36/50] improved the error message for failed package signing (#6948) Signed-off-by: Matt Butcher --- cmd/helm/package.go | 8 ++++++++ pkg/provenance/sign.go | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/helm/package.go b/cmd/helm/package.go index f82c0950d..9f7961f95 100644 --- a/cmd/helm/package.go +++ b/cmd/helm/package.go @@ -37,6 +37,14 @@ is given, this will look at that path for a chart (which must contain a Chart.yaml file) and then package that directory. Versioned chart archives are used by Helm package repositories. + +To sign a chart, use the '--sign' flag. In most cases, you should also +provide '--keyring path/to/secret/keys' and '--key keyname'. + + $ helm package --sign ./mychart --key mykey --keyring ~/.gnupg/secring.gpg + +If '--keyring' is not specified, Helm usually defaults to the public keyring +unless your environment is otherwise configured. ` func newPackageCmd(out io.Writer) *cobra.Command { diff --git a/pkg/provenance/sign.go b/pkg/provenance/sign.go index 6032eb063..5d16779f1 100644 --- a/pkg/provenance/sign.go +++ b/pkg/provenance/sign.go @@ -169,7 +169,7 @@ func (s *Signatory) DecryptKey(fn PassphraseFetcher) error { if s.Entity == nil { return errors.New("private key not found") } else if s.Entity.PrivateKey == nil { - return errors.New("provided key is not a private key") + return errors.New("provided key is not a private key. Try providing a keyring with secret keys") } // Nothing else to do if key is not encrypted. @@ -203,7 +203,7 @@ func (s *Signatory) ClearSign(chartpath string) (string, error) { if s.Entity == nil { return "", errors.New("private key not found") } else if s.Entity.PrivateKey == nil { - return "", errors.New("provided key is not a private key") + return "", errors.New("provided key is not a private key. Try providing a keyring with secret keys") } if fi, err := os.Stat(chartpath); err != nil { From e47c67c427e9831d3df20befc7fa139404829ddc Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Fri, 6 Dec 2019 09:14:51 -0700 Subject: [PATCH 37/50] fix: clarified behavior of 'list --deleted' (#6950) Signed-off-by: Matt Butcher --- cmd/helm/list.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/helm/list.go b/cmd/helm/list.go index 83edfe156..0da0c21d3 100644 --- a/cmd/helm/list.go +++ b/cmd/helm/list.go @@ -97,7 +97,7 @@ func newListCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.BoolVarP(&client.ByDate, "date", "d", false, "sort by release date") f.BoolVarP(&client.SortReverse, "reverse", "r", false, "reverse the sort order") f.BoolVarP(&client.All, "all", "a", false, "show all releases, not just the ones marked deployed or failed") - f.BoolVar(&client.Uninstalled, "uninstalled", false, "show uninstalled releases") + f.BoolVar(&client.Uninstalled, "uninstalled", false, "show uninstalled releases (if 'helm uninstall --keep-history' was used)") f.BoolVar(&client.Superseded, "superseded", false, "show superseded releases") f.BoolVar(&client.Uninstalling, "uninstalling", false, "show releases that are currently being uninstalled") f.BoolVar(&client.Deployed, "deployed", false, "show deployed releases. If no other is specified, this will be automatically enabled") From cb81b07125585309d0cf5a17ce57dcd10429d8a1 Mon Sep 17 00:00:00 2001 From: Fabian Ruff Date: Fri, 22 Nov 2019 16:27:08 +0100 Subject: [PATCH 38/50] Reintroduce --is-upgrade to template command This change allows correct rendering of manifests for the upgrade case using `helm template`. Signed-off-by: Fabian Ruff --- cmd/helm/template.go | 1 + pkg/action/install.go | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index b660cc69f..a47631c0d 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -129,6 +129,7 @@ func newTemplateCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.StringVar(&client.OutputDir, "output-dir", "", "writes the executed templates to files in output-dir instead of stdout") f.BoolVar(&validate, "validate", false, "validate your manifests against the Kubernetes cluster you are currently pointing at. This is the same validation performed on an install") f.BoolVar(&includeCrds, "include-crds", false, "include CRDs in the templated output") + f.BoolVar(&client.IsUpgrade, "is-upgrade", false, "set .Release.IsUpgrade instead of .Release.IsInstall") f.StringArrayVarP(&extraAPIs, "api-versions", "a", []string{}, "Kubernetes api versions used for Capabilities.APIVersions") return cmd diff --git a/pkg/action/install.go b/pkg/action/install.go index 8cd270693..b08f2fb67 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -86,6 +86,8 @@ type Install struct { // APIVersions allows a manual set of supported API Versions to be passed // (for things like templating). These are ignored if ClientOnly is false APIVersions chartutil.VersionSet + // Used by helm template to render charts with .Relase.IsUpgrade. Ignored if Dry-Run is false + IsUpgrade bool } // ChartPathOptions captures common options used for controlling chart paths @@ -197,11 +199,14 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. return nil, err } + //special case for helm template --is-upgrade + isUpgrade := i.IsUpgrade && i.DryRun options := chartutil.ReleaseOptions{ Name: i.ReleaseName, Namespace: i.Namespace, Revision: 1, - IsInstall: true, + IsInstall: !isUpgrade, + IsUpgrade: isUpgrade, } valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps) if err != nil { @@ -237,7 +242,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. // we'll end up in a state where we will delete those resources upon // deleting the release because the manifest will be pointing at that // resource - if !i.ClientOnly { + if !i.ClientOnly && !isUpgrade { if err := existingResourceConflict(resources); err != nil { return nil, errors.Wrap(err, "rendered manifests contain a resource that already exists. Unable to continue with install") } From 357d265de0e72f02c493701cdbee9ecc6eb0a016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mat=C3=ADas=20de=20la=20C=C3=A1mara=20Beovide?= Date: Mon, 9 Dec 2019 13:48:31 -0300 Subject: [PATCH 39/50] fix(helm): add --description flag to helm (#7074) * fix(helm): add --description flag to 'helm install', 'helm upgrade', and 'helm uninstall' When added, this flag allow us to add a custom description to the release. E.g. '--description "my custom description"' Closes #7033 Signed-off-by: Juan Matias Kungfu de la Camara Beovide * fix(helm): fixed style issues on top of previous commit (https://github.com/helm/helm/commit/3a43a9a487270b40d42db451d4856dbec30cf72e) Closes #7033 Signed-off-by: Juan Matias Kungfu de la Camara Beovide * fix(helm): fixed wrong test issue on top of previous commit (3a43a9a) Closes #7033 Signed-off-by: Juan Matias Kungfu de la Camara Beovide --- cmd/helm/install.go | 1 + cmd/helm/uninstall.go | 1 + cmd/helm/upgrade.go | 1 + pkg/action/install.go | 7 ++++++- pkg/action/uninstall.go | 7 ++++++- pkg/action/upgrade.go | 13 +++++++++++-- 6 files changed, 26 insertions(+), 4 deletions(-) diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 0c14c013b..176250f84 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -135,6 +135,7 @@ func addInstallFlags(f *pflag.FlagSet, client *action.Install, valueOpts *values f.BoolVar(&client.Wait, "wait", false, "if set, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment, StatefulSet, or ReplicaSet are in a ready state before marking the release as successful. It will wait for as long as --timeout") f.BoolVarP(&client.GenerateName, "generate-name", "g", false, "generate the name (and omit the NAME parameter)") f.StringVar(&client.NameTemplate, "name-template", "", "specify template used to name the release") + f.StringVar(&client.Description, "description", "", "add a custom description") f.BoolVar(&client.Devel, "devel", false, "use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored") f.BoolVar(&client.DependencyUpdate, "dependency-update", false, "run helm dependency update before installing the chart") f.BoolVar(&client.Atomic, "atomic", false, "if set, installation process purges chart on fail. The --wait flag will be set automatically if --atomic is used") diff --git a/cmd/helm/uninstall.go b/cmd/helm/uninstall.go index 27b5a8426..7096d7873 100644 --- a/cmd/helm/uninstall.go +++ b/cmd/helm/uninstall.go @@ -69,6 +69,7 @@ func newUninstallCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.BoolVar(&client.DisableHooks, "no-hooks", false, "prevent hooks from running during uninstallation") f.BoolVar(&client.KeepHistory, "keep-history", false, "remove all associated resources and mark the release as deleted, but retain the release history") f.DurationVar(&client.Timeout, "timeout", 300*time.Second, "time to wait for any individual Kubernetes operation (like Jobs for hooks)") + f.StringVar(&client.Description, "description", "", "add a custom description") return cmd } diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index eadc3b63d..dce8ad74f 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -156,6 +156,7 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { f.IntVar(&client.MaxHistory, "history-max", 10, "limit the maximum number of revisions saved per release. Use 0 for no limit") f.BoolVar(&client.CleanupOnFail, "cleanup-on-fail", false, "allow deletion of new resources created in this upgrade when upgrade fails") f.BoolVar(&client.SubNotes, "render-subchart-notes", false, "if set, render subchart notes along with the parent") + f.StringVar(&client.Description, "description", "", "add a custom description") addChartPathOptionsFlags(f, &client.ChartPathOptions) addValueOptionsFlags(f, valueOpts) bindOutputFlag(cmd, &outfmt) diff --git a/pkg/action/install.go b/pkg/action/install.go index b08f2fb67..89a343a6f 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -79,6 +79,7 @@ type Install struct { ReleaseName string GenerateName bool NameTemplate string + Description string OutputDir string Atomic bool SkipCRDs bool @@ -297,7 +298,11 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. } } - rel.SetStatus(release.StatusDeployed, "Install complete") + if len(i.Description) > 0 { + rel.SetStatus(release.StatusDeployed, i.Description) + } else { + rel.SetStatus(release.StatusDeployed, "Install complete") + } // This is a tricky case. The release has been created, but the result // cannot be recorded. The truest thing to tell the user is that the diff --git a/pkg/action/uninstall.go b/pkg/action/uninstall.go index fb72a845b..dfaa98472 100644 --- a/pkg/action/uninstall.go +++ b/pkg/action/uninstall.go @@ -37,6 +37,7 @@ type Uninstall struct { DryRun bool KeepHistory bool Timeout time.Duration + Description string } // NewUninstall creates a new Uninstall object with the given configuration. @@ -118,7 +119,11 @@ func (u *Uninstall) Run(name string) (*release.UninstallReleaseResponse, error) } rel.Info.Status = release.StatusUninstalled - rel.Info.Description = "Uninstallation complete" + if len(u.Description) > 0 { + rel.Info.Description = u.Description + } else { + rel.Info.Description = "Uninstallation complete" + } if !u.KeepHistory { u.cfg.Log("purge requested for %s", name) diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index d0495a864..cdc40eaaa 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -58,6 +58,7 @@ type Upgrade struct { Atomic bool CleanupOnFail bool SubNotes bool + Description string } // NewUpgrade creates a new Upgrade object with the given configuration. @@ -218,7 +219,11 @@ func (u *Upgrade) performUpgrade(originalRelease, upgradedRelease *release.Relea if u.DryRun { u.cfg.Log("dry run for %s", upgradedRelease.Name) - upgradedRelease.Info.Description = "Dry run complete" + if len(u.Description) > 0 { + upgradedRelease.Info.Description = u.Description + } else { + upgradedRelease.Info.Description = "Dry run complete" + } return upgradedRelease, nil } @@ -270,7 +275,11 @@ func (u *Upgrade) performUpgrade(originalRelease, upgradedRelease *release.Relea u.cfg.recordRelease(originalRelease) upgradedRelease.Info.Status = release.StatusDeployed - upgradedRelease.Info.Description = "Upgrade complete" + if len(u.Description) > 0 { + upgradedRelease.Info.Description = u.Description + } else { + upgradedRelease.Info.Description = "Upgrade complete" + } return upgradedRelease, nil } From 735bc652a6618afb7502d8154086a1535c7629ea Mon Sep 17 00:00:00 2001 From: Marc Khouzam Date: Tue, 10 Dec 2019 15:33:30 -0500 Subject: [PATCH 40/50] fix(tests): Repair tests failures When the unreleased tag was removed, some tests that were added after the PR was created started failing. This fixes them. Signed-off-by: Marc Khouzam --- cmd/helm/testdata/output/version-client-shorthand.txt | 2 +- cmd/helm/testdata/output/version-client.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/helm/testdata/output/version-client-shorthand.txt b/cmd/helm/testdata/output/version-client-shorthand.txt index 0d9b536e6..4b493d31c 100644 --- a/cmd/helm/testdata/output/version-client-shorthand.txt +++ b/cmd/helm/testdata/output/version-client-shorthand.txt @@ -1 +1 @@ -version.BuildInfo{Version:"v3.0+unreleased", GitCommit:"", GitTreeState:"", GoVersion:""} +version.BuildInfo{Version:"v3.0", GitCommit:"", GitTreeState:"", GoVersion:""} diff --git a/cmd/helm/testdata/output/version-client.txt b/cmd/helm/testdata/output/version-client.txt index 0d9b536e6..4b493d31c 100644 --- a/cmd/helm/testdata/output/version-client.txt +++ b/cmd/helm/testdata/output/version-client.txt @@ -1 +1 @@ -version.BuildInfo{Version:"v3.0+unreleased", GitCommit:"", GitTreeState:"", GoVersion:""} +version.BuildInfo{Version:"v3.0", GitCommit:"", GitTreeState:"", GoVersion:""} From 95e74c71d91cb0417db768385f88e148e4533905 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Tue, 10 Dec 2019 13:54:24 -0800 Subject: [PATCH 41/50] chore(testdata): remove stale output These testdata output are never consumed Signed-off-by: Matthew Fisher --- cmd/helm/testdata/output/search-single.txt | 2 -- cmd/helm/testdata/output/status-with-resource.txt | 9 --------- cmd/helm/testdata/output/status.yaml | 10 ---------- 3 files changed, 21 deletions(-) delete mode 100644 cmd/helm/testdata/output/search-single.txt delete mode 100644 cmd/helm/testdata/output/status-with-resource.txt delete mode 100644 cmd/helm/testdata/output/status.yaml diff --git a/cmd/helm/testdata/output/search-single.txt b/cmd/helm/testdata/output/search-single.txt deleted file mode 100644 index 936605ae1..000000000 --- a/cmd/helm/testdata/output/search-single.txt +++ /dev/null @@ -1,2 +0,0 @@ -NAME CHART VERSION APP VERSION DESCRIPTION -testing/mariadb 0.3.0 Chart for MariaDB diff --git a/cmd/helm/testdata/output/status-with-resource.txt b/cmd/helm/testdata/output/status-with-resource.txt deleted file mode 100644 index 5f6f4e663..000000000 --- a/cmd/helm/testdata/output/status-with-resource.txt +++ /dev/null @@ -1,9 +0,0 @@ -NAME: flummoxed-chickadee -LAST DEPLOYED: 2016-01-16 00:00:00 +0000 UTC -NAMESPACE: default -STATUS: deployed - -RESOURCES: -resource A -resource B - diff --git a/cmd/helm/testdata/output/status.yaml b/cmd/helm/testdata/output/status.yaml deleted file mode 100644 index a7bc12276..000000000 --- a/cmd/helm/testdata/output/status.yaml +++ /dev/null @@ -1,10 +0,0 @@ -info: - deleted: "0001-01-01T00:00:00Z" - first_deployed: "0001-01-01T00:00:00Z" - last_deployed: "2016-01-16T00:00:00Z" - resources: | - resource A - resource B - status: deployed -name: flummoxed-chickadee -namespace: default From 9254be9675feb5f24201b55682d78afa7c25f256 Mon Sep 17 00:00:00 2001 From: Matthew Fisher Date: Wed, 11 Dec 2019 08:05:43 -0800 Subject: [PATCH 42/50] add Marc Khouzam as a core maintainer Signed-off-by: Matthew Fisher --- OWNERS | 1 + 1 file changed, 1 insertion(+) diff --git a/OWNERS b/OWNERS index 715c8993d..d7dac5514 100644 --- a/OWNERS +++ b/OWNERS @@ -4,6 +4,7 @@ maintainers: - fibonacci1729 - hickeyma - jdolitsky + - marckhouzam - mattfarina - michelleN - prydonius From 0cb0eaca948d55da1c824f201aa78f9313763f69 Mon Sep 17 00:00:00 2001 From: "Paul \"TBBle\" Hampson" Date: Thu, 12 Dec 2019 04:07:05 +1100 Subject: [PATCH 43/50] fix(*): Helm v3 handling of APIVersion v1 charts dependencies (#7009) * Include requirements.* as Files in APIVersionV1 Fixes #6974. This ensures that when reading a Chart marked with APIVersion v1, we maintain the behaviour of Helm v2 and include the requirements.yaml and requirements.lock in the Files collection, and hence produce charts that work correctly with Helm v2. Signed-off-by: Paul "Hampy" Hampson * Write out requirements.lock for APIVersion1 Charts This keeps the on-disk format consistent after `helm dependency update` of an APIVersion1 Chart. Signed-off-by: Paul "Hampy" Hampson * Exclude 'dependencies' from APVersion1 Chart.yaml This fixes `helm lint` against an APIVersion1 chart packaged with Helm v3. Signed-off-by: Paul "Hampy" Hampson * Generate APIVersion v2 charts for dependency tests As the generated chart contains no requirements.yaml in its files list, but has dependencies in its metadata, it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson * Generate APIVersion v2 charts for manager tests Specifically for the charts that have dependencies, the generated chart contains no requirements.yaml in its files but has dependencies in its metadata. Hence it is not a valid APIVersion v1 chart. Signed-off-by: Paul "Hampy" Hampson --- cmd/helm/dependency_update_test.go | 2 +- pkg/chart/loader/load.go | 6 ++++++ pkg/chartutil/chartfile.go | 9 +++++++++ pkg/chartutil/save.go | 9 +++++++++ pkg/downloader/manager.go | 10 +++++++--- pkg/downloader/manager_test.go | 4 ++-- 6 files changed, 34 insertions(+), 6 deletions(-) diff --git a/cmd/helm/dependency_update_test.go b/cmd/helm/dependency_update_test.go index 53d67ef59..9afc04f8d 100644 --- a/cmd/helm/dependency_update_test.go +++ b/cmd/helm/dependency_update_test.go @@ -182,7 +182,7 @@ func TestDependencyUpdateCmd_DontDeleteOldChartsOnError(t *testing.T) { func createTestingMetadata(name, baseURL string) *chart.Chart { return &chart.Chart{ Metadata: &chart.Metadata{ - APIVersion: chart.APIVersionV1, + APIVersion: chart.APIVersionV2, Name: name, Version: "1.2.3", Dependencies: []*chart.Dependency{ diff --git a/pkg/chart/loader/load.go b/pkg/chart/loader/load.go index 3c38519bc..dd4fd2dff 100644 --- a/pkg/chart/loader/load.go +++ b/pkg/chart/loader/load.go @@ -114,12 +114,18 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) { if err := yaml.Unmarshal(f.Data, c.Metadata); err != nil { return c, errors.Wrap(err, "cannot load requirements.yaml") } + if c.Metadata.APIVersion == chart.APIVersionV1 { + c.Files = append(c.Files, &chart.File{Name: f.Name, Data: f.Data}) + } // Deprecated: requirements.lock is deprecated use Chart.lock. case f.Name == "requirements.lock": c.Lock = new(chart.Lock) if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil { return c, errors.Wrap(err, "cannot load requirements.lock") } + if c.Metadata.APIVersion == chart.APIVersionV1 { + c.Files = append(c.Files, &chart.File{Name: f.Name, Data: f.Data}) + } case strings.HasPrefix(f.Name, "templates/"): c.Templates = append(c.Templates, &chart.File{Name: f.Name, Data: f.Data}) diff --git a/pkg/chartutil/chartfile.go b/pkg/chartutil/chartfile.go index 68176ed5d..756b87cfb 100644 --- a/pkg/chartutil/chartfile.go +++ b/pkg/chartutil/chartfile.go @@ -42,7 +42,16 @@ func LoadChartfile(filename string) (*chart.Metadata, error) { // // 'filename' should be the complete path and filename ('foo/Chart.yaml') func SaveChartfile(filename string, cf *chart.Metadata) error { + // Pull out the dependencies of a v1 Chart, since there's no way + // to tell the serialiser to skip a field for just this use case + savedDependencies := cf.Dependencies + if cf.APIVersion == chart.APIVersionV1 { + cf.Dependencies = nil + } out, err := yaml.Marshal(cf) + if cf.APIVersion == chart.APIVersionV1 { + cf.Dependencies = savedDependencies + } if err != nil { return err } diff --git a/pkg/chartutil/save.go b/pkg/chartutil/save.go index bc8f5bdd9..e264c4391 100644 --- a/pkg/chartutil/save.go +++ b/pkg/chartutil/save.go @@ -141,8 +141,17 @@ func Save(c *chart.Chart, outDir string) (string, error) { func writeTarContents(out *tar.Writer, c *chart.Chart, prefix string) error { base := filepath.Join(prefix, c.Name()) + // Pull out the dependencies of a v1 Chart, since there's no way + // to tell the serialiser to skip a field for just this use case + savedDependencies := c.Metadata.Dependencies + if c.Metadata.APIVersion == chart.APIVersionV1 { + c.Metadata.Dependencies = nil + } // Save Chart.yaml cdata, err := yaml.Marshal(c.Metadata) + if c.Metadata.APIVersion == chart.APIVersionV1 { + c.Metadata.Dependencies = savedDependencies + } if err != nil { return err } diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 81dd53614..e46af6944 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -163,7 +163,7 @@ func (m *Manager) Update() error { } // Finally, we need to write the lockfile. - return writeLock(m.ChartPath, lock) + return writeLock(m.ChartPath, lock, c.Metadata.APIVersion == chart.APIVersionV1) } func (m *Manager) loadChartDir() (*chart.Chart, error) { @@ -634,12 +634,16 @@ func (m *Manager) loadChartRepositories() (map[string]*repo.ChartRepository, err } // writeLock writes a lockfile to disk -func writeLock(chartpath string, lock *chart.Lock) error { +func writeLock(chartpath string, lock *chart.Lock, legacyLockfile bool) error { data, err := yaml.Marshal(lock) if err != nil { return err } - dest := filepath.Join(chartpath, "Chart.lock") + lockfileName := "Chart.lock" + if legacyLockfile { + lockfileName = "requirements.lock" + } + dest := filepath.Join(chartpath, lockfileName) return ioutil.WriteFile(dest, data, 0644) } diff --git a/pkg/downloader/manager_test.go b/pkg/downloader/manager_test.go index dd83c3dc2..ea235c13f 100644 --- a/pkg/downloader/manager_test.go +++ b/pkg/downloader/manager_test.go @@ -211,7 +211,7 @@ func TestUpdateBeforeBuild(t *testing.T) { Metadata: &chart.Metadata{ Name: "with-dependency", Version: "0.1.0", - APIVersion: "v1", + APIVersion: "v2", Dependencies: []*chart.Dependency{{ Name: d.Metadata.Name, Version: ">=0.1.0", @@ -285,7 +285,7 @@ func checkBuildWithOptionalFields(t *testing.T, chartName string, dep chart.Depe Metadata: &chart.Metadata{ Name: chartName, Version: "0.1.0", - APIVersion: "v1", + APIVersion: "v2", Dependencies: []*chart.Dependency{&dep}, }, } From 3d04c6c5ce5d019e3a1f58354ab9f67453a83f8a Mon Sep 17 00:00:00 2001 From: jabielecki <47531708+jabielecki@users.noreply.github.com> Date: Thu, 12 Dec 2019 12:41:55 +0100 Subject: [PATCH 44/50] ref(pkg/action): split test of filterList (#6875) The existing unit test doesn't cover the most important functionality of filterList(). Adding that check. Separately test the specific namespace-related behavior. Remove the dead variable anotherOldOne. Signed-off-by: Jakub Bielecki --- pkg/action/list_test.go | 55 ++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/pkg/action/list_test.go b/pkg/action/list_test.go index cd86aee68..378a747b0 100644 --- a/pkg/action/list_test.go +++ b/pkg/action/list_test.go @@ -237,27 +237,36 @@ func makeMeSomeReleases(store *storage.Storage, t *testing.T) { } func TestFilterList(t *testing.T) { - one := releaseStub() - one.Name = "one" - one.Namespace = "default" - one.Version = 1 - two := releaseStub() - two.Name = "two" - two.Namespace = "default" - two.Version = 1 - anotherOldOne := releaseStub() - anotherOldOne.Name = "one" - anotherOldOne.Namespace = "testing" - anotherOldOne.Version = 1 - anotherOne := releaseStub() - anotherOne.Name = "one" - anotherOne.Namespace = "testing" - anotherOne.Version = 2 - - list := []*release.Release{one, two, anotherOne} - expectedFilteredList := []*release.Release{one, two, anotherOne} - - filteredList := filterList(list) - - assert.ElementsMatch(t, expectedFilteredList, filteredList) + t.Run("should filter old versions of the same release", func(t *testing.T) { + r1 := releaseStub() + r1.Name = "r" + r1.Version = 1 + r2 := releaseStub() + r2.Name = "r" + r2.Version = 2 + another := releaseStub() + another.Name = "another" + another.Version = 1 + + filteredList := filterList([]*release.Release{r1, r2, another}) + expectedFilteredList := []*release.Release{r2, another} + + assert.ElementsMatch(t, expectedFilteredList, filteredList) + }) + + t.Run("should not filter out any version across namespaces", func(t *testing.T) { + r1 := releaseStub() + r1.Name = "r" + r1.Namespace = "default" + r1.Version = 1 + r2 := releaseStub() + r2.Name = "r" + r2.Namespace = "testing" + r2.Version = 2 + + filteredList := filterList([]*release.Release{r1, r2}) + expectedFilteredList := []*release.Release{r1, r2} + + assert.ElementsMatch(t, expectedFilteredList, filteredList) + }) } From 0fd76b2a2bca5b3febf6488c860a7c6502c70086 Mon Sep 17 00:00:00 2001 From: kvendingoldo Date: Fri, 13 Dec 2019 20:50:25 +0400 Subject: [PATCH 45/50] fix(cmd): Add message about deprecated chart (#6889) Signed-off-by: Alexander Sharov --- cmd/helm/install.go | 5 +++++ cmd/helm/install_test.go | 6 ++++++ cmd/helm/testdata/output/deprecated-chart.txt | 7 +++++++ cmd/helm/testdata/testcharts/deprecated/Chart.yaml | 8 ++++++++ cmd/helm/testdata/testcharts/deprecated/README.md | 3 +++ cmd/helm/upgrade.go | 4 ++++ 6 files changed, 33 insertions(+) create mode 100644 cmd/helm/testdata/output/deprecated-chart.txt create mode 100644 cmd/helm/testdata/testcharts/deprecated/Chart.yaml create mode 100644 cmd/helm/testdata/testcharts/deprecated/README.md diff --git a/cmd/helm/install.go b/cmd/helm/install.go index 176250f84..b75dfce74 100644 --- a/cmd/helm/install.go +++ b/cmd/helm/install.go @@ -17,6 +17,7 @@ limitations under the License. package main import ( + "fmt" "io" "time" @@ -182,6 +183,10 @@ func runInstall(args []string, client *action.Install, valueOpts *values.Options return nil, err } + if chartRequested.Metadata.Deprecated { + fmt.Fprintln(out, "WARNING: This chart is deprecated") + } + if req := chartRequested.Metadata.Dependencies; req != nil { // If CheckDependencies returns an error, we have unfulfilled dependencies. // As of Helm 2.4.0, this is treated as a stopping condition: diff --git a/cmd/helm/install_test.go b/cmd/helm/install_test.go index 9ab25417b..e8b573dfc 100644 --- a/cmd/helm/install_test.go +++ b/cmd/helm/install_test.go @@ -183,6 +183,12 @@ func TestInstall(t *testing.T) { wantError: true, golden: "output/subchart-schema-cli-negative.txt", }, + // Install deprecated chart + { + name: "install with warning about deprecated chart", + cmd: "install aeneas testdata/testcharts/deprecated --namespace default", + golden: "output/deprecated-chart.txt", + }, } runTestActionCmd(t, tests) diff --git a/cmd/helm/testdata/output/deprecated-chart.txt b/cmd/helm/testdata/output/deprecated-chart.txt new file mode 100644 index 000000000..e5be2c3f1 --- /dev/null +++ b/cmd/helm/testdata/output/deprecated-chart.txt @@ -0,0 +1,7 @@ +WARNING: This chart is deprecated +NAME: aeneas +LAST DEPLOYED: Fri Sep 2 22:04:05 1977 +NAMESPACE: default +STATUS: deployed +REVISION: 1 +TEST SUITE: None diff --git a/cmd/helm/testdata/testcharts/deprecated/Chart.yaml b/cmd/helm/testdata/testcharts/deprecated/Chart.yaml new file mode 100644 index 000000000..10185beeb --- /dev/null +++ b/cmd/helm/testdata/testcharts/deprecated/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +description: Deprecated testing chart +home: https://helm.sh/helm +name: deprecated +sources: + - https://github.com/helm/helm +version: 0.1.0 +deprecated: true diff --git a/cmd/helm/testdata/testcharts/deprecated/README.md b/cmd/helm/testdata/testcharts/deprecated/README.md new file mode 100644 index 000000000..0df9a8bbc --- /dev/null +++ b/cmd/helm/testdata/testcharts/deprecated/README.md @@ -0,0 +1,3 @@ +#Deprecated + +This space intentionally left blank. diff --git a/cmd/helm/upgrade.go b/cmd/helm/upgrade.go index dce8ad74f..acfc23198 100644 --- a/cmd/helm/upgrade.go +++ b/cmd/helm/upgrade.go @@ -127,6 +127,10 @@ func newUpgradeCmd(cfg *action.Configuration, out io.Writer) *cobra.Command { } } + if ch.Metadata.Deprecated { + fmt.Fprintln(out, "WARNING: This chart is deprecated") + } + rel, err := client.Run(args[0], ch, vals) if err != nil { return errors.Wrap(err, "UPGRADE FAILED") From 1efdd2ed628f7fb8b51393cc1abe93f83cfa3cee Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Fri, 13 Dec 2019 13:33:36 -0500 Subject: [PATCH 46/50] Updating to sprig 3.0.2 to bring in a bugfix Signed-off-by: Matt Farina --- go.mod | 4 ++-- go.sum | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 57b342ed2..8e972fdfe 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.13 require ( github.com/BurntSushi/toml v0.3.1 github.com/MakeNowJust/heredoc v0.0.0-20171113091838-e9091a26100e // indirect - github.com/Masterminds/semver/v3 v3.0.1 - github.com/Masterminds/sprig/v3 v3.0.0 + github.com/Masterminds/semver/v3 v3.0.3 + github.com/Masterminds/sprig/v3 v3.0.2 github.com/Masterminds/vcs v1.13.0 github.com/Microsoft/go-winio v0.4.12 // indirect github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a diff --git a/go.sum b/go.sum index 5659b06f8..fb11fdbc4 100644 --- a/go.sum +++ b/go.sum @@ -27,8 +27,12 @@ github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RP github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= github.com/Masterminds/semver/v3 v3.0.1 h1:2kKm5lb7dKVrt5TYUiAavE6oFc1cFT0057UVGT+JqLk= github.com/Masterminds/semver/v3 v3.0.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/Masterminds/semver/v3 v3.0.3 h1:znjIyLfpXEDQjOIEWh+ehwpTU14UzUPub3c3sm36u14= +github.com/Masterminds/semver/v3 v3.0.3/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= github.com/Masterminds/sprig/v3 v3.0.0 h1:KSQz7Nb08/3VU9E4ns29dDxcczhOD1q7O1UfM4G3t3g= github.com/Masterminds/sprig/v3 v3.0.0/go.mod h1:NEUY/Qq8Gdm2xgYA+NwJM6wmfdRV9xkh8h/Rld20R0U= +github.com/Masterminds/sprig/v3 v3.0.2 h1:wz22D0CiSctrliXiI9ZO3HoNApweeRGftyDN+BQa3B8= +github.com/Masterminds/sprig/v3 v3.0.2/go.mod h1:oesJ8kPONMONaZgtiHNzUShJbksypC5kWczhZAf6+aU= github.com/Masterminds/vcs v1.13.0 h1:USF5TvZGYgIpcbNAEMLfFhHqP08tFZVlUVrmTSpqnyA= github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= From 0eaa881c4e699910f1db97ac889f573124f002f3 Mon Sep 17 00:00:00 2001 From: Jason Pickens Date: Tue, 17 Dec 2019 03:47:24 +1300 Subject: [PATCH 47/50] Add missing statuses to the status help text (#7035) Signed-off-by: Jason Pickens --- cmd/helm/status.go | 3 ++- pkg/release/status.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/helm/status.go b/cmd/helm/status.go index 92e12dbe0..92a947c26 100644 --- a/cmd/helm/status.go +++ b/cmd/helm/status.go @@ -31,12 +31,13 @@ import ( "helm.sh/helm/v3/pkg/release" ) +// NOTE: Keep the list of statuses up-to-date with pkg/release/status.go. var statusHelp = ` This command shows the status of a named release. The status consists of: - last deployment time - k8s namespace in which the release lives -- state of the release (can be: unknown, deployed, deleted, superseded, failed or deleting) +- state of the release (can be: unknown, deployed, uninstalled, superseded, failed, uninstalling, pending-install, pending-upgrade or pending-rollback) - list of resources that this release consists of, sorted by kind - details on last test suite run, if applicable - additional notes provided by the chart diff --git a/pkg/release/status.go b/pkg/release/status.go index cd025e279..0e535f9a4 100644 --- a/pkg/release/status.go +++ b/pkg/release/status.go @@ -19,6 +19,7 @@ package release type Status string // Describe the status of a release +// NOTE: Make sure to update cmd/helm/status.go when adding or modifying any of these statuses. const ( // StatusUnknown indicates that a release is in an uncertain state. StatusUnknown Status = "unknown" From a3f00fde691585ffa2dc4934c6813d69ff0ec284 Mon Sep 17 00:00:00 2001 From: Lennard Eijsackers Date: Mon, 16 Dec 2019 18:14:06 +0100 Subject: [PATCH 48/50] fix(helm): Validate number of arguments in install client The 'helm install' command returned confusing error messages if a flag was misspecified (e.g. `helm install name chart --set value foo`). This lead to an error indicating that a name should be specified for the command. Now an explicit check is done on the number of arguments passed, returning a message indicating the invalid arguments (`foo` in the example`). Closes #7225 Signed-off-by: Lennard Eijsackers --- pkg/action/install.go | 4 ++++ pkg/action/install_test.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/pkg/action/install.go b/pkg/action/install.go index 89a343a6f..dc5941810 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -555,6 +555,10 @@ func (i *Install) NameAndChart(args []string) (string, string, error) { return nil } + if len(args) > 2 { + return args[0], args[1], errors.Errorf("expected at most two arguments, unexpected arguments: %v", strings.Join(args[2:], ", ")) + } + if len(args) == 2 { return args[0], args[1], flagsNotSet() } diff --git a/pkg/action/install_test.go b/pkg/action/install_test.go index 4637a4b10..d6f1c88cd 100644 --- a/pkg/action/install_test.go +++ b/pkg/action/install_test.go @@ -505,6 +505,14 @@ func TestNameAndChart(t *testing.T) { t.Fatal("expected an error") } is.Equal("must either provide a name or specify --generate-name", err.Error()) + + instAction.NameTemplate = "" + instAction.ReleaseName = "" + _, _, err = instAction.NameAndChart([]string{"foo", chartName, "bar"}) + if err == nil { + t.Fatal("expected an error") + } + is.Equal("expected at most two arguments, unexpected arguments: bar", err.Error()) } func TestNameAndChartGenerateName(t *testing.T) { From b6e2a14306964a6fe756abff85d3195542a2f1fd Mon Sep 17 00:00:00 2001 From: Martin Hickey Date: Tue, 17 Dec 2019 17:41:04 +0000 Subject: [PATCH 49/50] fix(kube): Port use of watcher with retries to wait for resources (#7217) * Port watcher with retries to wait for resources Port of Helm 2 PR #6014 to Helm 3 Signed-off-by: Martin Hickey * Add fix from PR #6907 Signed-off-by: Martin Hickey --- pkg/kube/client.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/kube/client.go b/pkg/kube/client.go index ab1f600ff..96179d19d 100644 --- a/pkg/kube/client.go +++ b/pkg/kube/client.go @@ -34,6 +34,7 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" @@ -41,6 +42,7 @@ import ( "k8s.io/cli-runtime/pkg/genericclioptions" "k8s.io/cli-runtime/pkg/resource" "k8s.io/client-go/kubernetes/scheme" + cachetools "k8s.io/client-go/tools/cache" watchtools "k8s.io/client-go/tools/watch" cmdutil "k8s.io/kubectl/pkg/cmd/util" ) @@ -419,10 +421,13 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err c.Log("Watching for changes to %s %s with timeout of %v", kind, info.Name, timeout) - w, err := resource.NewHelper(info.Client, info.Mapping).WatchSingle(info.Namespace, info.Name, info.ResourceVersion) + // Use a selector on the name of the resource. This should be unique for the + // given version and kind + selector, err := fields.ParseSelector(fmt.Sprintf("metadata.name=%s", info.Name)) if err != nil { return err } + lw := cachetools.NewListWatchFromClient(info.Client, info.Mapping.Resource.Resource, info.Namespace, selector) // What we watch for depends on the Kind. // - For a Job, we watch for completion. @@ -432,7 +437,7 @@ func (c *Client) watchUntilReady(timeout time.Duration, info *resource.Info) err ctx, cancel := watchtools.ContextWithOptionalTimeout(context.Background(), timeout) defer cancel() - _, err = watchtools.UntilWithoutRetry(ctx, w, func(e watch.Event) (bool, error) { + _, err = watchtools.ListWatchUntil(ctx, lw, func(e watch.Event) (bool, error) { // Make sure the incoming object is versioned as we use unstructured // objects when we build manifests obj := convertWithMapper(e.Object, info.Mapping) From bd8dbcac8bb9252d501c8c6f5b0c13828ac33a6e Mon Sep 17 00:00:00 2001 From: Matt Butcher Date: Tue, 17 Dec 2019 11:33:52 -0700 Subject: [PATCH 50/50] add technosophos public key (#7256) Signed-off-by: Matt Butcher --- KEYS | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) diff --git a/KEYS b/KEYS index 929938710..95e52f71c 100644 --- a/KEYS +++ b/KEYS @@ -622,3 +622,233 @@ BlA4kJPTfla4LmKRg/T/xow/naen/aM9mQCs7k2UAoeqNZ6IfQ6G5BZ81H9JNvHC beriLZDBuRy1LJRjBmZEz+UDBgZoR9oz5DOLh8dGVpkt =HZO9 -----END PGP PUBLIC KEY BLOCK----- +pub rsa4096 2014-05-13 [SCEA] + ABA2529598F6626C420D335B62F49E747D911B60 +uid [ unknown] Matt Butcher +sig 3 62F49E747D911B60 2017-08-11 Matt Butcher +sig 461449C25E36B98E 2018-12-12 Matthew Farina +sig 1EF612347F8A9958 2018-12-12 Adam Reese +sig 2CDBBFBB37AE822A 2018-12-12 Adnan Abdulhussein +uid [ unknown] technosophos (keybase.io/technosophos) +sig 3 62F49E747D911B60 2016-10-24 Matt Butcher +sig 461449C25E36B98E 2018-12-12 Matthew Farina +sig 1EF612347F8A9958 2018-12-12 Adam Reese +sig 2CDBBFBB37AE822A 2018-12-12 Adnan Abdulhussein +uid [ unknown] keybase.io/technosophos +sig 3 62F49E747D911B60 2014-05-13 Matt Butcher +sig 461449C25E36B98E 2018-12-12 Matthew Farina +sig 1EF612347F8A9958 2018-12-12 Adam Reese +sig 2CDBBFBB37AE822A 2018-12-12 Adnan Abdulhussein +sub rsa2048 2014-05-13 [S] [expires: 2022-05-11] +sig 62F49E747D911B60 2014-05-13 Matt Butcher +sub rsa2048 2014-05-13 [E] [expires: 2022-05-11] +sig 62F49E747D911B60 2014-05-13 Matt Butcher + +-----BEGI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