From 579ce9ac37f726367b1c413e81640375307d11cc Mon Sep 17 00:00:00 2001 From: Jesse Hitch Date: Mon, 23 Dec 2024 19:29:08 +0100 Subject: [PATCH 1/3] Update deployment.yaml - allow existingClaim for gotosocial persistent volume --- charts/gotosocial/Chart.yaml | 4 ++-- charts/gotosocial/templates/deployment.yaml | 6 +++++- charts/gotosocial/values.yaml | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/gotosocial/Chart.yaml b/charts/gotosocial/Chart.yaml index 78e2ad3..34f363c 100644 --- a/charts/gotosocial/Chart.yaml +++ b/charts/gotosocial/Chart.yaml @@ -6,7 +6,7 @@ home: https://github.com/superseriousbusiness/gotosocial type: application # Chart Version -version: "0.4.28" +version: "0.5.0" # gotosocial version appVersion: "0.17.3" @@ -19,4 +19,4 @@ dependencies: - name: postgresql version: ~11.9.13 repository: https://charts.bitnami.com/bitnami - condition: postgresql.enabled \ No newline at end of file + condition: postgresql.enabled diff --git a/charts/gotosocial/templates/deployment.yaml b/charts/gotosocial/templates/deployment.yaml index 3228255..3699b9c 100644 --- a/charts/gotosocial/templates/deployment.yaml +++ b/charts/gotosocial/templates/deployment.yaml @@ -133,7 +133,11 @@ 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 }} {{- end }} {{- if .Values.gotosocial.tmpfs.enabled }} - name: tmpfs @@ -151,4 +155,4 @@ spec: {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} - {{- end }} \ No newline at end of file + {{- end }} diff --git a/charts/gotosocial/values.yaml b/charts/gotosocial/values.yaml index bbf4f3a..ad7aee2 100644 --- a/charts/gotosocial/values.yaml +++ b/charts/gotosocial/values.yaml @@ -47,6 +47,8 @@ gotosocial: accessMode: "ReadWriteOnce" size: "10Gi" #storageClass: "" + # use an existing persistent volume claim + existingClaim: "" tmpfs: enabled: false size: "1Gi" @@ -188,7 +190,7 @@ podSecurityContext: securityContext: capabilities: - drop: + drop: - ALL readOnlyRootFilesystem: true allowPrivilegeEscalation: false From 706b7aa8f11739cb008fb2cc69adca3032768f89 Mon Sep 17 00:00:00 2001 From: 0hlov3 Date: Mon, 23 Dec 2024 22:07:43 +0100 Subject: [PATCH 2/3] [gotsocial] Create PersistentVolumeClaim only if gotosocial.persistence.existingClaim="" --- charts/gotosocial/templates/pvc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/gotosocial/templates/pvc.yaml b/charts/gotosocial/templates/pvc.yaml index 074a087..8f19f5c 100644 --- a/charts/gotosocial/templates/pvc.yaml +++ b/charts/gotosocial/templates/pvc.yaml @@ -1,4 +1,4 @@ -{{- if .Values.gotosocial.persistence.enabled }} +{{- if and .Values.gotosocial.persistence.enabled (eq .Values.gotosocial.persistence.existingClaim "") -}} --- apiVersion: v1 kind: PersistentVolumeClaim From 0f328371542dc851c85e0c65561957d2c5b71629 Mon Sep 17 00:00:00 2001 From: 0hlov3 Date: Mon, 23 Dec 2024 22:17:53 +0100 Subject: [PATCH 3/3] [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