From 040cb230b236e48c0e44fdf88df8fdc9161dea8d Mon Sep 17 00:00:00 2001 From: Andreas Holmsten Date: Thu, 3 May 2018 18:33:51 +0200 Subject: [PATCH] [incubator/mysqlha] Use volumeClaimTemplates.spec.storageClassName (#4175) * Use volumeClaimTemplates.spec.storageClassName Instead of using volume.alpha storage class annotation which is removed(?) in 1.9 * Bump chart version to 0.1.2 * Undefine persistence.storageClass by default Add example for persistence.storageClass option in values.yaml to better comply with chart review guidelines. * mysqlha: Add appVersion to Chart.yaml appVersion is now a required Chart metadata field, add mysql version to this field. * [incubator/mysqlha] Change templating for volumeClaimTemplates * (Re)add annotations templating * Change accessModes templating to accept list Rename persistence.accessMode to persistence.accessModes to reflect this change * If set persistence.storageClass is set to `-`, set storageClassName: "", which disables dynamic provisioning * [incubator/mysqlha] Swap contents of if/else blocks for volumeClaimTemplates * Denote that k8s 1.6 is now a requirement in readme * Add documentation for default provisioner used in Azure * Bump Chart version to 0.2.0 --- incubator/mysqlha/Chart.yaml | 2 +- incubator/mysqlha/README.md | 5 ++-- incubator/mysqlha/templates/statefulset.yaml | 28 +++++++++++++------- incubator/mysqlha/values.yaml | 11 ++++++-- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/incubator/mysqlha/Chart.yaml b/incubator/mysqlha/Chart.yaml index 085ac55a4d..9a03df8d7a 100644 --- a/incubator/mysqlha/Chart.yaml +++ b/incubator/mysqlha/Chart.yaml @@ -1,5 +1,5 @@ name: mysqlha -version: 0.1.3 +version: 0.2.0 appVersion: 5.7.13 description: MySQL cluster with a single master and zero or more slave replicas keywords: diff --git a/incubator/mysqlha/README.md b/incubator/mysqlha/README.md index 3d4dc876f5..360f2b9a58 100644 --- a/incubator/mysqlha/README.md +++ b/incubator/mysqlha/README.md @@ -8,7 +8,7 @@ This chart bootstraps a single master and multiple slave MySQL deployment on a [ ## Prerequisites -- Kubernetes 1.4+ with Beta APIs enabled +- Kubernetes 1.6+ - PV provisioner support in the underlying infrastructure ## Installing the Chart @@ -47,7 +47,8 @@ The following table lists the configurable parameters of the MySQL chart and the | `persistence.enabled` | Create a volume to store data | true | | `persistence.size` | Size of persistent volume claim | 10Gi | | `persistence.storageClass` | Type of persistent volume claim | `nil` | -| `persistence.accessMode` | ReadWriteOnce or ReadOnly | ReadWriteOnce | +| `persistence.accessModes` | Persistent volume access modes | `[ReadWriteOnce]` | +| `persistence.annotations` | Persistent volume annotations | `{}` | | `resources` | CPU/Memory resource requests/limits | Memory: `128Mi`, CPU: `100m` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/incubator/mysqlha/templates/statefulset.yaml b/incubator/mysqlha/templates/statefulset.yaml index d71937823a..65d5009d5b 100644 --- a/incubator/mysqlha/templates/statefulset.yaml +++ b/incubator/mysqlha/templates/statefulset.yaml @@ -223,22 +223,30 @@ spec: name: {{ template "fullname" . }} - name: scripts emptyDir: {} - {{- if eq .Values.persistence.enabled false }} - - name: data - emptyDir: {} - {{- end}} +{{- if .Values.persistence.enabled }} volumeClaimTemplates: - {{- if .Values.persistence.enabled }} - metadata: name: data annotations: - {{- if .Values.persistence.storageClass }} - volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass }} - {{- end }} + {{- range $key, $value := .Values.persistence.annotations }} + {{ $key }}: {{ $value }} + {{- end }} spec: accessModes: - - {{ .Values.persistence.accessMode | quote }} + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.persistence.size | quote }} - {{- end }} \ No newline at end of file + {{- if .Values.persistence.storageClass }} + {{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" + {{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" + {{- end }} + {{- end }} +{{- else }} + - name: data + emptyDir: {} +{{- end }} diff --git a/incubator/mysqlha/values.yaml b/incubator/mysqlha/values.yaml index 6b5b9eee36..64233ca7f5 100644 --- a/incubator/mysqlha/values.yaml +++ b/incubator/mysqlha/values.yaml @@ -34,10 +34,17 @@ mysqlha: ## persistence: enabled: true - ## If defined, volume.beta.kubernetes.io/storage-class: + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, azure-disk on + ## Azure, standard on GKE, AWS & OpenStack) ## - accessMode: ReadWriteOnce + # storageClass: "-" + accessModes: + - ReadWriteOnce size: 10Gi + annotations: {} resources: requests: