fix: inject global values in Chartify (#1805)
* fix: inject global values in Chartify Signed-off-by: Thomas Loubiou <thomas.loubiou@mirakl.com> * test: add integration tests for template --values Signed-off-by: Thomas Loubiou <thomas.loubiou@mirakl.com> --------- Signed-off-by: Thomas Loubiou <thomas.loubiou@mirakl.com>
This commit is contained in:
parent
c9173b3e52
commit
8891439cdc
|
|
@ -250,6 +250,7 @@ func (a *App) Template(c TemplateConfigProvider) error {
|
|||
Concurrency: c.Concurrency(),
|
||||
IncludeTransitiveNeeds: c.IncludeNeeds(),
|
||||
Set: c.Set(),
|
||||
Values: c.Values(),
|
||||
KubeVersion: c.KubeVersion(),
|
||||
}, func() {
|
||||
ok, errs = a.template(run, c)
|
||||
|
|
|
|||
|
|
@ -1127,6 +1127,7 @@ type ChartPrepareOptions struct {
|
|||
Concurrency int
|
||||
KubeVersion string
|
||||
Set []string
|
||||
Values []string
|
||||
// Delete wait
|
||||
DeleteWait bool
|
||||
DeleteTimeout int
|
||||
|
|
@ -1294,6 +1295,10 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
|
|||
chartifyOpts.KubeVersion = st.getKubeVersion(release, opts.KubeVersion)
|
||||
chartifyOpts.ApiVersions = st.getApiVersions(release)
|
||||
|
||||
if opts.Values != nil {
|
||||
chartifyOpts.ValuesFiles = append(opts.Values, chartifyOpts.ValuesFiles...)
|
||||
}
|
||||
|
||||
// https://github.com/helmfile/helmfile/pull/867
|
||||
// https://github.com/helmfile/helmfile/issues/895
|
||||
var flags []string
|
||||
|
|
|
|||
|
|
@ -12,16 +12,18 @@ fi
|
|||
chartify_tmp=$(mktemp -d)
|
||||
chartify_template_reverse=${chartify_tmp}/chartify.template.log
|
||||
|
||||
|
||||
test_start "helmfile template with chartify"
|
||||
|
||||
info "Comparing template/chartify"
|
||||
${helmfile} -f ${chartify_case_input_dir}/${config_file} template > ${chartify_template_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
${helmfile} -f ${chartify_case_input_dir}/${config_file} template >${chartify_template_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
./dyff between -bs ${chartify_case_output_dir}/template ${chartify_template_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
|
||||
info "Comparing template/chartify with set"
|
||||
${helmfile} -f ${chartify_case_input_dir}/${config_file} template --set image.tag=v2 > ${chartify_template_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
${helmfile} -f ${chartify_case_input_dir}/${config_file} template --set image.tag=v2 >${chartify_template_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
./dyff between -bs ${chartify_case_output_dir}/template-set ${chartify_template_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
|
||||
info "Comparing template/chartify with values"
|
||||
${helmfile} -f ${chartify_case_input_dir}/${config_file} template --values "./extra-values.yaml" >${chartify_template_reverse} || fail "\"helmfile template\" shouldn't fail"
|
||||
./dyff between -bs ${chartify_case_output_dir}/template-values ${chartify_template_reverse} || fail "\"helmfile template\" should be consistent"
|
||||
|
||||
test_pass "helmfile template with chartify"
|
||||
test_pass "helmfile template with chartify"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
---
|
||||
image:
|
||||
tag: v3
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
# Source: httpbin/templates/patched_resources.yaml
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: httpbin
|
||||
chart: httpbin-0.1.0
|
||||
heritage: Helm
|
||||
release: httpbin
|
||||
name: httpbin-httpbin
|
||||
spec:
|
||||
ports:
|
||||
- name: httpbin
|
||||
port: 8000
|
||||
protocol: TCP
|
||||
targetPort: 8000
|
||||
selector:
|
||||
app: httpbin
|
||||
release: httpbin
|
||||
type: LoadBalancer
|
||||
---
|
||||
# Source: httpbin/templates/patched_resources.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
labels:
|
||||
app: httpbin
|
||||
chart: httpbin-0.1.0
|
||||
heritage: Helm
|
||||
release: httpbin
|
||||
name: httpbin-httpbin
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: httpbin
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: httpbin
|
||||
release: httpbin
|
||||
spec:
|
||||
containers:
|
||||
- image: docker.io/citizenstig/httpbin:v3
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8000
|
||||
name: httpbin
|
||||
ports:
|
||||
- containerPort: 8000
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 8000
|
||||
resources: {}
|
||||
status: {}
|
||||
Loading…
Reference in New Issue