From 4e8c8918bee8ca1600f3490aa3ebc3977fdcf64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Tue, 20 Aug 2019 14:06:18 +0200 Subject: [PATCH] [stable/suitecrm] Add global StorageClass to suitecrm (#16419) Signed-off-by: Miguel A. Cabrera Minagorri --- stable/suitecrm/Chart.yaml | 2 +- stable/suitecrm/README.md | 1 + stable/suitecrm/templates/_helpers.tpl | 20 ++++++++++++++++++++ stable/suitecrm/templates/suitecrm-pvc.yaml | 8 +------- stable/suitecrm/values.yaml | 1 + 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/stable/suitecrm/Chart.yaml b/stable/suitecrm/Chart.yaml index b5506870e3..0ea21ad561 100644 --- a/stable/suitecrm/Chart.yaml +++ b/stable/suitecrm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: suitecrm -version: 7.0.1 +version: 7.1.0 appVersion: 7.11.7 description: SuiteCRM is a completely open source enterprise-grade Customer Relationship Management (CRM) application. SuiteCRM is a software fork of the popular customer relationship management (CRM) system SugarCRM. keywords: diff --git a/stable/suitecrm/README.md b/stable/suitecrm/README.md index e0a08effc3..c04fad5408 100644 --- a/stable/suitecrm/README.md +++ b/stable/suitecrm/README.md @@ -51,6 +51,7 @@ The following table lists the configurable parameters of the SuiteCRM chart and |-------------------------------------|-------------------------------------------------|---------------------------------------------------------| | `global.imageRegistry` | Global Docker image registry | `nil` | | `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | | `image.registry` | SuiteCRM image registry | `docker.io` | | `image.repository` | SuiteCRM image name | `bitnami/suitecrm` | | `image.tag` | SuiteCRM image tag | `{TAG_NAME}` | diff --git a/stable/suitecrm/templates/_helpers.tpl b/stable/suitecrm/templates/_helpers.tpl index d7806a5954..084889b1a6 100644 --- a/stable/suitecrm/templates/_helpers.tpl +++ b/stable/suitecrm/templates/_helpers.tpl @@ -139,3 +139,23 @@ imagePullSecrets: {{- end }} {{- end -}} {{- end -}} + +{{/* +Return the proper Storage Class +*/}} +{{- define "suitecrm.storageClass" -}} +{{- $storageClass := "" }} +{{- if .Values.persistence.storageClass -}} + {{- $storageClass = .Values.persistence.storageClass -}} +{{- end -}} +{{- if .Values.global -}} + {{- if .Values.global.storageClass -}} + {{- $storageClass = .Values.global.storageClass -}} + {{- end -}} +{{- end -}} +{{- if (eq "-" $storageClass) -}} + {{- printf "\"\"" -}} +{{- else }} + {{- printf "%s" $storageClass -}} +{{- end -}} +{{- end -}} diff --git a/stable/suitecrm/templates/suitecrm-pvc.yaml b/stable/suitecrm/templates/suitecrm-pvc.yaml index 749515ffd4..bed4d6a33a 100644 --- a/stable/suitecrm/templates/suitecrm-pvc.yaml +++ b/stable/suitecrm/templates/suitecrm-pvc.yaml @@ -14,11 +14,5 @@ spec: resources: requests: storage: {{ .Values.persistence.size | quote }} -{{- if .Values.persistence.storageClass }} -{{- if (eq "-" .Values.persistence.storageClass) }} - storageClassName: "" -{{- else }} - storageClassName: "{{ .Values.persistence.storageClass }}" -{{- end }} -{{- end }} + storageClassName: {{ include "suitecrm.storageClass" . }} {{- end -}} diff --git a/stable/suitecrm/values.yaml b/stable/suitecrm/values.yaml index f6cdc50b50..f360b31902 100644 --- a/stable/suitecrm/values.yaml +++ b/stable/suitecrm/values.yaml @@ -6,6 +6,7 @@ # imageRegistry: myRegistryName # imagePullSecrets: # - myRegistryKeySecretName +# storageClass: myStorageClass ## Bitnami SuiteCRM image version ## ref: https://hub.docker.com/r/bitnami/suitecrm/tags/