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.
This commit is contained in:
parent
68432b1848
commit
29fdb57add
|
|
@ -3,6 +3,8 @@ package state
|
|||
import (
|
||||
"github.com/roboll/helmfile/pkg/helmexec"
|
||||
"github.com/variantdev/chartify"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
|
@ -29,6 +31,13 @@ func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSp
|
|||
|
||||
opts.ChartVersion = release.Version
|
||||
|
||||
dir := filepath.Join(st.basePath, release.Chart)
|
||||
if stat, _ := os.Stat(dir); stat != nil && stat.IsDir() {
|
||||
if exists, err := st.fileExists(filepath.Join(dir, "Chart.yaml")); err == nil && !exists {
|
||||
shouldRun = true
|
||||
}
|
||||
}
|
||||
|
||||
for _, d := range release.Dependencies {
|
||||
var dep string
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
repositories:
|
||||
- name: incubator
|
||||
url: https://kubernetes-charts-incubator.storage.googleapis.com
|
||||
|
||||
releases:
|
||||
- name: kustomapp
|
||||
chart: ./kustomapp
|
||||
values:
|
||||
- namePrefix: kustomapp-
|
||||
- name: raw1
|
||||
chart: incubator/raw
|
||||
values:
|
||||
- resources:
|
||||
- apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: raw1
|
||||
namespace: default
|
||||
data:
|
||||
foo: FOO
|
||||
strategicMergePatches:
|
||||
- apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: raw1
|
||||
namespace: default
|
||||
data:
|
||||
bar: BAR
|
||||
- name: raw2
|
||||
chart: incubator/raw
|
||||
values:
|
||||
- resources:
|
||||
- apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: raw2
|
||||
namespace: default
|
||||
data:
|
||||
foo: FOO
|
||||
jsonPatches:
|
||||
- target:
|
||||
version: v1
|
||||
kind: ConfigMap
|
||||
name: raw2
|
||||
namespace: default
|
||||
patch:
|
||||
- op: replace
|
||||
path: /data/baz
|
||||
value: "BAZ"
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: kustomapp
|
||||
namespace: default
|
||||
data:
|
||||
kustomappfoo: FOO
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
resources:
|
||||
- all.yaml
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: kustomapp2
|
||||
namespace: default
|
||||
data:
|
||||
kustomappfoo: FOO
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
resources:
|
||||
- all.yaml
|
||||
Loading…
Reference in New Issue