From 590bf10ab5b069425f045c3bea4dc210e7ce8e88 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Wed, 15 May 2019 14:08:51 -0700 Subject: [PATCH] fix(pkg/action): add namespace to release options ref: https://github.com/helm/helm/issues/5732 Signed-off-by: Adam Reese --- pkg/action/install.go | 1 + pkg/action/upgrade.go | 1 + pkg/chartutil/values.go | 2 ++ pkg/lint/rules/template.go | 5 ++++- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/action/install.go b/pkg/action/install.go index 26fbc082d..33cd6b53a 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -122,6 +122,7 @@ func (i *Install) Run(chrt *chart.Chart) (*release.Release, error) { options := chartutil.ReleaseOptions{ Name: i.ReleaseName, + Namespace: i.Namespace, IsInstall: true, } valuesToRender, err := chartutil.ToRenderValues(chrt, i.rawValues, options, caps) diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index f535c0d6c..eddacc6ea 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -146,6 +146,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart) (*release.Rele options := chartutil.ReleaseOptions{ Name: name, + Namespace: currentRelease.Namespace, IsUpgrade: true, } diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index 9d4a4fc15..c8a02382e 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -367,6 +367,7 @@ func CoalesceTables(dst, src map[string]interface{}) map[string]interface{} { // for the composition of the final values struct type ReleaseOptions struct { Name string + Namespace string IsUpgrade bool IsInstall bool } @@ -383,6 +384,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals map[string]interface{}, options "Capabilities": caps, "Release": map[string]interface{}{ "Name": options.Name, + "Namespace": options.Namespace, "IsUpgrade": options.IsUpgrade, "IsInstall": options.IsInstall, "Service": "Helm", diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index ae7a75ca7..5f1b2036e 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -50,7 +50,10 @@ func Templates(linter *support.Linter, values map[string]interface{}, namespace return } - options := chartutil.ReleaseOptions{Name: "testRelease"} + options := chartutil.ReleaseOptions{ + Name: "testRelease", + Namespace: namespace, + } cvals, err := chartutil.CoalesceValues(chart, values) if err != nil {