Skip to content

Commit

Permalink
fix: pass namespace to helm template command (#771)
Browse files Browse the repository at this point in the history
Resolves #770
  • Loading branch information
olivierboudet authored and mumoshu committed Jul 30, 2019
1 parent e5038fb commit bce2f47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1906,8 +1906,8 @@ releases:

var helm = &mockHelmExec{}
var wantReleases = []mockTemplates{
{[]string{"--name", "myrelease1", "--output-dir", "output/subdir/helmfile-[a-z0-9]{8}-myrelease1"}},
{[]string{"--name", "myrelease2", "--output-dir", "output/subdir/helmfile-[a-z0-9]{8}-myrelease2"}},
{[]string{"--name", "myrelease1", "--namespace", "testNamespace", "--output-dir", "output/subdir/helmfile-[a-z0-9]{8}-myrelease1"}},
{[]string{"--name", "myrelease2", "--namespace", "testNamespace", "--output-dir", "output/subdir/helmfile-[a-z0-9]{8}-myrelease2"}},
}

var buffer bytes.Buffer
Expand All @@ -1920,12 +1920,13 @@ releases:
Env: "default",
Logger: logger,
helmExecer: helm,
Namespace: "testNamespace",
}, files)
app.Template(configImpl{})

for i := range wantReleases {
for j := range wantReleases[i].flags {
if j == 3 {
if j == 5 {
matched, _ := regexp.Match(wantReleases[i].flags[j], []byte(helm.templated[i].flags[j]))
if !matched {
t.Errorf("HelmState.TemplateReleases() = [%v], want %v", helm.templated[i].flags[j], wantReleases[i].flags[j])
Expand All @@ -1936,5 +1937,4 @@ releases:
}

}

}
2 changes: 2 additions & 0 deletions pkg/state/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,8 @@ func (st *HelmState) TemplateReleases(helm helmexec.Interface, outputDir string,
continue
}

st.applyDefaultsTo(&release)

flags, err := st.flagsForTemplate(helm, &release, 0)
if err != nil {
errs = append(errs, err)
Expand Down

0 comments on commit bce2f47

Please sign in to comment.