From 0f328371542dc851c85e0c65561957d2c5b71629 Mon Sep 17 00:00:00 2001 From: 0hlov3 Date: Mon, 23 Dec 2024 22:17:53 +0100 Subject: [PATCH] [gotsocial] Set the CLaimName in _helpers.tpl to simplify reading of deployment.yaml --- charts/gotosocial/templates/_helpers.tpl | 11 +++++++++++ charts/gotosocial/templates/deployment.yaml | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/charts/gotosocial/templates/_helpers.tpl b/charts/gotosocial/templates/_helpers.tpl index bd6d0bf..a3cd2e8 100644 --- a/charts/gotosocial/templates/_helpers.tpl +++ b/charts/gotosocial/templates/_helpers.tpl @@ -75,4 +75,15 @@ Set postgres host {{- if .Values.postgresql.enabled -}} {{- template "gotosocial.postgresql.fullname" . -}} {{- end -}} +{{- end -}} + +{{/* +Create Volumeclaim Name +*/}} +{{- define "gotosocial.volume.claimName" -}} +{{- if and .Values.gotosocial.persistence.enabled (ne .Values.gotosocial.persistence.existingClaim "") -}} +{{ .Values.gotosocial.persistence.existingClaim }} +{{- else -}} +{{ printf "%s-%s" (include "gotosocial.fullname" .) "data" }} +{{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/gotosocial/templates/deployment.yaml b/charts/gotosocial/templates/deployment.yaml index 3699b9c..a73e4ce 100644 --- a/charts/gotosocial/templates/deployment.yaml +++ b/charts/gotosocial/templates/deployment.yaml @@ -133,11 +133,7 @@ spec: {{- if .Values.gotosocial.persistence.enabled }} - name: gotosocial-data persistentVolumeClaim: - {{- if .Values.gotosocial.persistence.existingClaim }} - claimName: {{ .Values.gotosocial.persistence.existingClaim }} - {{- else }} - claimName: {{ $fullName }}-data - {{- end }} + claimName: {{ include "gotosocial.volume.claimName" . }} {{- end }} {{- if .Values.gotosocial.tmpfs.enabled }} - name: tmpfs