From 323f7f2ab64df6f3ad65c72ea5eaa33dd4f7a56d Mon Sep 17 00:00:00 2001 From: Amanda Cameron Date: Mon, 30 Jan 2017 19:50:12 -0500 Subject: [PATCH] [stable/opencart] Update to the recommended pvc patterns. (#457) * Convert chart opencart to use the recommended pvc patterns * update mariadb dep * fix notes for 1.5 * truncate to 63 and trim trailing dashes * remove annotations and fix trunc in pvc * bump version * document alpha storage class fallback * fix NOTES when no mariadb password --- stable/opencart/README.md | 4 ++-- stable/opencart/requirements.lock | 6 +++--- stable/opencart/requirements.yaml | 2 +- stable/opencart/templates/NOTES.txt | 10 ++++++---- stable/opencart/templates/_helpers.tpl | 10 +++++----- stable/opencart/templates/apache-pvc.yaml | 6 +++++- stable/opencart/templates/opencart-pvc.yaml | 6 +++++- stable/opencart/values.yaml | 15 ++++++++++++--- 8 files changed, 39 insertions(+), 20 deletions(-) diff --git a/stable/opencart/README.md b/stable/opencart/README.md index d34107bdbc..047d9f61cc 100644 --- a/stable/opencart/README.md +++ b/stable/opencart/README.md @@ -62,10 +62,10 @@ The following tables lists the configurable parameters of the OpenCart chart and | `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` | | `serviceType` | Kubernetes Service type | `LoadBalancer` | | `persistence.enabled` | Enable persistence using PVC | `true` | -| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `generic` | +| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `nil` (uses alpha storage class annotation) | | `persistence.apache.accessMode` | PVC Access Mode for Apache volume | `ReadWriteOnce` | | `persistence.apache.size` | PVC Storage Request for Apache volume | `1Gi` | -| `persistence.opencart.storageClass` | PVC Storage Class for OpenCart volume | `generic` | +| `persistence.opencart.storageClass` | PVC Storage Class for OpenCart volume | `nil` (uses alpha storage class annotation) | | `persistence.opencart.accessMode` | PVC Access Mode for OpenCart volume | `ReadWriteOnce` | | `persistence.opencart.size` | PVC Storage Request for OpenCart volume | `8Gi` | | `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | diff --git a/stable/opencart/requirements.lock b/stable/opencart/requirements.lock index f549c9463a..d10c832bba 100644 --- a/stable/opencart/requirements.lock +++ b/stable/opencart/requirements.lock @@ -1,6 +1,6 @@ dependencies: - name: mariadb repository: https://kubernetes-charts.storage.googleapis.com/ - version: 0.5.6 -digest: sha256:1b3aad03b4383d1a24dfbfef6ba1beb45f7ace2baa399c66f5a4d56d0f7bc717 -generated: 2017-01-25T15:57:36.670458211-08:00 + version: 0.5.7 +digest: sha256:409eefb841b53ef1aa91d0607d87e6c475297df40101180c787260d766657d95 +generated: 2017-01-27T18:02:06.574333356-08:00 diff --git a/stable/opencart/requirements.yaml b/stable/opencart/requirements.yaml index 9303bd388a..ac65eec118 100644 --- a/stable/opencart/requirements.yaml +++ b/stable/opencart/requirements.yaml @@ -1,4 +1,4 @@ dependencies: - name: mariadb - version: 0.5.x + version: 0.5.7 repository: https://kubernetes-charts.storage.googleapis.com/ diff --git a/stable/opencart/templates/NOTES.txt b/stable/opencart/templates/NOTES.txt index 06d5c88913..3972a292fd 100644 --- a/stable/opencart/templates/NOTES.txt +++ b/stable/opencart/templates/NOTES.txt @@ -19,14 +19,16 @@ host. To configure OpenCart with the URL of your service: Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}' export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - export APP_PASSWORD=$(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password[*]}"`)) - export APP_DATABASE_PASSWORD=$(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password[*]}"`)) + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode) + {{- if .Values.mariadb.mariadbRootPassword }} + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) + {{- end }} {{- end }} 2. Complete your OpenCart deployment by running: helm upgrade {{ .Release.Name }} \ - --set opencartHost=$APP_HOST,opencartPassword=$APP_PASSWORD,mariadb.mariadbRootPassword=$APP_DATABASE_PASSWORD stable/opencart + --set opencartHost=$APP_HOST,opencartPassword=$APP_PASSWORD{{ if .Values.mariadb.mariadbRootPassword }},mariadb.mariadbRootPassword=$APP_DATABASE_PASSWORD{{ end }} stable/opencart {{- else -}} 1. Get the OpenCart URL by running: @@ -44,5 +46,5 @@ host. To configure OpenCart with the URL of your service: 2. Get your OpenCart login credentials by running: echo Admin Username: {{ .Values.opencartUsername }} - echo Admin Password: $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password[*]}"`)) + echo Admin Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.opencart-password}" | base64 --decode) {{- end }} diff --git a/stable/opencart/templates/_helpers.tpl b/stable/opencart/templates/_helpers.tpl index 77da2c6a6e..2463906531 100644 --- a/stable/opencart/templates/_helpers.tpl +++ b/stable/opencart/templates/_helpers.tpl @@ -3,24 +3,24 @@ 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 -}} {{/* 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 "mariadb.fullname" -}} -{{- printf "%s-%s" .Release.Name "mariadb" | trunc 24 -}} +{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* diff --git a/stable/opencart/templates/apache-pvc.yaml b/stable/opencart/templates/apache-pvc.yaml index 39fd689744..166feb8b9f 100644 --- a/stable/opencart/templates/apache-pvc.yaml +++ b/stable/opencart/templates/apache-pvc.yaml @@ -9,7 +9,11 @@ metadata: release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" annotations: - volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.apache.storageClass | quote }} + {{- if .Values.persistence.apache.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.apache.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} spec: accessModes: - {{ .Values.persistence.apache.accessMode | quote }} diff --git a/stable/opencart/templates/opencart-pvc.yaml b/stable/opencart/templates/opencart-pvc.yaml index 0f398a8698..a7b676647b 100644 --- a/stable/opencart/templates/opencart-pvc.yaml +++ b/stable/opencart/templates/opencart-pvc.yaml @@ -9,7 +9,11 @@ metadata: release: "{{ .Release.Name }}" heritage: "{{ .Release.Service }}" annotations: - volume.alpha.kubernetes.io/storage-class: {{ .Values.persistence.opencart.storageClass | quote }} + {{- if .Values.persistence.opencart.storageClass }} + volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.opencart.storageClass | quote }} + {{- else }} + volume.alpha.kubernetes.io/storage-class: default + {{- end }} spec: accessModes: - {{ .Values.persistence.opencart.accessMode | quote }} diff --git a/stable/opencart/values.yaml b/stable/opencart/values.yaml index 205091a1ac..0543ff97e8 100644 --- a/stable/opencart/values.yaml +++ b/stable/opencart/values.yaml @@ -58,7 +58,10 @@ mariadb: ## 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 @@ -73,11 +76,17 @@ serviceType: LoadBalancer persistence: enabled: true apache: - storageClass: generic + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: accessMode: ReadWriteOnce size: 1Gi opencart: - storageClass: generic + ## If defined, volume.beta.kubernetes.io/storage-class: + ## Default: volume.alpha.kubernetes.io/storage-class: default + ## + # storageClass: accessMode: ReadWriteOnce size: 8Gi