From 47786d3038ecc18b01ce971defb344cd02decb43 Mon Sep 17 00:00:00 2001 From: Scott Rigby Date: Wed, 12 Apr 2017 14:25:54 -0400 Subject: [PATCH] Adds stable/drupal ingress support (#813) * Add Drupal chart ingress * Bump stable/drupal minor version for new ingress feature * stable/drupal Ingress template * Change NOTES to only print hostname if a hostname is set (ingress can be set without it) * Comment out Values.ingress.hostname by default * Fix indentation * Fix indentation on comments. Note we should clea up the wordpress chart, as this indentation problem came from there initially * Add ingress.annotations to README table * Fix markdown table spacing. Not a bug, but for consistency sake --- stable/drupal/Chart.yaml | 2 +- stable/drupal/README.md | 4 ++++ stable/drupal/templates/NOTES.txt | 20 +++++++++++++++----- stable/drupal/templates/ingress.yaml | 28 ++++++++++++++++++++++++++++ stable/drupal/values.yaml | 23 +++++++++++++++++++++++ 5 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 stable/drupal/templates/ingress.yaml diff --git a/stable/drupal/Chart.yaml b/stable/drupal/Chart.yaml index d3e66204f6..d60fbff4cd 100644 --- a/stable/drupal/Chart.yaml +++ b/stable/drupal/Chart.yaml @@ -1,5 +1,5 @@ name: drupal -version: 0.4.6 +version: 0.5.0 description: One of the most versatile open source content management systems. keywords: - drupal diff --git a/stable/drupal/README.md b/stable/drupal/README.md index c5d0512213..54d29be6d0 100644 --- a/stable/drupal/README.md +++ b/stable/drupal/README.md @@ -52,6 +52,10 @@ The following tables lists the configurable parameters of the Drupal chart and t | `drupalUsername` | User of the application | `user` | | `drupalPassword` | Application password | _random 10 character long alphanumeric string_ | | `drupalEmail` | Admin email | `user@example.com` | +| `ingress.annotations` | Specify ingress class | `kubernetes.io/ingress.class: nginx` | +| `ingress.enabled` | Enable ingress controller resource | `false` | +| `ingress.hostname` | URL for your Drupal installation | `drupal.local` | +| `ingress.tls` | Ingress TLS configuration | `[]` | | `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` | | `serviceType` | Kubernetes Service type | `LoadBalancer` | | `persistence.enabled` | Enable persistence using PVC | `true` | diff --git a/stable/drupal/templates/NOTES.txt b/stable/drupal/templates/NOTES.txt index eb8b761a36..815b3f3d51 100644 --- a/stable/drupal/templates/NOTES.txt +++ b/stable/drupal/templates/NOTES.txt @@ -3,13 +3,13 @@ *** PLEASE BE PATIENT: Drupal may take a few minutes to install *** ******************************************************************* -1. Get the Drupal URL by running: +1. Get the Drupal URL: -{{- if contains "NodePort" .Values.serviceType }} +{{- if .Values.ingress.hostname }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT/ + You should be able to access your new Drupal installation through + + http://{{- .Values.ingress.hostname }}/ {{- else if contains "LoadBalancer" .Values.serviceType }} @@ -25,6 +25,16 @@ kubectl port-forward $POD_NAME 8080:80 {{- end }} +{{- if contains "NodePort" .Values.serviceType }} + + Or running: + + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT/ + +{{- end }} + 2. Login with the following credentials echo Username: {{ .Values.drupalUsername }} diff --git a/stable/drupal/templates/ingress.yaml b/stable/drupal/templates/ingress.yaml new file mode 100644 index 0000000000..8b314fbe17 --- /dev/null +++ b/stable/drupal/templates/ingress.yaml @@ -0,0 +1,28 @@ +{{- if .Values.ingress.enabled -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + - host: {{ .Values.ingress.hostname }} + http: + paths: + - path: / + backend: + serviceName: {{ template "fullname" . }} + servicePort: 80 +{{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} +{{- end -}} +{{- end -}} diff --git a/stable/drupal/values.yaml b/stable/drupal/values.yaml index 41b6dad0e8..ccc6826065 100644 --- a/stable/drupal/values.yaml +++ b/stable/drupal/values.yaml @@ -47,9 +47,32 @@ mariadb: ## Kubernetes configuration ## For minikube, set this to NodePort, elsewhere use LoadBalancer +## Use ClusterIP if your setup includes ingress controller ## serviceType: LoadBalancer +## Configure Ingress resource that allow you to access the Drupal installation +## Set up the URL +## ref: http://kubernetes.io/docs/user-guide/ingress/ +## +ingress: + enabled: false + # Used to create Ingress record (should used with ServiceType: ClusterIP). + # hostname: drupal.local + + ## Ingress annotations + ## + # annotations: + # kubernetes.io/ingress.class: nginx + + ## Ingress TLS configuration + ## Secrets must be manually created in the namespace + ## + # tls: + # - secretName: wordpress.local-tls + # hosts: + # - drupal.local + ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ##