From 763de171e78cb33c8b684b980880b08aeafecc10 Mon Sep 17 00:00:00 2001 From: Greg Schohn Date: Thu, 31 Oct 2024 00:13:35 -0400 Subject: [PATCH] Simple but useful template that can be used JUST to make values templates. Example syntax: `helm template charts/valueGenerator --set-file "proxy=helmValues/localTesting/captureProxy.yaml" --set-file "source=helmValues/localTesting/sourceElasticsearchCluster.yaml" --set-file "target=helmValues/localTesting/targetOpenSearchCluster.yaml" | grep -v "^---$" | helm install mcc charts/aggregates/mockCustomerClusters -f - --dry-run` Signed-off-by: Greg Schohn --- deployment/k8s/charts/valueGenerator/Chart.yaml | 4 ++++ .../charts/valueGenerator/templates/values.yaml.tpl | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 deployment/k8s/charts/valueGenerator/Chart.yaml create mode 100644 deployment/k8s/charts/valueGenerator/templates/values.yaml.tpl diff --git a/deployment/k8s/charts/valueGenerator/Chart.yaml b/deployment/k8s/charts/valueGenerator/Chart.yaml new file mode 100644 index 0000000000..39b95548fc --- /dev/null +++ b/deployment/k8s/charts/valueGenerator/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v2 +description: "This chart deploys nothing and is only meant to be used to consume fragments of yaml and root them into an aggregated file" +name: valueGenerator +version: 0.1.0 diff --git a/deployment/k8s/charts/valueGenerator/templates/values.yaml.tpl b/deployment/k8s/charts/valueGenerator/templates/values.yaml.tpl new file mode 100644 index 0000000000..ce0d701e14 --- /dev/null +++ b/deployment/k8s/charts/valueGenerator/templates/values.yaml.tpl @@ -0,0 +1,11 @@ +{{- define "values" -}} +{{- range $key, $value := .Values }} +{{ $key }}: +{{- if kindIs "string" $value }} +{{- $value | fromYaml | toYaml | nindent 2 }} +{{- else }} +{{- $value | toYaml | nindent 2 }} +{{- end }} +{{- end }} +{{- end -}} +{{ include "values" . }}