fix(template): Don't print empty lists

This commit is contained in:
2024-09-04 14:15:53 +02:00
parent b8a623257b
commit 7097564a72
2 changed files with 12 additions and 4 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ apiVersion: v2
name: template name: template
description: A Helm library chart containing common templates, keeping application templates short description: A Helm library chart containing common templates, keeping application templates short
type: library type: library
version: 0.5.0 version: 0.5.1
maintainers: maintainers:
- name: Jim Martens - name: Jim Martens
url: https://2martens.de url: https://2martens.de
@@ -10,8 +10,8 @@ sources:
- https://github.com/2martens/cloud-configuration - https://github.com/2martens/cloud-configuration
annotations: annotations:
artifacthub.io/changes: | artifacthub.io/changes: |
- kind: added - kind: fixed
description: Add ability to configure volumes/volume mounts description: Only print volumes and volumeMounts if they are filled
artifacthub.io/signKey: | artifacthub.io/signKey: |
fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8 fingerprint: F0F153B65BAD467201D7544E47393ABD1F96B7C8
url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc url: https://mafiasi.de/pks/key/47393ABD1F96B7C8.asc
+9 -1
View File
@@ -58,12 +58,16 @@ spec:
- name: {{ .name }} - name: {{ .name }}
value: {{ tpl (quote .value) $ }} value: {{ tpl (quote .value) $ }}
{{- end }} {{- end }}
{{- if or .Values.application.isSpring .Values.volumeMounts }}
volumeMounts: volumeMounts:
{{- if .Values.application.isSpring }} {{- if .Values.application.isSpring }}
- mountPath: /tmp - mountPath: /tmp
name: tmp name: tmp
{{- end }} {{- end }}
{{- toYaml .Values.volumeMounts | nindent 12 }} {{- if .Values.volumeMounts }}
{{- toYaml .Values.volumeMounts | nindent 12 }}
{{- end }}
{{- end }}
ports: ports:
- name: http - name: http
containerPort: {{ .Values.application.port }} containerPort: {{ .Values.application.port }}
@@ -117,13 +121,17 @@ spec:
tolerations: tolerations:
{{- toYaml . | nindent 8 }} {{- toYaml . | nindent 8 }}
{{- end }} {{- end }}
{{- if or .Values.application.isSpring .Values.volumes }}
volumes: volumes:
{{- if .Values.application.isSpring }} {{- if .Values.application.isSpring }}
- name: tmp - name: tmp
emptyDir: emptyDir:
medium: Memory medium: Memory
{{- end }} {{- end }}
{{- if .Values.volumes }}
{{- toYaml .Values.volumes | nindent 8 }} {{- toYaml .Values.volumes | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.podSpec }} {{- with .Values.podSpec }}
{{- toYaml . | nindent 6 }} {{- toYaml . | nindent 6 }}
{{- end }} {{- end }}