Add pvc support for the volumes specified in the upstream dockerfile(db,
log, sessions, txlog).
Showing
4 changed files
with
107 additions
and
0 deletions
... | @@ -122,3 +122,56 @@ entity_ds_password | ... | @@ -122,3 +122,56 @@ entity_ds_password |
122 | {{- end -}} | 122 | {{- end -}} |
123 | {{- end }} | 123 | {{- end }} |
124 | 124 | ||
125 | {{- define "moqui.storage-volumeClaimTemplate" }} | ||
126 | {{- $ := index . 0 }} | ||
127 | {{- $name := index . 1 }} | ||
128 | {{- $persistence := index $.Values.persistence $name }} | ||
129 | {{- if and ($persistence.enabled) (eq "StatefulSet" $.Values.kind) -}} | ||
130 | - metadata: | ||
131 | name: storage-{{ $name }} | ||
132 | spec: | ||
133 | storageClassName: {{ $persistence.storageClassName }} | ||
134 | accessModes: {{ $persistence.accessModes | toYaml | nindent 6 }} | ||
135 | resources: {{ $persistence.resources | toYaml | nindent 6 }} | ||
136 | {{- end }} | ||
137 | {{- end }} | ||
138 | |||
139 | {{- define "moqui.storage-pvc" }} | ||
140 | {{- $ := index . 0 }} | ||
141 | {{- $name := index . 1 }} | ||
142 | {{- $persistence := index $.Values.persistence $name }} | ||
143 | {{- if and ($persistence.enabled) (ne "StatefulSet" $.Values.kind) -}} | ||
144 | apiVersion: v1 | ||
145 | kind: PersistentVolumeClaim | ||
146 | metadata: | ||
147 | name: {{ include "moqui.fullname" $ }}-{{ $name }} | ||
148 | spec: | ||
149 | storageClassName: {{ $persistence.storageClassName }} | ||
150 | accessModes: {{ $persistence.accessModes | toYaml | nindent 6 }} | ||
151 | resources: {{ $persistence.resources | toYaml | nindent 6 }} | ||
152 | --- | ||
153 | {{- end }} | ||
154 | {{- end }} | ||
155 | |||
156 | {{- define "moqui.storage-pvc-volume" }} | ||
157 | {{- $ := index . 0 }} | ||
158 | {{- $name := index . 1 }} | ||
159 | {{- $persistence := index $.Values.persistence $name }} | ||
160 | {{- if and ($persistence.enabled) (ne "StatefulSet" $.Values.kind) -}} | ||
161 | - name: storage-{{ $name }} | ||
162 | persistentVolumeClaim: | ||
163 | claimName: {{ include "moqui.fullname" $ }}-{{ $name }} | ||
164 | {{- end }} | ||
165 | {{- end }} | ||
166 | |||
167 | {{- define "moqui.storage-mount" }} | ||
168 | {{- $ := index . 0 }} | ||
169 | {{- $name := index . 1 }} | ||
170 | {{- $mountPath := index . 2 }} | ||
171 | {{- $persistence := index $.Values.persistence $name }} | ||
172 | {{- if $persistence.enabled -}} | ||
173 | - mountPath: {{ $mountPath }} | ||
174 | name: storage-{{ $name }} | ||
175 | {{- end }} | ||
176 | {{- end }} | ||
177 | ... | ... |
... | @@ -14,6 +14,13 @@ spec: | ... | @@ -14,6 +14,13 @@ spec: |
14 | selector: | 14 | selector: |
15 | matchLabels: | 15 | matchLabels: |
16 | {{- include "moqui.selectorLabels" . | nindent 6 }} | 16 | {{- include "moqui.selectorLabels" . | nindent 6 }} |
17 | {{- if (eq "StatefulSet" .Values.kind) }} | ||
18 | volumeClaimTemplates: | ||
19 | {{- include "moqui.storage-volumeClaimTemplate" (list . "db") | nindent 4 }} | ||
20 | {{- include "moqui.storage-volumeClaimTemplate" (list . "log") | nindent 4 }} | ||
21 | {{- include "moqui.storage-volumeClaimTemplate" (list . "sessions") | nindent 4 }} | ||
22 | {{- include "moqui.storage-volumeClaimTemplate" (list . "txlog") | nindent 4 }} | ||
23 | {{- end }} | ||
17 | template: | 24 | template: |
18 | metadata: | 25 | metadata: |
19 | {{- with .Values.podAnnotations }} | 26 | {{- with .Values.podAnnotations }} |
... | @@ -35,6 +42,10 @@ spec: | ... | @@ -35,6 +42,10 @@ spec: |
35 | emptyDir: {} | 42 | emptyDir: {} |
36 | - name: disable-elasticsearch | 43 | - name: disable-elasticsearch |
37 | emptyDir: {} | 44 | emptyDir: {} |
45 | {{- include "moqui.storage-pvc-volume" (list . "db") | nindent 8 }} | ||
46 | {{- include "moqui.storage-pvc-volume" (list . "log") | nindent 8 }} | ||
47 | {{- include "moqui.storage-pvc-volume" (list . "sessions") | nindent 8 }} | ||
48 | {{- include "moqui.storage-pvc-volume" (list . "txlog") | nindent 8 }} | ||
38 | initContainers: | 49 | initContainers: |
39 | {{- if (eq .Values.configMap.entity_ds_db_conf "postgres") }} | 50 | {{- if (eq .Values.configMap.entity_ds_db_conf "postgres") }} |
40 | {{- if .Values.postgresql.jdbcImage.enabled }} | 51 | {{- if .Values.postgresql.jdbcImage.enabled }} |
... | @@ -104,6 +115,10 @@ spec: | ... | @@ -104,6 +115,10 @@ spec: |
104 | name: runtime-lib | 115 | name: runtime-lib |
105 | - mountPath: /opt/moqui/runtime/elasticsearch | 116 | - mountPath: /opt/moqui/runtime/elasticsearch |
106 | name: disable-elasticsearch | 117 | name: disable-elasticsearch |
118 | {{- include "moqui.storage-mount" (list . "db" "/opt/moqui/runtime/db") | nindent 12 }} | ||
119 | {{- include "moqui.storage-mount" (list . "log" "/opt/moqui/runtime/log") | nindent 12 }} | ||
120 | {{- include "moqui.storage-mount" (list . "sessions" "/opt/moqui/runtime/sessions") | nindent 12 }} | ||
121 | {{- include "moqui.storage-mount" (list . "txlog" "/opt/moqui/runtime/txlog") | nindent 12 }} | ||
107 | {{- end }} | 122 | {{- end }} |
108 | 123 | ||
109 | - name: load | 124 | - name: load | ... | ... |
charts/moqui/templates/pvc.yaml
0 → 100644
... | @@ -15,6 +15,40 @@ configMap: | ... | @@ -15,6 +15,40 @@ configMap: |
15 | entity_ds_user: "moqui" | 15 | entity_ds_user: "moqui" |
16 | elasticsearch_user: "admin" | 16 | elasticsearch_user: "admin" |
17 | 17 | ||
18 | persistence: | ||
19 | db: | ||
20 | enabled: true | ||
21 | accessModes: | ||
22 | - ReadWriteOnce | ||
23 | resources: | ||
24 | requests: | ||
25 | storage: 8Gi | ||
26 | annotations: {} | ||
27 | log: | ||
28 | enabled: true | ||
29 | accessModes: | ||
30 | - ReadWriteOnce | ||
31 | resources: | ||
32 | requests: | ||
33 | storage: 8Gi | ||
34 | annotations: {} | ||
35 | sessions: | ||
36 | enabled: true | ||
37 | accessModes: | ||
38 | - ReadWriteOnce | ||
39 | resources: | ||
40 | requests: | ||
41 | storage: 8Gi | ||
42 | annotations: {} | ||
43 | txlog: | ||
44 | enabled: true | ||
45 | accessModes: | ||
46 | - ReadWriteOnce | ||
47 | resources: | ||
48 | requests: | ||
49 | storage: 8Gi | ||
50 | annotations: {} | ||
51 | |||
18 | secret: | 52 | secret: |
19 | entity_ds_password: "iuqom" | 53 | entity_ds_password: "iuqom" |
20 | 54 | ... | ... |
-
Please register or sign in to post a comment