Skip to content

Commit 0a49cff

Browse files
committed
fix: Support for kustomization as chart
A kustomization has not been properly chartified when a kustomization is specified on `releases[].chart` but there were no `releases[].strategicMergePatches` and `jsonPatches` specified. This fixes that.
1 parent 68432b1 commit 0a49cff

File tree

4 files changed

+25
-0
lines changed

4 files changed

+25
-0
lines changed

pkg/state/helmx.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package state
33
import (
44
"github.com/roboll/helmfile/pkg/helmexec"
55
"github.com/variantdev/chartify"
6+
"os"
7+
"path/filepath"
68
"strings"
79
)
810

@@ -29,6 +31,13 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
2931

3032
opts.ChartVersion = release.Version
3133

34+
dir := filepath.Join(st.basePath, release.Chart)
35+
if stat, _ := os.Stat(dir); stat != nil && stat.IsDir() {
36+
if exists, err := st.fileExists(filepath.Join(dir, "Chart.yaml")); err == nil && !exists {
37+
shouldRun = true
38+
}
39+
}
40+
3241
for _, d := range release.Dependencies {
3342
var dep string
3443

test/advanced/helmfile.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
releases:
2+
- name: kustomapp
3+
chart: ./kustomapp
4+
values:
5+
- namePrefix: kustomapp
6+
- name: patched
7+
chart: sp/podinfo

test/advanced/kustomapp/all.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: kustomapp
5+
namespace: default
6+
data:
7+
kustomappfoo: FOO
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
resources:
2+
- all.yaml

0 commit comments

Comments
 (0)