add support for persistence

This commit is contained in:
James 2024-01-23 21:04:23 +00:00
parent efc91e6967
commit e8a940abea
Signed by: thumbscrw
GPG Key ID: 4A3BB8AF7D9C2B46
4 changed files with 101 additions and 15 deletions

View File

@ -65,6 +65,26 @@ spec:
port: http
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- name: static
mountPath: /opt/recipes/staticfiles
- name: media
mountPath: /opt/recipes/mediafiles
volumes:
- name: static
{{- if .Values.persistence.static.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.static.existingClaim }}{{ .Values.persistence.static.existingClaim }}{{- else }}{{ template "tandoor-recipes.fullname" . }}-static-pvc{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
- name: media
{{- if .Values.persistence.media.enabled }}
persistentVolumeClaim:
claimName: {{ if .Values.persistence.media.existingClaim }}{{ .Values.persistence.media.existingClaim }}{{- else }}{{ template "tandoor-recipes.fullname" . }}-media-pvc{{- end }}
{{- else }}
emptyDir: {}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}

View File

@ -0,0 +1,32 @@
{{- if .Values.persistence.media.enabled -}}
{{- if not .Values.persistence.media.existingClaim -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "tandoor-recipes.fullname" . }}-media-pvc
labels:
{{- include "tandoor-recipes.labels" . | nindent 4 }}
# app.kubernetes.io/name: {{ include "tandoor-recipes.name" . }}
# helm.sh/chart: {{ include "tandoor-recipes.chart" . }}
# app.kubernetes.io/instance: {{ .Release.Name }}
# app.kubernetes.io/managed-by: {{ .Release.Service }}
# app.kubernetes.io/component: app
{{- if .Values.persistence.media.annotations }}
annotations:
{{ toYaml .Values.persistence.media.annotations | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.media.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.media.size | quote }}
{{- if .Values.persistence.media.storageClass }}
{{- if (eq "-" .Values.persistence.media.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.media.storageClass }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}

View File

@ -0,0 +1,32 @@
{{- if .Values.persistence.static.enabled -}}
{{- if not .Values.persistence.static.existingClaim -}}
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: {{ template "tandoor-recipes.fullname" . }}-static-pvc
labels:
{{- include "tandoor-recipes.labels" . | nindent 4 }}
# app.kubernetes.io/name: {{ include "tandoor-recipes.name" . }}
# helm.sh/chart: {{ include "tandoor-recipes.chart" . }}
# app.kubernetes.io/instance: {{ .Release.Name }}
# app.kubernetes.io/managed-by: {{ .Release.Service }}
# app.kubernetes.io/component: app
{{- if .Values.persistence.static.annotations }}
annotations:
{{ toYaml .Values.persistence.static.annotations | indent 4 }}
{{- end }}
spec:
accessModes:
- {{ .Values.persistence.static.accessMode | quote }}
resources:
requests:
storage: {{ .Values.persistence.static.size | quote }}
{{- if .Values.persistence.static.storageClass }}
{{- if (eq "-" .Values.persistence.static.storageClass) }}
storageClassName: ""
{{- else }}
storageClassName: "{{ .Values.persistence.static.storageClass }}"
{{- end }}
{{- end }}
{{- end -}}
{{- end -}}

View File

@ -58,21 +58,23 @@ postgresql:
recipes:
secretKey: ""
persistence:
static:
enabled: false
existingClaim: ""
annotations: {}
accessMode: ReadWriteOnce
storageClass: ""
size: 1Gi
media:
enabled: false
existingClaim: ""
annotations: {}
accessMode: ReadWriteOnce
storageClass: ""
size: 1Gi
persistence:
static:
enabled: false
existingClaim: ""
annotations: {}
accessMode: ReadWriteOnce
storageClass: ""
size: 1Gi
media:
enabled: false
existingClaim: ""
annotations: {}
accessMode: ReadWriteOnce
storageClass: ""
size: 1Gi
ingress:
enabled: false
className: ""