diff --git a/pkg/action/install.go b/pkg/action/install.go index e1a55618d..606226500 100644 --- a/pkg/action/install.go +++ b/pkg/action/install.go @@ -200,6 +200,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release. options := chartutil.ReleaseOptions{ Name: i.ReleaseName, Namespace: i.Namespace, + Revision: 1, IsInstall: true, } valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps) diff --git a/pkg/action/upgrade.go b/pkg/action/upgrade.go index e89ad6050..31fcc1471 100644 --- a/pkg/action/upgrade.go +++ b/pkg/action/upgrade.go @@ -147,6 +147,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin options := chartutil.ReleaseOptions{ Name: name, Namespace: currentRelease.Namespace, + Revision: revision, IsUpgrade: true, } diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index a6b55701c..d9b94212c 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -130,6 +130,7 @@ func ReadValuesFile(filename string) (Values, error) { type ReleaseOptions struct { Name string Namespace string + Revision int IsUpgrade bool IsInstall bool } @@ -149,6 +150,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals map[string]interface{}, options "Namespace": options.Namespace, "IsUpgrade": options.IsUpgrade, "IsInstall": options.IsInstall, + "Revision": options.Revision, "Service": "Helm", }, } diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index 00bcfefed..2cb328d5d 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -99,6 +99,8 @@ func TestToRenderValues(t *testing.T) { o := ReleaseOptions{ Name: "Seven Voyages", + Namespace: "default", + Revision: 1, IsInstall: true, } @@ -115,6 +117,12 @@ func TestToRenderValues(t *testing.T) { if name := relmap["Name"]; name.(string) != "Seven Voyages" { t.Errorf("Expected release name 'Seven Voyages', got %q", name) } + if namespace := relmap["Namespace"]; namespace.(string) != "default" { + t.Errorf("Expected namespace 'default', got %q", namespace) + } + if revision := relmap["Revision"]; revision.(int) != 1 { + t.Errorf("Expected revision '1', got %d", revision) + } if relmap["IsUpgrade"].(bool) { t.Error("Expected upgrade to be false.") }