support sharedSecretFiles with other volumes#16
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the common chart version to 0.10.0 across several charts and includes minor formatting improvements in the volume mounts template and test files. I have identified a potential issue in the _volumeMountsRef.yaml template where an empty volumeMounts: key could be generated if sharedSecretFiles contains entries with empty file lists; I recommend adding a validation check to prevent this.
| {{- range .Values.sharedSecretFiles }} | ||
| {{- $secretName := .name }} | ||
| {{- range .files }} | ||
| - name: {{ $secretName }} | ||
| mountPath: {{ .mountPath }} | ||
| {{- if .subPath}} | ||
| subPath: {{ .subPath }} | ||
| {{- end }} | ||
| readOnly: true | ||
| {{- end }} | ||
| {{- $secretName := .name }} | ||
| {{- range .files }} | ||
| - name: {{ $secretName }} | ||
| mountPath: {{ .mountPath }} | ||
| {{- if .subPath }} | ||
| subPath: {{ .subPath }} | ||
| {{- end }} | ||
| readOnly: true | ||
| {{- end }} | ||
| {{- end }} |
There was a problem hiding this comment.
The current logic for sharedSecretFiles may produce an invalid volumeMounts: key with no items if sharedSecretFiles is provided as a list containing entries with empty files lists (e.g., sharedSecretFiles: [{name: "foo", files: []}]). This happens because the outer if at line 2 evaluates to true, printing volumeMounts:, but the inner range at line 39 produces no output. Consider adding a check to ensure at least one file is present before printing the volumeMounts: header, or ensure that the schema validation prevents empty files lists.
Update volumeMounts logic to allow sharedSecretFiles to be used together with other volume configurations.