diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 756dd81..dcd995f 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -93,3 +93,10 @@ Frontend fullname {{- define "vikunja.frontendFullname" -}} {{- include "vikunja.fullname" . | printf "%s-frontend" | trunc 63 | trimSuffix "-" }} {{- end }} + +{{/* +Create the name of the PVC to use +*/}} +{{- define "vikunja.pvcName" -}} +{{- default (include "vikunja.fullname" .) .Values.api.persistence.name }} +{{- end }} \ No newline at end of file diff --git a/templates/api/deployment.yaml b/templates/api/deployment.yaml index 6ff632b..2892bdf 100644 --- a/templates/api/deployment.yaml +++ b/templates/api/deployment.yaml @@ -107,7 +107,7 @@ spec: {{- if .Values.api.persistence.enabled }} - name: storage persistentVolumeClaim: - claimName: {{ include "vikunja.apiFullname" . }} + claimName: {{ include "vikunja.pvcName" . }} {{- end }} {{- with .Values.api.extraVolumes }} {{- toYaml . | nindent 6 }} diff --git a/templates/api/pvc.yaml b/templates/api/pvc.yaml index 9538a45..649f602 100644 --- a/templates/api/pvc.yaml +++ b/templates/api/pvc.yaml @@ -1,8 +1,8 @@ -{{- if .Values.api.persistence.enabled }} +{{- if and .Values.api.persistence.enabled .Values.api.persistence.create }} apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: {{ include "vikunja.apiFullname" . }} + name: {{ include "vikunja.pvcName" . }} labels: {{- include "vikunja.labels" . | nindent 4 }} spec: diff --git a/values.yaml b/values.yaml index 01f286d..bb89c14 100644 --- a/values.yaml +++ b/values.yaml @@ -174,6 +174,11 @@ api: persistence: enabled: false + # Specifies whether a PVC should be created + create: true + # The name of the PVC to use. + # If not set and create is true, a name is generated using the fullname template + name: "" spec: {} # accessModes: ["ReadWriteOnce"] # resources: