From b97a479ca59c0c426f799301f7219a88434d6011 Mon Sep 17 00:00:00 2001 From: Emilien Devos <121870973+edevosc2c@users.noreply.github.com> Date: Wed, 7 Feb 2024 18:25:25 +0100 Subject: [PATCH] add option to specify storage class per PVC --- .../geonetwork/elasticsearch/es-data-pvc.yaml | 11 +++-- .../geonetwork/geonetwork-datadir-pvc.yaml | 11 +++-- .../geoserver/geoserver-datadir-pvc.yaml | 11 +++-- .../geoserver/geoserver-geodata-pvc.yaml | 11 +++-- templates/geoserver/geoserver-tiles-pvc.yaml | 11 +++-- templates/ldap/openldap-pvc-config.yaml | 26 +++++++++++ templates/ldap/openldap-pvc-data.yaml | 26 +++++++++++ templates/ldap/openldap-pvc.yaml | 44 ------------------- templates/mapstore/mapstore-pvc.yaml | 11 +++-- values.yaml | 2 + 10 files changed, 96 insertions(+), 68 deletions(-) create mode 100644 templates/ldap/openldap-pvc-config.yaml create mode 100644 templates/ldap/openldap-pvc-data.yaml delete mode 100644 templates/ldap/openldap-pvc.yaml diff --git a/templates/geonetwork/elasticsearch/es-data-pvc.yaml b/templates/geonetwork/elasticsearch/es-data-pvc.yaml index 59963d7..798cccc 100644 --- a/templates/geonetwork/elasticsearch/es-data-pvc.yaml +++ b/templates/geonetwork/elasticsearch/es-data-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.geonetwork.elasticsearch -}} +{{- $webapp_storage := .Values.georchestra.storage.gn4_es -}} {{- if $webapp.enabled -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.gn4_es.pv_name }} - volumeName: {{ .Values.georchestra.storage.gn4_es.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.gn4_es.size }} + storage: {{ $webapp_storage.size }} {{- end }} \ No newline at end of file diff --git a/templates/geonetwork/geonetwork-datadir-pvc.yaml b/templates/geonetwork/geonetwork-datadir-pvc.yaml index 2970f6d..72c03b6 100644 --- a/templates/geonetwork/geonetwork-datadir-pvc.yaml +++ b/templates/geonetwork/geonetwork-datadir-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.geonetwork -}} +{{- $webapp_storage := .Values.georchestra.storage.geonetwork_datadir -}} {{- if $webapp.enabled -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.geonetwork_datadir.pv_name }} - volumeName: {{ .Values.georchestra.storage.geonetwork_datadir.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.geonetwork_datadir.size }} + storage: {{ $webapp_storage.size }} {{- end }} \ No newline at end of file diff --git a/templates/geoserver/geoserver-datadir-pvc.yaml b/templates/geoserver/geoserver-datadir-pvc.yaml index a7456f5..420f6dd 100644 --- a/templates/geoserver/geoserver-datadir-pvc.yaml +++ b/templates/geoserver/geoserver-datadir-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.geoserver -}} +{{- $webapp_storage := .Values.georchestra.storage.geoserver_datadir -}} {{- if $webapp.enabled -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.geoserver_datadir.pv_name }} - volumeName: {{ .Values.georchestra.storage.geoserver_datadir.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.geoserver_datadir.size }} + storage: {{ $webapp_storage.size }} {{- end }} \ No newline at end of file diff --git a/templates/geoserver/geoserver-geodata-pvc.yaml b/templates/geoserver/geoserver-geodata-pvc.yaml index 543b12b..4208b85 100644 --- a/templates/geoserver/geoserver-geodata-pvc.yaml +++ b/templates/geoserver/geoserver-geodata-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.geoserver -}} +{{- $webapp_storage := .Values.georchestra.storage.geoserver_geodata -}} {{- if $webapp.enabled -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.geoserver_geodata.pv_name }} - volumeName: {{ .Values.georchestra.storage.geoserver_geodata.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.geoserver_geodata.size }} + storage: {{ $webapp_storage.size }} {{- end }} \ No newline at end of file diff --git a/templates/geoserver/geoserver-tiles-pvc.yaml b/templates/geoserver/geoserver-tiles-pvc.yaml index 2d615d8..5a63061 100644 --- a/templates/geoserver/geoserver-tiles-pvc.yaml +++ b/templates/geoserver/geoserver-tiles-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.geoserver -}} +{{- $webapp_storage := .Values.georchestra.storage.geoserver_tiles -}} {{- if and $webapp.enabled .Values.georchestra.storage.geoserver_tiles -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.geoserver_tiles.pv_name }} - volumeName: {{ .Values.georchestra.storage.geoserver_tiles.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.geoserver_tiles.size }} + storage: {{ $webapp_storage.size }} {{- end }} diff --git a/templates/ldap/openldap-pvc-config.yaml b/templates/ldap/openldap-pvc-config.yaml new file mode 100644 index 0000000..b78db1c --- /dev/null +++ b/templates/ldap/openldap-pvc-config.yaml @@ -0,0 +1,26 @@ +{{- $webapp := .Values.georchestra.webapps.openldap -}} +{{- $webapp_storage := .Values.georchestra.storage.openldap_config -}} +{{- if $webapp.enabled -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "georchestra.fullname" . }}-openldap-config + labels: + {{- include "georchestra.labels" . | nindent 4 }} + app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-ldap + helm.sh/resource-policy: "keep" +spec: + accessModes: + - ReadWriteOnce + {{- if .Values.georchestra.storage.openldap_config.storage_class_name }} + storageClassName: {{ .Values.georchestra.storage.openldap_config.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} + storageClassName: {{ .Values.georchestra.storage.storage_class_name }} + {{- end }} + {{- if .Values.georchestra.storage.openldap_config.pv_name }} + volumeName: {{ .Values.georchestra.storage.openldap_config.pv_name }} + {{- end }} + resources: + requests: + storage: {{ .Values.georchestra.storage.openldap_config.size }} +{{- end }} diff --git a/templates/ldap/openldap-pvc-data.yaml b/templates/ldap/openldap-pvc-data.yaml new file mode 100644 index 0000000..128fdda --- /dev/null +++ b/templates/ldap/openldap-pvc-data.yaml @@ -0,0 +1,26 @@ +{{- $webapp := .Values.georchestra.webapps.openldap -}} +{{- $webapp_storage := .Values.georchestra.storage.openldap_data -}} +{{- if $webapp.enabled -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "georchestra.fullname" . }}-openldap-data + labels: + {{- include "georchestra.labels" . | nindent 4 }} + app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-ldap + helm.sh/resource-policy: "keep" +spec: + accessModes: + - ReadWriteOnce + {{- if .Values.georchestra.storage.openldap_data.storage_class_name }} + storageClassName: {{ .Values.georchestra.storage.openldap_data.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} + storageClassName: {{ .Values.georchestra.storage.storage_class_name }} + {{- end }} + {{- if .Values.georchestra.storage.openldap_data.pv_name }} + volumeName: {{ .Values.georchestra.storage.openldap_data.pv_name }} + {{- end }} + resources: + requests: + storage: {{ .Values.georchestra.storage.openldap_data.size }} +{{- end }} diff --git a/templates/ldap/openldap-pvc.yaml b/templates/ldap/openldap-pvc.yaml deleted file mode 100644 index 26c3223..0000000 --- a/templates/ldap/openldap-pvc.yaml +++ /dev/null @@ -1,44 +0,0 @@ -{{- $webapp := .Values.georchestra.webapps.openldap -}} -{{- if $webapp.enabled -}} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "georchestra.fullname" . }}-openldap-data - labels: - {{- include "georchestra.labels" . | nindent 4 }} - app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-ldap - helm.sh/resource-policy: "keep" -spec: - accessModes: - - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} - storageClassName: {{ .Values.georchestra.storage.storage_class_name }} - {{- end }} - {{- if .Values.georchestra.storage.openldap_data.pv_name }} - volumeName: {{ .Values.georchestra.storage.openldap_data.pv_name }} - {{- end }} - resources: - requests: - storage: {{ .Values.georchestra.storage.openldap_data.size }} ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "georchestra.fullname" . }}-openldap-config - labels: - {{- include "georchestra.labels" . | nindent 4 }} - app.kubernetes.io/component: {{ include "georchestra.fullname" . }}-ldap - helm.sh/resource-policy: "keep" -spec: - accessModes: - - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} - storageClassName: {{ .Values.georchestra.storage.storage_class_name }} - {{- end }} - {{- if .Values.georchestra.storage.openldap_config.pv_name }} - volumeName: {{ .Values.georchestra.storage.openldap_config.pv_name }} - {{- end }} - resources: - requests: - storage: {{ .Values.georchestra.storage.openldap_config.size }} -{{- end }} diff --git a/templates/mapstore/mapstore-pvc.yaml b/templates/mapstore/mapstore-pvc.yaml index 901f833..855f477 100644 --- a/templates/mapstore/mapstore-pvc.yaml +++ b/templates/mapstore/mapstore-pvc.yaml @@ -1,4 +1,5 @@ {{- $webapp := .Values.georchestra.webapps.mapstore -}} +{{- $webapp_storage := .Values.georchestra.storage.mapstore_datadir -}} {{- if $webapp.enabled -}} apiVersion: v1 kind: PersistentVolumeClaim @@ -11,13 +12,15 @@ metadata: spec: accessModes: - ReadWriteOnce - {{- if .Values.georchestra.storage.storage_class_name }} + {{- if $webapp_storage.storage_class_name }} + storageClassName: {{ $webapp_storage.storage_class_name }} + {{- else if .Values.georchestra.storage.storage_class_name }} storageClassName: {{ .Values.georchestra.storage.storage_class_name }} {{- end }} - {{- if .Values.georchestra.storage.mapstore_datadir.pv_name }} - volumeName: {{ .Values.georchestra.storage.mapstore_datadir.pv_name }} + {{- if $webapp_storage.pv_name }} + volumeName: {{ $webapp_storage.pv_name }} {{- end }} resources: requests: - storage: {{ .Values.georchestra.storage.mapstore_datadir.size }} + storage: {{ $webapp_storage.size }} {{- end }} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 1d1c809..10303ac 100644 --- a/values.yaml +++ b/values.yaml @@ -178,6 +178,8 @@ georchestra: size: 256Mi geoserver_geodata: # pv_name: geoserver_geodata + # works for other storage items + # storage_class_name: default size: 2Gi mapstore_datadir: # pv_name: mapstore_datadir