Skip to content

Commit ce67c98

Browse files
authored
Support emptyDir mounts for webservices (#318)
1 parent 45cc3df commit ce67c98

File tree

4 files changed

+26
-5
lines changed

4 files changed

+26
-5
lines changed

charts/webservice/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: webservice
33
description: OSC webservice bootstrap Helm Chart
44
type: application
5-
version: 0.37.1
5+
version: 0.38.0
66
appVersion: "0.1.0"
77
maintainers:
88
- name: treydock

charts/webservice/ci/test-values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ podResources:
4545
data:
4646
enable: true
4747
size: 50Mi
48+
mounts:
49+
emptyDir:
50+
test: /tmp/test
51+
foo: /tmp/bar
4852
database:
4953
mariadb:
5054
enable: true

charts/webservice/templates/deployment.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,16 @@ spec:
9292
ports:
9393
- containerPort: {{ $container.port | default (add $root.Values.service.port $idx) }}
9494
name: {{ $container.portName | default (tpl $container.name $root) }}
95-
{{- if or $root.Values.data.enable $root.Values.mounts.data $root.Values.mounts.home $root.Values.mounts.roDir $root.Values.mounts.rwDir $root.Values.mounts.socket $root.Values.mounts.roFile }}
95+
{{- if or $root.Values.data.enable $root.Values.mounts.emptyDir $root.Values.mounts.data $root.Values.mounts.home $root.Values.mounts.roDir $root.Values.mounts.rwDir $root.Values.mounts.socket $root.Values.mounts.roFile }}
9696
volumeMounts:
9797
{{- if $root.Values.data.enable }}
9898
- name: data
9999
mountPath: {{ $root.Values.data.path }}
100100
{{- end }}
101+
{{- range $name, $path := $root.Values.mounts.emptyDir }}
102+
- name: {{ $name }}
103+
mountPath: {{ tpl $path $root }}
104+
{{- end }}
101105
{{- if $root.Values.mounts.data }}
102106
- name: {{ $root.Values.mounts.data.name }}
103107
mountPath: {{ tpl $root.Values.mounts.data.mountPath $root }}
@@ -207,12 +211,16 @@ spec:
207211
value: {{ tpl $initEnv.value $ | quote }}
208212
{{- end }}
209213
{{- end }}
210-
{{- if or $.Values.data.enable $.Values.mounts.data $.Values.mounts.home $.Values.mounts.roDir $.Values.mounts.rwDir $.Values.mounts.socket $.Values.mounts.roFile }}
214+
{{- if or $.Values.data.enable $.Values.mounts.emptyDir $.Values.mounts.data $.Values.mounts.home $.Values.mounts.roDir $.Values.mounts.rwDir $.Values.mounts.socket $.Values.mounts.roFile }}
211215
volumeMounts:
212216
{{- if $.Values.data.enable }}
213217
- name: data
214218
mountPath: {{ $.Values.data.path }}
215219
{{- end }}
220+
{{- range $name, $path := $.Values.mounts.emptyDir }}
221+
- name: {{ $name }}
222+
mountPath: {{ tpl $path $ }}
223+
{{- end }}
216224
{{- if $.Values.mounts.data }}
217225
- name: data
218226
mountPath: {{ tpl $.Values.mounts.data.mountPath $ }}
@@ -242,7 +250,11 @@ spec:
242250
{{- end }}
243251
{{- end }}
244252
{{- if $init.mounts }}
245-
{{- if or $init.mounts.data $init.mounts.home $init.mounts.roDir $init.mounts.rwDir $init.mounts.socket $init.mounts.roFile }}
253+
{{- if or $init.mounts.emptyDir $init.mounts.data $init.mounts.home $init.mounts.roDir $init.mounts.rwDir $init.mounts.socket $init.mounts.roFile }}
254+
{{- range $name, $path := $init.mounts.emptyDir }}
255+
- name: {{ $name }}
256+
mountPath: {{ tpl $path $ }}
257+
{{- end }}
246258
{{- if $init.mounts.data }}
247259
- name: {{ $init.mounts.data.name }}
248260
mountPath: {{ tpl $init.mounts.data.mountPath $ }}
@@ -288,13 +300,17 @@ spec:
288300
{{- with .Values.nodeSelector }}
289301
{{- toYaml . | nindent 8 }}
290302
{{- end }}
291-
{{- if or .Values.data.enable .Values.mounts.data .Values.mounts.home .Values.mounts.roDir .Values.mounts.rwDir .Values.mounts.socket .Values.mounts.roFile }}
303+
{{- if or .Values.data.enable .Values.mounts.emptyDir .Values.mounts.data .Values.mounts.home .Values.mounts.roDir .Values.mounts.rwDir .Values.mounts.socket .Values.mounts.roFile }}
292304
volumes:
293305
{{- if .Values.data.enable }}
294306
- name: data
295307
persistentVolumeClaim:
296308
claimName: {{ include "webservice.data.name" . }}
297309
{{- end }}
310+
{{- range $name, $path := .Values.mounts.emptyDir }}
311+
- name: {{ $name }}
312+
emptyDir: {}
313+
{{- end }}
298314
{{- if .Values.mounts.data }}
299315
- name: {{ .Values.mounts.data.name }}
300316
hostPath:

charts/webservice/values.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ image:
5757
pullPolicy: IfNotPresent
5858

5959
mounts:
60+
emptyDir: {}
6061
home: ''
6162
roDir: {}
6263
socket: {}

0 commit comments

Comments
 (0)