From ac8fd1b98e57d8ec80bf5e424b3f2b306aa6b4c2 Mon Sep 17 00:00:00 2001 From: Irfan Date: Wed, 25 Sep 2024 09:47:13 +0100 Subject: [PATCH 1/3] Use hostPath when persistent vols are set to false --- geoserver/latest/templates/statefulset.yaml | 22 ++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/geoserver/latest/templates/statefulset.yaml b/geoserver/latest/templates/statefulset.yaml index fd636c1..c0f6f18 100644 --- a/geoserver/latest/templates/statefulset.yaml +++ b/geoserver/latest/templates/statefulset.yaml @@ -248,30 +248,42 @@ spec: {{- end }} {{- end }} volumes: - {{- if .Values.persistence.datadir }} - name: gs-datadir + {{- if .Values.persistence.datadir }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-datadir + {{ else }} + hostPath: + path: /var/geoserver/ {{- end }} - {{- if .Values.persistence.memdumps }} - name: gs-memdumps + {{- if .Values.persistence.memdumps }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-memdumps {{- end }} - {{- if .Values.persistence.logs }} - name: gs-logs + {{- if .Values.persistence.logs }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-logs + {{ else }} + hostPath: + path: /var/geoserver/ {{- end }} - {{- if .Values.persistence.tomcatlogs }} - name: gs-tomcatlogs + {{- if .Values.persistence.tomcatlogs }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-tomcatlogs + {{ else }} + hostPath: + path: /var/geoserver/ {{- end }} - {{- if .Values.persistence.audits }} - name: gs-audits + {{- if .Values.persistence.audits }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-audits + {{ else }} + hostPath: + path: /var/geoserver/ {{- end }} - name: context secret: From 937fdef9dc9642e0e5c7101a023c398be0ffff43 Mon Sep 17 00:00:00 2001 From: Irfan Date: Wed, 25 Sep 2024 10:09:29 +0100 Subject: [PATCH 2/3] Don't mount datadir if persistence is off Let it use the default datadir location. This case always assumes datadir is burned in the image. --- geoserver/latest/templates/statefulset.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/geoserver/latest/templates/statefulset.yaml b/geoserver/latest/templates/statefulset.yaml index c0f6f18..431be06 100644 --- a/geoserver/latest/templates/statefulset.yaml +++ b/geoserver/latest/templates/statefulset.yaml @@ -50,8 +50,10 @@ spec: {{- end }} volumeMounts: + {{- if .Values.persistence.datadir }} - name: gs-datadir mountPath: /var/geoserver/datadir + {{- end }} - name: gs-memdumps mountPath: $(GEOSERVER_HEAP_DUMP_DIR) - name: gs-audits @@ -198,8 +200,10 @@ spec: mountPath: /usr/local/tomcat/conf/server.xml subPath: server.xml readOnly: true + {{- if .Values.persistence.datadir }} - name: gs-datadir mountPath: /var/geoserver/datadir + {{- end }} - name: gs-memdumps mountPath: /var/geoserver/memory_dumps - name: gs-audits @@ -248,13 +252,10 @@ spec: {{- end }} {{- end }} volumes: - - name: gs-datadir {{- if .Values.persistence.datadir }} + - name: gs-datadir persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-datadir - {{ else }} - hostPath: - path: /var/geoserver/ {{- end }} - name: gs-memdumps {{- if .Values.persistence.memdumps }} From 6d02333fac11673aacd12a6df7b259b9b2a0f1a1 Mon Sep 17 00:00:00 2001 From: Irfan Date: Tue, 1 Oct 2024 14:57:14 +0100 Subject: [PATCH 3/3] use subdirs for different hostpath --- geoserver/latest/templates/statefulset.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/geoserver/latest/templates/statefulset.yaml b/geoserver/latest/templates/statefulset.yaml index 431be06..6a58557 100644 --- a/geoserver/latest/templates/statefulset.yaml +++ b/geoserver/latest/templates/statefulset.yaml @@ -261,6 +261,9 @@ spec: {{- if .Values.persistence.memdumps }} persistentVolumeClaim: claimName: {{ include "geoserver.fullname" . }}-memdumps + {{ else }} + hostPath: + path: /var/geoserver/memdumps {{- end }} - name: gs-logs {{- if .Values.persistence.logs }} @@ -268,7 +271,7 @@ spec: claimName: {{ include "geoserver.fullname" . }}-logs {{ else }} hostPath: - path: /var/geoserver/ + path: /var/geoserver/logs {{- end }} - name: gs-tomcatlogs {{- if .Values.persistence.tomcatlogs }} @@ -276,7 +279,7 @@ spec: claimName: {{ include "geoserver.fullname" . }}-tomcatlogs {{ else }} hostPath: - path: /var/geoserver/ + path: /var/geoserver/tomcatlogs/ {{- end }} - name: gs-audits {{- if .Values.persistence.audits }} @@ -284,7 +287,7 @@ spec: claimName: {{ include "geoserver.fullname" . }}-audits {{ else }} hostPath: - path: /var/geoserver/ + path: /var/geoserver/audits {{- end }} - name: context secret: