What broke? What's expected?
The webhook-certs volume mount in dist/chart/templates/manager/manager.yaml is indented at the wrong level, causing a YAML parse error when rendering the chart with helm template.
Reproducing this issue
- Run
helm template ./dist/chart/ on a project scaffolded with the helm/v2-alpha plugin
- Ensure
certManager.enable: true and manager.extraVolumeMounts is non-empty in values.yaml
This can be reproduced on the tesdata in testdata/project-v4-with-plugins. Simply apply the following diff and then run the helm template command.
diff --git a/testdata/project-v4-with-plugins/dist/chart/values.yaml b/testdata/project-v4-with-plugins/dist/chart/values.yaml
index dfc37f14f..8ac60d328 100644
--- a/testdata/project-v4-with-plugins/dist/chart/values.yaml
+++ b/testdata/project-v4-with-plugins/dist/chart/values.yaml
@@ -33,6 +33,16 @@ manager:
fieldRef:
fieldPath: metadata.namespace
+ extraVolumes:
+ - name: foo
+ configMap:
+ name: bar
+ extraVolumeMounts:
+ - name: foo
+ mountPath: /var/run/foo
+ subPath: baz
+ readOnly: true
+
## Env overrides (--set manager.envOverrides.VAR=value)
## Same name in env above: this value takes precedence.
##
Expected Behavior
The chart renders without errors.
Actual Behavior
Error: YAML parse error on <project>/templates/manager/manager.yaml:
error converting YAML to JSON: yaml: line 82: did not find expected key
Root Cause
In templates/manager/manager.yaml, the conditional block that adds the webhook-certs volume mount is indented at the same level as the volumeMounts: key rather than nested under it as a list item:
volumeMounts:
{{- if .Values.manager.extraVolumeMounts }}
{{- toYaml .Values.manager.extraVolumeMounts | nindent 10 }}
{{- end }}
{{- if .Values.certManager.enable }} # <-- wrong: 8-space indent
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-certs
readOnly: true
{{- end }}
The {{- if }} block and its content should be indented to 10 spaces so the - mountPath entry is a valid item under volumeMounts::
volumeMounts:
{{- if .Values.manager.extraVolumeMounts }}
{{- toYaml .Values.manager.extraVolumeMounts | nindent 10 }}
{{- end }}
{{- if .Values.certManager.enable }} # <-- correct: 10-space indent
- mountPath: /tmp/k8s-webhook-server/serving-certs
name: webhook-certs
readOnly: true
{{- end }}
Affected Version
Introduced in 62e49e5 (feat(helm/v2-alpha): add extra volumes support).
KubeBuilder (CLI) Version
v4.14.0
PROJECT version
No response
Plugin versions
Other versions
No response
Extra Labels
/kind regression
What broke? What's expected?
The webhook-certs volume mount in
dist/chart/templates/manager/manager.yamlis indented at the wrong level, causing a YAML parse error when rendering the chart withhelm template.Reproducing this issue
helm template ./dist/chart/on a project scaffolded with thehelm/v2-alphaplugincertManager.enable: trueandmanager.extraVolumeMountsis non-empty invalues.yamlThis can be reproduced on the tesdata in
testdata/project-v4-with-plugins. Simply apply the following diff and then run thehelm templatecommand.Expected Behavior
The chart renders without errors.
Actual Behavior
Root Cause
In
templates/manager/manager.yaml, the conditional block that adds the webhook-certs volume mount is indented at the same level as thevolumeMounts:key rather than nested under it as a list item:The
{{- if }}block and its content should be indented to 10 spaces so the- mountPathentry is a valid item undervolumeMounts::Affected Version
Introduced in 62e49e5 (
feat(helm/v2-alpha): add extra volumes support).KubeBuilder (CLI) Version
v4.14.0
PROJECT version
No response
Plugin versions
Other versions
No response
Extra Labels
/kind regression