Add persistence

This commit is contained in:
paul 2021-01-13 07:38:54 +01:00
parent 550a71b599
commit cf233cacad
4 changed files with 31 additions and 2 deletions

View file

@ -76,7 +76,7 @@ spec:
- name: localstore-volume
{{- if .Values.persistence.enabled }}
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim | default (include "mediawiki.fullname" .) }}
claimName: {{ default (include "mediawiki.fullname" .) .Values.persistence.existingClaim }}
{{- else }}
emptyDir: {}
{{- end }}

View file

@ -2,7 +2,7 @@
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "mediawiki.fullname" . }}
name: {{ include "mediawiki.fullname" . }}-setup
labels:
{{- include "mediawiki.labels" . | nindent 4 }}
spec:

View file

@ -0,0 +1,22 @@
{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ include "mediawiki.fullname" . }}
labels:
{{- include "mediawiki.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": "pre-install"
{{- if .Values.persistence.annotations }}
{{ toYaml .Values.persistence.annotations | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClass }}
storageClassName: {{ .Values.persistence.storageClass | quote }}
{{- end }}
{{- end }}

View file

@ -17,6 +17,13 @@ wiki:
server: "https://wiki.example.org"
secretKey: "1166f2af9b8c1e1401f38a11d95628629bef0b75b90d09b296390041d19c3b2c"
persistence:
enabled: false
accessMode: ReadWriteOnce
size: 5Gi
storageClass: ""
annotations: {}
database:
type: postgres
server: postgres.example.org