Skip to content

Commit b4fbf4e

Browse files
authored
fix(helm): indent of extra volumes (#614)
Issue [#2583](aws-controllers-k8s/community#2583) Description of changes: This PR addresses an issue encountered when rendering a Helm chart that includes additional volumes, such as an emptyDir. The change ensures with `-` that leading whitespace is trimmed and using `nindent` instead of `indent` prevents unwanted blank lines. The issue originates from the following pull request #608. To manually validate the fix of this PR in a chart based on the code-generator follow the steps below: ``` # Pull and extract the ACM chart, which is based on the code-generator: $ helm pull oci://public.ecr.aws/aws-controllers-k8s/acm-chart --version 1.0.14 && tar -xzf acm-chart-1.0.14.tgz # Apply the fix from this PR to the chart $ sed -i '208s|.*| {{- toYaml .Values.deployment.extraVolumes \| nindent 8 }}|' ./acm-chart/templates/deployment.yaml # Render the chart and verify the output: $ helm template ./acm-chart --set deployment.extraVolumes[0].name=test --set deployment.extraVolumes[0].emptyDir.sizeLimit=1Mi # Expected output snippet: ... hostPID: false hostNetwork: false dnsPolicy: ClusterFirst volumes: - emptyDir: sizeLimit: 1Mi name: test ``` To reproduce the issue with the current version, refer to the steps outlined in the mentioned issue at top. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent fc0b91c commit b4fbf4e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

templates/helm/templates/deployment.yaml.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ spec:
205205
secretName: {{ "{{ .Values.aws.credentials.secretName }}" }}
206206
{{ "{{- end }}" }}
207207
{{ "{{- if .Values.deployment.extraVolumes }}" }}
208-
{{ "{{ toYaml .Values.deployment.extraVolumes | indent 8 }}" }}
208+
{{ "{{- toYaml .Values.deployment.extraVolumes | nindent 8 }}" }}
209209
{{ "{{- end }}" }}
210210
{{ "{{- end }}" }}
211211
{{ " {{- with .Values.deployment.strategy }}" }}

0 commit comments

Comments
 (0)