4fae8b5b by Adam Heath

Add pvc support for the volumes specified in the upstream dockerfile(db,

log, sessions, txlog).
1 parent 34d1d4ac
......@@ -122,3 +122,56 @@ entity_ds_password
{{- end -}}
{{- end }}
{{- define "moqui.storage-volumeClaimTemplate" }}
{{- $ := index . 0 }}
{{- $name := index . 1 }}
{{- $persistence := index $.Values.persistence $name }}
{{- if and ($persistence.enabled) (eq "StatefulSet" $.Values.kind) -}}
- metadata:
name: storage-{{ $name }}
spec:
storageClassName: {{ $persistence.storageClassName }}
accessModes: {{ $persistence.accessModes | toYaml | nindent 6 }}
resources: {{ $persistence.resources | toYaml | nindent 6 }}
{{- end }}
{{- end }}
{{- define "moqui.storage-pvc" }}
{{- $ := index . 0 }}
{{- $name := index . 1 }}
{{- $persistence := index $.Values.persistence $name }}
{{- if and ($persistence.enabled) (ne "StatefulSet" $.Values.kind) -}}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "moqui.fullname" $ }}-{{ $name }}
spec:
storageClassName: {{ $persistence.storageClassName }}
accessModes: {{ $persistence.accessModes | toYaml | nindent 6 }}
resources: {{ $persistence.resources | toYaml | nindent 6 }}
---
{{- end }}
{{- end }}
{{- define "moqui.storage-pvc-volume" }}
{{- $ := index . 0 }}
{{- $name := index . 1 }}
{{- $persistence := index $.Values.persistence $name }}
{{- if and ($persistence.enabled) (ne "StatefulSet" $.Values.kind) -}}
- name: storage-{{ $name }}
persistentVolumeClaim:
claimName: {{ include "moqui.fullname" $ }}-{{ $name }}
{{- end }}
{{- end }}
{{- define "moqui.storage-mount" }}
{{- $ := index . 0 }}
{{- $name := index . 1 }}
{{- $mountPath := index . 2 }}
{{- $persistence := index $.Values.persistence $name }}
{{- if $persistence.enabled -}}
- mountPath: {{ $mountPath }}
name: storage-{{ $name }}
{{- end }}
{{- end }}
......
......@@ -14,6 +14,13 @@ spec:
selector:
matchLabels:
{{- include "moqui.selectorLabels" . | nindent 6 }}
{{- if (eq "StatefulSet" .Values.kind) }}
volumeClaimTemplates:
{{- include "moqui.storage-volumeClaimTemplate" (list . "db") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "log") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "sessions") | nindent 4 }}
{{- include "moqui.storage-volumeClaimTemplate" (list . "txlog") | nindent 4 }}
{{- end }}
template:
metadata:
{{- with .Values.podAnnotations }}
......@@ -35,6 +42,10 @@ spec:
emptyDir: {}
- name: disable-elasticsearch
emptyDir: {}
{{- include "moqui.storage-pvc-volume" (list . "db") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "log") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "sessions") | nindent 8 }}
{{- include "moqui.storage-pvc-volume" (list . "txlog") | nindent 8 }}
initContainers:
{{- if (eq .Values.configMap.entity_ds_db_conf "postgres") }}
{{- if .Values.postgresql.jdbcImage.enabled }}
......@@ -104,6 +115,10 @@ spec:
name: runtime-lib
- mountPath: /opt/moqui/runtime/elasticsearch
name: disable-elasticsearch
{{- include "moqui.storage-mount" (list . "db" "/opt/moqui/runtime/db") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "log" "/opt/moqui/runtime/log") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "sessions" "/opt/moqui/runtime/sessions") | nindent 12 }}
{{- include "moqui.storage-mount" (list . "txlog" "/opt/moqui/runtime/txlog") | nindent 12 }}
{{- end }}
- name: load
......
{{- include "moqui.storage-pvc" (list . "db") }}
{{- include "moqui.storage-pvc" (list . "log") }}
{{- include "moqui.storage-pvc" (list . "sessions") }}
{{- include "moqui.storage-pvc" (list . "txlog") }}
......@@ -15,6 +15,40 @@ configMap:
entity_ds_user: "moqui"
elasticsearch_user: "admin"
persistence:
db:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
annotations: {}
log:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
annotations: {}
sessions:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
annotations: {}
txlog:
enabled: true
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 8Gi
annotations: {}
secret:
entity_ds_password: "iuqom"
......