From 41cd81e4ad9553dd69db59ea0bb571a9f20e6d2f Mon Sep 17 00:00:00 2001 From: Amanda Cameron Date: Fri, 27 Jan 2017 18:21:25 -0500 Subject: [PATCH] [stable/mysql] Update to the recommended pvc patterns. (#456) * Convert chart mysql to use the recommended pvc patterns * mysql: fix persistence annotations * mysql: Fix password printing * mysql: Update truncation to 63 * mysql: Add newline after password is printed * mysql: note that default uses alpha storage annotation * Update _helpers.tpl * mysql: Version bump 0.2.4 * Update _helpers.tpl --- stable/mysql/Chart.yaml | 2 +- stable/mysql/README.md | 2 +- stable/mysql/templates/NOTES.txt | 2 +- stable/mysql/templates/_helpers.tpl | 6 +++--- stable/mysql/templates/pvc.yaml | 6 +++++- stable/mysql/values.yaml | 5 ++++- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/stable/mysql/Chart.yaml b/stable/mysql/Chart.yaml index 26336ad086..14ab6b3c53 100644 --- a/stable/mysql/Chart.yaml +++ b/stable/mysql/Chart.yaml @@ -1,5 +1,5 @@ name: mysql -version: 0.2.3 +version: 0.2.4 description: Chart for MySQL keywords: - mysql diff --git a/stable/mysql/README.md b/stable/mysql/README.md index 6865221caa..bc45f8d5c0 100644 --- a/stable/mysql/README.md +++ b/stable/mysql/README.md @@ -54,7 +54,7 @@ The following tables lists the configurable parameters of the MySQL chart and th | `mysqlDatabase` | Name for new database to create. | `nil` | | `persistence.enabled` | Create a volume to store data | true | | `persistence.size` | Size of persistent volume claim | 8Gi RW | -| `persistence.storageClass` | Type of persistent volume claim | generic | +| `persistence.storageClass` | Type of persistent volume claim | nil (uses alpha storage class annotation) | | `persistence.accessMode` | ReadWriteOnce or ReadOnly | ReadWriteOnce | | `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` | diff --git a/stable/mysql/templates/NOTES.txt b/stable/mysql/templates/NOTES.txt index e776e9bded..b4246b2c5a 100644 --- a/stable/mysql/templates/NOTES.txt +++ b/stable/mysql/templates/NOTES.txt @@ -3,7 +3,7 @@ MySQL can be accessed via port 3306 on the following DNS name from within your c To get your root password run: - printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.mysql-root-password[*]}"`);echo + kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo To connect to your database: diff --git a/stable/mysql/templates/_helpers.tpl b/stable/mysql/templates/_helpers.tpl index 234480de71..f0d83d2edb 100644 --- a/stable/mysql/templates/_helpers.tpl +++ b/stable/mysql/templates/_helpers.tpl @@ -3,14 +3,14 @@ Expand the name of the chart. */}} {{- define "name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Create a default fully qualified app name. -We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/stable/mysql/templates/pvc.yaml b/stable/mysql/templates/pvc.yaml index ce71ca3ebc..6a21fe551b 100644 --- a/stable/mysql/templates/pvc.yaml +++ b/stable/mysql/templates/pvc.yaml @@ -9,7 +9,11 @@ metadata: release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" annotations: - volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- if .Values.persistence.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/stable/mysql/values.yaml b/stable/mysql/values.yaml index 91e2b8cbc5..923431085f 100644 --- a/stable/mysql/values.yaml +++ b/stable/mysql/values.yaml @@ -30,7 +30,10 @@ imagePullPolicy: IfNotPresent ## Persist data to a persitent volume persistence: enabled: true - storageClass: generic + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: accessMode: ReadWriteOnce size: 8Gi