fix(libvirt): render hook scripts with the chart context (#4483)
Signed-off-by: Mohammed Naser <mnaser@vexxhost.com>
This commit is contained in:
1 parent
cc35ea16bb
commit
9b15a8610f
4 files changed
+38
-3
No files matched your search
@@ -41,7 +41,7 @@ data:
|
||||
{{- if .Values.conf.hooks.enabled }}
|
||||
{{- range $k, $v := .Values.conf.hooks.scripts }}
|
||||
{{ $k }}: |
|
||||
{{ tpl $v . | indent 4 }}
|
||||
{{ tpl $v $envAll | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From: Mohammed Naser <mnaser@vexxhost.com>
|
||||
Subject: [PATCH] [libvirt] Render hook scripts with the chart context
|
||||
|
||||
The hook scripts were rendered with "tpl $v .", where "." is the script
|
||||
string inside the range loop. Helm 3 requires the second argument of
|
||||
tpl to be the chart values and fails with:
|
||||
|
||||
wrong type for value; expected chartutil.Values; got string
|
||||
|
||||
Pass $envAll instead. Scripts can now reference .Values and .Release.
|
||||
|
||||
Drop this patch once the chart is bumped to a release that includes
|
||||
the fix.
|
||||
---
|
||||
diff --git a/libvirt/templates/configmap-bin.yaml b/libvirt/templates/configmap-bin.yaml
|
||||
index 0ff74c9..bf0ab50 100644
|
||||
--- a/libvirt/templates/configmap-bin.yaml
|
||||
+++ b/libvirt/templates/configmap-bin.yaml
|
||||
@@ -41,7 +41,7 @@ data:
|
||||
{{- if .Values.conf.hooks.enabled }}
|
||||
{{- range $k, $v := .Values.conf.hooks.scripts }}
|
||||
{{ $k }}: |
|
||||
-{{ tpl $v . | indent 4 }}
|
||||
+{{ tpl $v $envAll | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -81,8 +81,9 @@ begins on the destination host, so the guest arrives with only the DAC label:
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
The chart renders each script as a Helm template, so escape any literal
|
||||
``{{`` sequences in your scripts.
|
||||
The chart renders each script as a Helm template with the chart context, so
|
||||
scripts can reference values such as ``{{ .Release.Namespace }}``. Escape any
|
||||
literal ``{{`` sequences in your scripts.
|
||||
|
||||
.. note::
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Enabling libvirt hook scripts through ``conf.hooks`` no longer fails to
|
||||
render with ``wrong type for value; expected chartutil.Values; got
|
||||
string`` on Helm 3. The scripts are now rendered with the chart context,
|
||||
so they can also reference values such as ``.Release.Namespace``.
|
||||
Reference in new issue
Block a user