From 172708d11ba6fff25edc46449240fce678a54fbf Mon Sep 17 00:00:00 2001 From: Tomas Pizarro Date: Tue, 8 Jan 2019 16:25:11 +0100 Subject: [PATCH] [stable/wordpress] Fix syntax error when ingress is enabled (#10432) * [stable/wordpress] Fix syntax error when ingress is enabled Signed-off-by: tompizmor * Update README Signed-off-by: tompizmor * Delete testing values from values.yaml Signed-off-by: tompizmor * Fix wrong values Signed-off-by: tompizmor * Fix wrong values Signed-off-by: tompizmor * Undo app label change to avoid breaking upgrades Signed-off-by: tompizmor --- stable/wordpress/Chart.yaml | 2 +- stable/wordpress/README.md | 38 +++++++++++----------- stable/wordpress/templates/NOTES.txt | 12 +++---- stable/wordpress/templates/_helpers.tpl | 4 +-- stable/wordpress/templates/deployment.yaml | 14 ++++---- stable/wordpress/templates/ingress.yaml | 32 +++++++++--------- stable/wordpress/templates/pvc.yaml | 4 +-- stable/wordpress/templates/secrets.yaml | 4 +-- stable/wordpress/templates/svc.yaml | 6 ++-- stable/wordpress/values-production.yaml | 35 ++++++++++---------- stable/wordpress/values.yaml | 30 ++++++++--------- 11 files changed, 89 insertions(+), 92 deletions(-) diff --git a/stable/wordpress/Chart.yaml b/stable/wordpress/Chart.yaml index 7745d6f91c..c1699ee150 100644 --- a/stable/wordpress/Chart.yaml +++ b/stable/wordpress/Chart.yaml @@ -1,5 +1,5 @@ name: wordpress -version: 5.0.4 +version: 5.0.5 appVersion: 5.0.2 description: Web publishing platform for building blogs and websites. icon: https://bitnami.com/assets/stacks/wordpress/img/wordpress-stack-220x234.png diff --git a/stable/wordpress/README.md b/stable/wordpress/README.md index 9cf26cdbc8..a06679a824 100644 --- a/stable/wordpress/README.md +++ b/stable/wordpress/README.md @@ -80,22 +80,22 @@ The following table lists the configurable parameters of the WordPress chart and | `externalDatabase.password` | Password for the above username | `nil` | | `externalDatabase.database` | Name of the existing database | `bitnami_wordpress` | | `externalDatabase.port` | Database port number | `3306` | -| `service.type` | Kubernetes Service type | `LoadBalancer` | -| `service.port` | Service HTTP port | `80` | -| `service.httpsPort` | Service HTTPS port | `443` | -| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | -| `service.nodePorts.http` | Kubernetes http node port | `""` | -| `service.nodePorts.https` | Kubernetes https node port | `""` | +| `service.type` | Kubernetes Service type | `LoadBalancer` | +| `service.port` | Service HTTP port | `80` | +| `service.httpsPort` | Service HTTPS port | `443` | +| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | +| `service.nodePorts.http` | Kubernetes http node port | `""` | +| `service.nodePorts.https` | Kubernetes https node port | `""` | | `healthcheckHttps` | Use https for liveliness and readiness | `false` | | `livenessProbeHeaders` | Headers to use for livenessProbe | `nil` | | `readinessProbeHeaders` | Headers to use for readinessProbe | `nil` | | `ingress.enabled` | Enable ingress controller resource | `false` | -| `ingress.hosts[0].name` | Hostname to your WordPress installation | `wordpress.local` | +| `ingress.certManager` | Add annotations for cert-manager | `false` | +| `ingress.annotations` | Ingress annotations | `[]` | +| `ingress.hosts[0].name` | Hostname to your PrestaShop installation | `prestashop.local` | | `ingress.hosts[0].path` | Path within the url structure | `/` | | `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | -| `ingress.hosts[0].certManager` | Add annotations for cert-manager | `false` | -| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `wordpress.local-tls-secret` | -| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` | +| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `prestashop.local-tls` | | `ingress.secrets[0].name` | TLS Secret Name | `nil` | | `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | | `ingress.secrets[0].key` | TLS Secret Key | `nil` | @@ -107,15 +107,15 @@ The following table lists the configurable parameters of the WordPress chart and | `nodeSelector` | Node labels for pod assignment | `{}` | | `tolerations` | List of node taints to tolerate | `[]` | | `affinity` | Map of node/pod affinities | `{}` | -| `podAnnotations` | Pod annotations | `{}` | -| `metrics.enabled` | Start a side-car prometheus exporter | `false` | -| `metrics.image.registry` | Apache exporter image registry | `docker.io` | -| `metrics.image.repository` | Apache exporter image name | `lusotycoon/apache-exporter` | -| `metrics.image.tag` | Apache exporter image tag | `v0.5.0` | -| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` | -| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` | -| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | `{prometheus.io/scrape: "true", prometheus.io/port: "9117"}` | -| `metrics.resources` | Exporter resource requests/limit | {} | +| `podAnnotations` | Pod annotations | `{}` | +| `metrics.enabled` | Start a side-car prometheus exporter | `false` | +| `metrics.image.registry` | Apache exporter image registry | `docker.io` | +| `metrics.image.repository` | Apache exporter image name | `lusotycoon/apache-exporter` | +| `metrics.image.tag` | Apache exporter image tag | `v0.5.0` | +| `metrics.image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `nil` | +| `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | `{prometheus.io/scrape: "true", prometheus.io/port: "9117"}` | +| `metrics.resources` | Exporter resource requests/limit | {} | The above parameters map to the env variables defined in [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress). For more information please refer to the [bitnami/wordpress](http://github.com/bitnami/bitnami-docker-wordpress) image documentation. diff --git a/stable/wordpress/templates/NOTES.txt b/stable/wordpress/templates/NOTES.txt index 31937e0a52..82fe5bc7e9 100644 --- a/stable/wordpress/templates/NOTES.txt +++ b/stable/wordpress/templates/NOTES.txt @@ -7,14 +7,14 @@ {{- range .Values.ingress.hosts }} {{ if .tls }}https{{ else }}http{{ end }}://{{ .name }}/admin {{- end }} - + {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. - Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}' + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "wordpress.fullname" . }}' {{- $port:=.Values.service.port | toString }} - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "wordpress.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo "WordPress URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/" echo "WordPress Admin URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/admin" @@ -22,11 +22,11 @@ echo "WordPress URL: http://127.0.0.1:8080/" echo "WordPress Admin URL: http://127.0.0.1:8080/admin" - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "fullname" . }} 8080:{{ .Values.service.port }} + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "wordpress.fullname" . }} 8080:{{ .Values.service.port }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "wordpress.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo "WordPress URL: http://$NODE_IP:$NODE_PORT/" echo "WordPress Admin URL: http://$NODE_IP:$NODE_PORT/admin" @@ -36,4 +36,4 @@ 2. Login with the following credentials to see your blog echo Username: {{ .Values.wordpressUsername }} - echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.wordpress-password}" | base64 --decode) + echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "wordpress.fullname" . }} -o jsonpath="{.data.wordpress-password}" | base64 --decode) diff --git a/stable/wordpress/templates/_helpers.tpl b/stable/wordpress/templates/_helpers.tpl index ceb7ee95e0..09a1118221 100644 --- a/stable/wordpress/templates/_helpers.tpl +++ b/stable/wordpress/templates/_helpers.tpl @@ -2,7 +2,7 @@ {{/* Expand the name of the chart. */}} -{{- define "name" -}} +{{- define "wordpress.name" -}} {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -10,7 +10,7 @@ Expand the name of the chart. Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "fullname" -}} +{{- define "wordpress.fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/stable/wordpress/templates/deployment.yaml b/stable/wordpress/templates/deployment.yaml index 961c7f9df8..845e81f146 100644 --- a/stable/wordpress/templates/deployment.yaml +++ b/stable/wordpress/templates/deployment.yaml @@ -1,22 +1,22 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} labels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} spec: selector: matchLabels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" release: {{ .Release.Name | quote }} replicas: {{ .Values.replicaCount }} template: metadata: labels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} {{- if or .Values.podAnnotations .Values.metrics.enabled }} @@ -89,7 +89,7 @@ spec: - name: WORDPRESS_PASSWORD valueFrom: secretKeyRef: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} key: wordpress-password - name: WORDPRESS_EMAIL value: {{ .Values.wordpressEmail | quote }} @@ -117,7 +117,7 @@ spec: - name: SMTP_PASSWORD valueFrom: secretKeyRef: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} key: smtp-password {{- end }} {{- if .Values.smtpUsername }} @@ -200,7 +200,7 @@ spec: - name: wordpress-data {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "fullname" .) }} + claimName: {{ .Values.persistence.existingClaim | default (include "wordpress.fullname" .) }} {{- else }} emptyDir: {} {{ end }} diff --git a/stable/wordpress/templates/ingress.yaml b/stable/wordpress/templates/ingress.yaml index eba168b3e8..0be8fd5416 100644 --- a/stable/wordpress/templates/ingress.yaml +++ b/stable/wordpress/templates/ingress.yaml @@ -1,39 +1,37 @@ {{- if .Values.ingress.enabled }} -{{- range .Values.ingress.hosts }} apiVersion: extensions/v1beta1 kind: Ingress metadata: - name: "{{- printf "%s-%s" .name $.Release.Name | trunc 63 | trimSuffix "-" -}}" + name: {{ template "wordpress.fullname" . }} labels: - app: "{{ template "fullname" $ }}" - chart: "{{ template "wordpress.chart" $ }}" + app: "{{ template "wordpress.fullname" . }}" + chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} annotations: - {{- if .tls }} - ingress.kubernetes.io/secure-backends: "true" - {{- end }} - {{- if .certManager }} + {{- if .Values.ingress.certManager }} kubernetes.io/tls-acme: "true" {{- end }} - {{- range $key, $value := .annotations }} + {{- range $key, $value := .Values.ingress.annotations }} {{ $key }}: {{ $value | quote }} {{- end }} spec: rules: + {{- range .Values.ingress.hosts }} - host: {{ .name }} http: paths: - - path: {{ default "/" .path }} - backend: - serviceName: {{ template "fullname" $ }} - servicePort: 80 -{{- if .tls }} + - path: {{ default "/" .path }} + backend: + serviceName: "{{ template "wordpress.fullname" $ }}" + servicePort: http + {{- end }} tls: + {{- range .Values.ingress.hosts }} + {{- if .tls }} - hosts: - {{ .name }} secretName: {{ .tlsSecret }} -{{- end }} ---- -{{- end }} + {{- end }} + {{- end }} {{- end }} diff --git a/stable/wordpress/templates/pvc.yaml b/stable/wordpress/templates/pvc.yaml index a7a4961d6f..523df462f5 100644 --- a/stable/wordpress/templates/pvc.yaml +++ b/stable/wordpress/templates/pvc.yaml @@ -2,9 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} labels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} diff --git a/stable/wordpress/templates/secrets.yaml b/stable/wordpress/templates/secrets.yaml index 46da37b12e..c39dd5f5f8 100644 --- a/stable/wordpress/templates/secrets.yaml +++ b/stable/wordpress/templates/secrets.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} labels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} diff --git a/stable/wordpress/templates/svc.yaml b/stable/wordpress/templates/svc.yaml index dd630a44f8..f988a884a2 100644 --- a/stable/wordpress/templates/svc.yaml +++ b/stable/wordpress/templates/svc.yaml @@ -1,9 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "fullname" . }} + name: {{ template "wordpress.fullname" . }} labels: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" chart: "{{ template "wordpress.chart" . }}" release: {{ .Release.Name | quote }} heritage: {{ .Release.Service | quote }} @@ -26,4 +26,4 @@ spec: nodePort: {{ .Values.service.nodePorts.https }} {{- end }} selector: - app: "{{ template "fullname" . }}" + app: "{{ template "wordpress.fullname" . }}" diff --git a/stable/wordpress/values-production.yaml b/stable/wordpress/values-production.yaml index 1608a82ef9..de3fb4b658 100644 --- a/stable/wordpress/values-production.yaml +++ b/stable/wordpress/values-production.yaml @@ -184,38 +184,37 @@ readinessProbe: # value: https ## Configure the ingress resource that allows you to access the -## Wordpress installation. Set up the URL +## WordPress installation. Set up the URL ## ref: http://kubernetes.io/docs/user-guide/ingress/ ## ingress: ## Set to true to enable ingress record generation - enabled: true + enabled: false + + ## Set this to true in order to add the corresponding annotations for cert-manager + certManager: false + + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md + ## + ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + annotations: + # kubernetes.io/ingress.class: nginx ## The list of hostnames to be covered with this ingress record. ## Most likely this will be just one host, but in the event more hosts are needed, this is an array - ## Please make sure to change the name and tlsSecret to your own settings hosts: - name: wordpress.local + path: / - ## Set this to true in order to enable TLS on the ingress record - ## A side effect of this will be that the backend wordpress service will be connected at port 443 - tls: true - - ## Set this to true in order to add the corresponding annotations for cert-manager - certManager: false + # Set this to true in order to enable TLS on the ingress record + tls: false ## If TLS is set to true, you must declare what secret will store the key/certificate for TLS tlsSecret: wordpress.local-tls - ## Ingress annotations done as key:value pairs - ## For a full list of possible ingress annotations, please see - ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md - ## - ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set - ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set - annotations: - # kubernetes.io/ingress.class: nginx - secrets: ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or diff --git a/stable/wordpress/values.yaml b/stable/wordpress/values.yaml index 89bd0ecb50..d541d846d1 100644 --- a/stable/wordpress/values.yaml +++ b/stable/wordpress/values.yaml @@ -187,37 +187,37 @@ readinessProbe: # value: https ## Configure the ingress resource that allows you to access the -## Wordpress installation. Set up the URL +## WordPress installation. Set up the URL ## ref: http://kubernetes.io/docs/user-guide/ingress/ ## ingress: ## Set to true to enable ingress record generation enabled: false + ## Set this to true in order to add the corresponding annotations for cert-manager + certManager: false + + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md + ## + ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + annotations: + # kubernetes.io/ingress.class: nginx + ## The list of hostnames to be covered with this ingress record. ## Most likely this will be just one host, but in the event more hosts are needed, this is an array hosts: - name: wordpress.local + path: / - ## Set this to true in order to enable TLS on the ingress record - ## A side effect of this will be that the backend wordpress service will be connected at port 443 + # Set this to true in order to enable TLS on the ingress record tls: false - ## Set this to true in order to add the corresponding annotations for cert-manager - certManager: false - ## If TLS is set to true, you must declare what secret will store the key/certificate for TLS tlsSecret: wordpress.local-tls - ## Ingress annotations done as key:value pairs - ## For a full list of possible ingress annotations, please see - ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/annotations.md - ## - ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set - ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set - annotations: - # kubernetes.io/ingress.class: nginx - secrets: ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or