mirror of
https://github.com/helmfile/helmfile.git
synced 2026-09-30 07:20:52 +02:00
Feature/support env hcl and interpolations (#1423)
* support HCL language for env variables Signed-off-by: xtphate <65117176+XT-Phate@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
helmfileArgs:
|
||||
- template
|
||||
- --concurrency=1
|
||||
- -q
|
||||
@@ -0,0 +1,38 @@
|
||||
environments:
|
||||
default:
|
||||
values:
|
||||
- values1.hcl
|
||||
- values1.yaml
|
||||
- values2.hcl
|
||||
---
|
||||
|
||||
helmDefaults:
|
||||
kubeContext: minikube
|
||||
|
||||
releases:
|
||||
|
||||
- name: hcl-demo
|
||||
chart: ../../charts/raw-0.1.0
|
||||
values:
|
||||
- templates:
|
||||
- |
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: configmap
|
||||
data:
|
||||
a: {{ .Values.a }}
|
||||
b: {{ .Values.b }}
|
||||
c: {{ .Values.c }}
|
||||
crossfile: {{ .Values.crossfile }}
|
||||
expressionInText: "{{ .Values.expressionInText }}"
|
||||
fromMap: {{ .Values.fromMap }}
|
||||
insideFor: {{ .Values.insideFor }}
|
||||
list: "{{ .Values.list }}"
|
||||
{{- .Values.locals | toYaml | nindent 10 -}}
|
||||
multiBlock: {{ .Values.multiBlock }}
|
||||
simpleCompute: "{{ .Values.simpleCompute }}"
|
||||
yamlOverride: {{ .Values.yamlOverride }}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
# Source: raw/templates/resources.yaml
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: configmap
|
||||
data:
|
||||
a: a
|
||||
b: b
|
||||
c: ab
|
||||
crossfile: values2.hcl
|
||||
expressionInText: "yes"
|
||||
fromMap: ab
|
||||
insideFor: b
|
||||
list: "[b]"
|
||||
filename: values1.hcl
|
||||
multiBlock: block
|
||||
simpleCompute: "4"
|
||||
yamlOverride: yaml_overrode
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
locals {
|
||||
filename = "values1.hcl"
|
||||
}
|
||||
|
||||
values {
|
||||
a = "a"
|
||||
b = "b"
|
||||
c = "${hv.a}${hv.b}"
|
||||
|
||||
list = [
|
||||
hv.b
|
||||
]
|
||||
|
||||
locals = local
|
||||
|
||||
// Maps and some functions
|
||||
nestedmap = {
|
||||
submap = {
|
||||
subsubmap = {
|
||||
hello = hv.a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nestedmap2 = {
|
||||
submap = {
|
||||
subsubmap = {
|
||||
hello = hv.c
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
merged = merge(hv.nestedmap, hv.nestedmap2)
|
||||
fromMap = "${hv.merged.submap.subsubmap.hello}"
|
||||
|
||||
// precedence demo
|
||||
yamlOverride = "yaml_overrode"
|
||||
|
||||
|
||||
// Simple Expressions
|
||||
ternary = true ? true : false
|
||||
expressionInText = "%{if hv.ternary }yes%{else}no%{endif}"
|
||||
insideFor = "%{for i in hv.list }${i}%{endfor}"
|
||||
simpleCompute = 2 + 2
|
||||
|
||||
multiBlock = hv.block
|
||||
|
||||
crossfile = hv.crossfile_var
|
||||
}
|
||||
|
||||
values {
|
||||
block = "block"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
yamlOverride: "will_be_overriden"
|
||||
@@ -0,0 +1,7 @@
|
||||
locals {
|
||||
filename = "values2.hcl"
|
||||
}
|
||||
|
||||
values {
|
||||
crossfile_var = local.filename
|
||||
}
|
||||
Reference in New Issue
Block a user