Skip to content

Commit 5bde7c5

Browse files
feat(upgrade): using the values instead of --reuse-values (#742)
Signed-off-by: Paolo Gallina <paologallina1992@gmail.com>
1 parent 1b168bd commit 5bde7c5

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

pkg/chart/chart.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ type Git interface {
7979
// InstallWithValues runs `helm install` for the given chart using the specified values file.
8080
// Pass a zero value for valuesFile in order to run install without specifying a values file.
8181
//
82-
// Upgrade runs `helm upgrade` against an existing release, and re-uses the previously computed values.
82+
// UpgradeWithValues runs `helm upgrade` against an existing release using the specified values file.
83+
// Pass a zero value for valuesFile in order to run install without specifying a values file.
8384
//
8485
// Test runs `helm test` against an existing release. Set the cleanup argument to true in order
8586
// to clean up test pods created by helm after the test command completes.
@@ -91,7 +92,7 @@ type Helm interface {
9192
BuildDependenciesWithArgs(chart string, extraArgs []string) error
9293
LintWithValues(chart string, valuesFile string) error
9394
InstallWithValues(chart string, valuesFile string, namespace string, release string) error
94-
Upgrade(chart string, namespace string, release string) error
95+
UpgradeWithValues(chart string, valuesFile string, namespace string, release string) error
9596
Test(namespace string, release string) error
9697
DeleteRelease(namespace string, release string)
9798
Version() (string, error)
@@ -660,7 +661,7 @@ func (t *Testing) doUpgrade(oldChart, newChart *Chart, oldChartMustPass bool) er
660661
return nil
661662
}
662663

663-
if err := t.helm.Upgrade(newChart.Path(), namespace, release); err != nil {
664+
if err := t.helm.UpgradeWithValues(newChart.Path(), valuesFile, namespace, release); err != nil {
664665
return err
665666
}
666667

pkg/chart/chart_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func (h *fakeHelm) LintWithValues(_ string, _ string) error { return nil }
111111
func (h *fakeHelm) InstallWithValues(_ string, _ string, _ string, _ string) error {
112112
return nil
113113
}
114-
func (h *fakeHelm) Upgrade(_ string, _ string, _ string) error {
114+
func (h *fakeHelm) UpgradeWithValues(_ string, _ string, _ string, _ string) error {
115115
return nil
116116
}
117117
func (h *fakeHelm) Test(_ string, _ string) error {

pkg/tool/helm.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,14 @@ func (h Helm) InstallWithValues(chart string, valuesFile string, namespace strin
7575
"--wait", values, h.extraArgs, h.extraSetArgs)
7676
}
7777

78-
func (h Helm) Upgrade(chart string, namespace string, release string) error {
78+
func (h Helm) UpgradeWithValues(chart string, valuesFile string, namespace string, release string) error {
79+
var values []string
80+
if valuesFile != "" {
81+
values = []string{"--values", valuesFile}
82+
}
83+
7984
return h.exec.RunProcess("helm", "upgrade", release, chart, "--namespace", namespace,
80-
"--reuse-values", "--wait", h.extraArgs, h.extraSetArgs)
85+
"--wait", values, h.extraArgs, h.extraSetArgs)
8186
}
8287

8388
func (h Helm) Test(namespace string, release string) error {

0 commit comments

Comments
 (0)