diff --git a/charts/generic/Chart.yaml b/charts/generic/Chart.yaml index 2fd87fc..9e7a079 100644 --- a/charts/generic/Chart.yaml +++ b/charts/generic/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v2 name: generic description: A generic helm chart that handles a bunch of common application deploy cases type: application -version: 1.7.0 +version: 1.8.0 diff --git a/charts/generic/templates/configmap-files.yaml b/charts/generic/templates/configmap-files.yaml new file mode 100644 index 0000000..008c0a9 --- /dev/null +++ b/charts/generic/templates/configmap-files.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: "{{ .Release.Name }}-files" + labels: + {{- include "generic.labels" . | nindent 4 }} +data: + {{- range $.Values.configmapFiles }} + {{ .filename }}: | + {{- .content | nindent 4 }} + {{- end }} diff --git a/charts/generic/templates/deployment.yaml b/charts/generic/templates/deployment.yaml index 590e8ad..e1cb176 100644 --- a/charts/generic/templates/deployment.yaml +++ b/charts/generic/templates/deployment.yaml @@ -95,6 +95,11 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- range $.Values.configmapFiles }} + - name: configmap-files + mountPath: {{ .mountPath }}/{{ .filename }} + subPath: {{ .filename }} + {{- end }} {{- end }} {{- end }} containers: @@ -165,6 +170,11 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- range $.Values.configmapFiles }} + - name: configmap-files + mountPath: {{ .mountPath }}/{{ .filename }} + subPath: {{ .filename }} + {{- end }} {{- with .Values.deployment.livenessProbe }} livenessProbe: {{- toYaml . | nindent 12 }} @@ -231,6 +241,11 @@ spec: - name: {{ .name }} mountPath: {{ .mountPath }} {{- end }} + {{- range $.Values.configmapFiles }} + - name: configmap-files + mountPath: {{ .mountPath }}/{{ .filename }} + subPath: {{ .filename }} + {{- end }} {{- end }} volumes: {{- range .Values.sharedEmptyDirs }} @@ -243,6 +258,14 @@ spec: - name: configmap-file configMap: name: "{{ .Release.Name }}-file" + - name: configmap-files + configMap: + name: "{{ .Release.Name }}-files" + {{- range $.Values.configmapFiles }} + items: + - key: {{ .filename }} + path: {{ .filename }} + {{- end }} {{- range .Values.volumes }} - name: {{ .name }} persistentVolumeClaim: diff --git a/charts/generic/values.yaml b/charts/generic/values.yaml index 455676a..6645f9d 100644 --- a/charts/generic/values.yaml +++ b/charts/generic/values.yaml @@ -174,6 +174,17 @@ configmapFile: values: {} # filename: "file content" +# This is the newer alternative to configmapFile that mounts each file in the secret as a single file +# rather than overtaking the whole mountPath directory and deleting any files that may have existed there prior +# This also allows the flexibility of mounting many files to different mountpaths, since the mountpath is controlled +# per file +configmapFiles: [] +# - mountPath: /etc/config +# filename: .env +# content: | +# file=content +# goes=here + volumes: [] # - name: example-volume # mountPath: /my-example-volume