Skip to content

Commit 402fce3

Browse files
author
Matthew Fisher
committed
fix(chartutil): restore .Release.Revision
Signed-off-by: Matthew Fisher <matt.fisher@microsoft.com>
1 parent b42967f commit 402fce3

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

pkg/action/install.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ func (i *Install) Run(chrt *chart.Chart, vals map[string]interface{}) (*release.
200200
options := chartutil.ReleaseOptions{
201201
Name: i.ReleaseName,
202202
Namespace: i.Namespace,
203+
Revision: 1,
203204
IsInstall: true,
204205
}
205206
valuesToRender, err := chartutil.ToRenderValues(chrt, vals, options, caps)

pkg/action/upgrade.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ func (u *Upgrade) prepareUpgrade(name string, chart *chart.Chart, vals map[strin
147147
options := chartutil.ReleaseOptions{
148148
Name: name,
149149
Namespace: currentRelease.Namespace,
150+
Revision: revision,
150151
IsUpgrade: true,
151152
}
152153

pkg/chartutil/values.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ func ReadValuesFile(filename string) (Values, error) {
130130
type ReleaseOptions struct {
131131
Name string
132132
Namespace string
133+
Revision int
133134
IsUpgrade bool
134135
IsInstall bool
135136
}
@@ -149,6 +150,7 @@ func ToRenderValues(chrt *chart.Chart, chrtVals map[string]interface{}, options
149150
"Namespace": options.Namespace,
150151
"IsUpgrade": options.IsUpgrade,
151152
"IsInstall": options.IsInstall,
153+
"Revision": options.Revision,
152154
"Service": "Helm",
153155
},
154156
}

pkg/chartutil/values_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ func TestToRenderValues(t *testing.T) {
9999

100100
o := ReleaseOptions{
101101
Name: "Seven Voyages",
102+
Namespace: "default",
103+
Revision: 1,
102104
IsInstall: true,
103105
}
104106

@@ -115,6 +117,12 @@ func TestToRenderValues(t *testing.T) {
115117
if name := relmap["Name"]; name.(string) != "Seven Voyages" {
116118
t.Errorf("Expected release name 'Seven Voyages', got %q", name)
117119
}
120+
if namespace := relmap["Namespace"]; namespace.(string) != "default" {
121+
t.Errorf("Expected namespace 'default', got %q", namespace)
122+
}
123+
if revision := relmap["Revision"]; revision.(int) != 1 {
124+
t.Errorf("Expected revision '1', got %d", revision)
125+
}
118126
if relmap["IsUpgrade"].(bool) {
119127
t.Error("Expected upgrade to be false.")
120128
}

0 commit comments

Comments
 (0)