From da4d6610c24e8188fc8e528cdd03d7c070f5f880 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel=20Cabrera=20Mi=C3=B1agorri?= Date: Tue, 20 Aug 2019 12:50:19 +0200 Subject: [PATCH] [stable/ghost] Add global StorageClass to Ghost (#16435) Signed-off-by: Miguel A. Cabrera Minagorri --- stable/ghost/Chart.yaml | 2 +- stable/ghost/README.md | 1 + stable/ghost/templates/_helpers.tpl | 20 ++++++++++++++++++++ stable/ghost/templates/pvc.yaml | 8 +------- stable/ghost/values.yaml | 1 + 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/stable/ghost/Chart.yaml b/stable/ghost/Chart.yaml index 71a62b135f..98a9c63993 100644 --- a/stable/ghost/Chart.yaml +++ b/stable/ghost/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: ghost -version: 7.0.3 +version: 7.1.0 appVersion: 2.28.1 description: A simple, powerful publishing platform that allows you to share your stories with the world keywords: diff --git a/stable/ghost/README.md b/stable/ghost/README.md index 2c8063504f..e365354149 100644 --- a/stable/ghost/README.md +++ b/stable/ghost/README.md @@ -51,6 +51,7 @@ The following table lists the configurable parameters of the Ghost chart and the |-------------------------------------|---------------------------------------------------------------|----------------------------------------------------------| | `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` | Ghost image registry | `docker.io` | | `image.repository` | Ghost Image name | `bitnami/ghost` | | `image.tag` | Ghost Image tag | `{TAG_NAME}` | diff --git a/stable/ghost/templates/_helpers.tpl b/stable/ghost/templates/_helpers.tpl index 711a24f10d..eab5a5b4f3 100644 --- a/stable/ghost/templates/_helpers.tpl +++ b/stable/ghost/templates/_helpers.tpl @@ -144,3 +144,23 @@ imagePullSecrets: {{- end }} {{- end -}} {{- end -}} + +{{/* +Return the proper Storage Class +*/}} +{{- define "ghost.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/ghost/templates/pvc.yaml b/stable/ghost/templates/pvc.yaml index 0b5dbea1c5..57e546f36e 100644 --- a/stable/ghost/templates/pvc.yaml +++ b/stable/ghost/templates/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 "ghost.storageClass" . }} {{- end -}} diff --git a/stable/ghost/values.yaml b/stable/ghost/values.yaml index 5c7d16cbee..ecc6028fbb 100644 --- a/stable/ghost/values.yaml +++ b/stable/ghost/values.yaml @@ -6,6 +6,7 @@ # imageRegistry: myRegistryName # imagePullSecrets: # - myRegistryKeySecretName +# storageClass: myStorageClass ## Bitnami Ghost image version ## ref: https://hub.docker.com/r/bitnami/ghost/tags/