(dev-v2.6-archive) Add validation on trying to deploy Grafana PVC

(partially cherry picked from commit 75a96a7e94)
pull/1680/head
Arvind Iyengar 2021-05-24 11:33:02 -07:00
parent b78b04ad05
commit 470ce9ee46
No known key found for this signature in database
GPG Key ID: A8DD9BFD6C811498
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,18 @@
--- charts-original/templates/pvc.yaml
+++ charts/templates/pvc.yaml
@@ -16,12 +16,14 @@
{{- end }}
spec:
accessModes:
+{{- $_ := required "Must provide at least one access mode for persistent volumes used by Grafana" .Values.persistence.accessModes }}
+{{- $_ := required "Must provide at least one access mode for persistent volumes used by Grafana" (first .Values.persistence.accessModes) }}
{{- range .Values.persistence.accessModes }}
- {{ . | quote }}
{{- end }}
resources:
requests:
- storage: {{ .Values.persistence.size | quote }}
+ storage: {{ required "Must provide size for persistent volumes used by Grafana" .Values.persistence.size | quote }}
{{- if .Values.persistence.storageClassName }}
storageClassName: {{ .Values.persistence.storageClassName }}
{{- end -}}

View File

@ -0,0 +1,17 @@
--- charts-original/templates/statefulset.yaml
+++ charts/templates/statefulset.yaml
@@ -39,11 +39,13 @@
- metadata:
name: storage
spec:
+{{- $_ := required "Must provide at least one access mode for persistent volumes used by Grafana" .Values.persistence.accessModes }}
+{{- $_ := required "Must provide at least one access mode for persistent volumes used by Grafana" (first .Values.persistence.accessModes) }}
accessModes: {{ .Values.persistence.accessModes }}
storageClassName: {{ .Values.persistence.storageClassName }}
resources:
requests:
- storage: {{ .Values.persistence.size }}
+ storage: {{ required "Must provide size for persistent volumes used by Grafana" .Values.persistence.size }}
{{- with .Values.persistence.selectorLabels }}
selector:
matchLabels: