From a9f4ac9b59d39654ab18aec02baa04b637cef466 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Salmer=C3=B3n-Garc=C3=ADa?= Date: Thu, 28 Mar 2019 09:02:44 +0100 Subject: [PATCH] [stable/magento] Add ingress support (#12568) Signed-off-by: Javier J. Salmeron Garcia --- stable/magento/Chart.yaml | 2 +- stable/magento/README.md | 11 ++++++ stable/magento/templates/ingress.yaml | 43 +++++++++++++++++++++ stable/magento/values.yaml | 54 +++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 stable/magento/templates/ingress.yaml diff --git a/stable/magento/Chart.yaml b/stable/magento/Chart.yaml index da7ffe778f..712ce27b95 100644 --- a/stable/magento/Chart.yaml +++ b/stable/magento/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: magento -version: 4.4.1 +version: 4.5.0 appVersion: 2.3.0 description: A feature-rich flexible e-commerce solution. It includes transaction options, multi-store functionality, loyalty programs, product categorization and shopper filtering, promotion rules, and more. keywords: diff --git a/stable/magento/README.md b/stable/magento/README.md index 8ef2e5dd9f..b4ee26c332 100644 --- a/stable/magento/README.md +++ b/stable/magento/README.md @@ -67,6 +67,17 @@ The following table lists the configurable parameters of the Magento chart and t | `magentoMode` | Magento mode | `developer` | | `magentoAdminUri` | Magento prefix to access Magento Admin | `admin` | | `allowEmptyPassword` | Allow DB blank passwords | `yes` | +| `ingress.enabled` | Enable ingress controller resource | `false` | +| `ingress.annotations` | Ingress annotations | `[]` | +| `ingress.certManager` | Add annotations for cert-manager | `false` | +| `ingress.hosts[0].name` | Hostname to your Magento installation | `magento.local` | +| `ingress.hosts[0].path` | Path within the url structure | `/` | +| `ingress.hosts[0].tls` | Utilize TLS backend in ingress | `false` | +| `ingress.hosts[0].tlsHosts` | Array of TLS hosts for ingress record (defaults to `ingress.hosts[0].name` if `nil`) | `nil` | +| `ingress.hosts[0].tlsSecret` | TLS Secret (certificates) | `magento.local-tls-secret` | +| `ingress.secrets[0].name` | TLS Secret Name | `nil` | +| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | +| `ingress.secrets[0].key` | TLS Secret Key | `nil` | | `externalDatabase.host` | Host of the external database | `nil` | | `externalDatabase.port` | Port of the external database | `3306` | | `externalDatabase.user` | Existing username in the external db | `bn_magento` | diff --git a/stable/magento/templates/ingress.yaml b/stable/magento/templates/ingress.yaml new file mode 100644 index 0000000000..798b82a450 --- /dev/null +++ b/stable/magento/templates/ingress.yaml @@ -0,0 +1,43 @@ +{{- if .Values.ingress.enabled }} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "magento.fullname" . }} + labels: + app: "{{ template "magento.fullname" . }}" + chart: "{{ template "magento.chart" . }}" + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} + annotations: + {{- if .Values.ingress.certManager }} + kubernetes.io/tls-acme: "true" + {{- end }} + {{- 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 "magento.fullname" $ }} + servicePort: http + {{- end }} + tls: + {{- range .Values.ingress.hosts }} + {{- if .tls }} + - hosts: + {{- if .tlsHosts }} + {{- range $host := .tlsHosts }} + - {{ $host }} + {{- end }} + {{- else }} + - {{ .name }} + {{- end }} + secretName: {{ .tlsSecret }} + {{- end }} + {{- end }} +{{- end }} diff --git a/stable/magento/values.yaml b/stable/magento/values.yaml index 0bd7318c1f..00988a9054 100644 --- a/stable/magento/values.yaml +++ b/stable/magento/values.yaml @@ -226,6 +226,60 @@ resources: ## podAnnotations: {} +## Configure the ingress resource that allows you to access the +## Magento 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: magento.local + path: / + + ## Set this to true in order to enable TLS on the ingress record + tls: false + + ## Optionally specify the TLS hosts for the ingress record + ## Useful when the Ingress controller supports www-redirection + ## If not specified, the above host name will be used + # tlsHosts: + # - www.magento.local + # - magento.local + + ## If TLS is set to true, you must declare what secret will store the key/certificate for TLS + tlsSecret: magento.local-tls + + 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 + ## -----BEGIN RSA PRIVATE KEY----- + ## + ## name should line up with a tlsSecret set further up + ## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set + ## + ## It is also possible to create and manage the certificates outside of this helm chart + ## Please see README.md for more information + # - name: magento.local-tls + # key: + # certificate: + + ## Prometheus Exporter / Metrics ## metrics: