[stable/moodle] Simplify ingress configuration for cert-manager (#8356)

* Fix typo

Signed-off-by: juan131 <juan@bitnami.com>

* [stable/moodle] Simplify ingress configuration for cert-manager

Signed-off-by: juan131 <juan@bitnami.com>

* Fix typo

Signed-off-by: juan131 <juan@bitnami.com>

* Add 'moodle.chart' macro

Signed-off-by: juan131 <juan@bitnami.com>
This commit is contained in:
Juan Ariza Toledano
2018-10-11 06:23:55 -07:00
committed by k8s-ci-robot
parent e17e0ac0e4
commit afef658628
9 changed files with 94 additions and 60 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: moodle
version: 3.0.3
version: 3.1.0
appVersion: 3.5.2
description: Moodle is a learning platform designed to provide educators, administrators
and learners with a single robust, secure and integrated system to create personalised
+14 -8
View File
@@ -63,10 +63,16 @@ The following table lists the configurable parameters of the Moodle chart and th
| `smtpUser` | SMTP user | `nil` |
| `smtpPassword` | SMTP password | `nil` |
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
| `ingress.enabled` | If ingress should be created | `false` |
| `ingress.annotations` | Any ingress annotations | `nil` |
| `ingress.hosts` | List of Ingress hosts | `nil` |
| `ingress.tls` | List of certs. If defined, https is set | `nil` |
| `ingress.enabled` | Enable ingress controller resource | `false` |
| `ingress.hosts[0].name` | Hostname to your Moodle installation | `moodle.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) | `moodle.local-tls-secret` |
| `ingress.hosts[0].annotations` | Annotations for this host's ingress record | `[]` |
| `ingress.secrets[0].name` | TLS Secret Name | `nil` |
| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` |
| `ingress.secrets[0].key` | TLS Secret Key | `nil` |
| `affinity` | Set affinity for the moodle pods | `nil` |
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
| `persistence.enabled` | Enable persistence using PVC | `true` |
@@ -81,10 +87,10 @@ The following table lists the configurable parameters of the Moodle chart and th
| `externalDatabase.password` | Password for the above username | `nil` |
| `externalDatabase.database` | Name of the existing database | `bitnami_moodle` |
| `mariadb.enabled` | Whether to install the MariaDB chart | `true` |
| `mariadb.db.name` | Database name to create | `bitnami_moodle` |
| `mariadb.db.user` | Database user to create | `bn_moodle` |
| `mariadb.db.password` | Password for the database | `nil` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `mariadb.db.name` | Database name to create | `bitnami_moodle` |
| `mariadb.db.user` | Database user to create | `bn_moodle` |
| `mariadb.db.password` | Password for the database | `nil` |
| `mariadb.rootUser.password` | MariaDB admin password | `nil` |
| `mariadb.persistence.enabled` | Enable MariaDB persistence using PVC | `true` |
| `mariadb.persistence.storageClass` | PVC Storage Class for MariaDB volume | `generic` |
| `mariadb.persistence.accessMode` | PVC Access Mode for MariaDB volume | `ReadWriteOnce` |
+6 -1
View File
@@ -31,4 +31,9 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- printf "%s-%s" .Release.Name "moodle" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "moodle.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
+2 -2
View File
@@ -4,7 +4,7 @@ metadata:
name: {{ template "moodle.fullname" . }}
labels:
app: {{ template "moodle.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "moodle.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
@@ -16,7 +16,7 @@ spec:
metadata:
labels:
app: {{ template "moodle.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "moodle.chart" . }}
release: "{{ .Release.Name }}"
spec:
{{- if .Values.affinity }}
+30 -25
View File
@@ -1,35 +1,40 @@
{{- if .Values.ingress.enabled -}}
{{- $releaseName := .Release.Name -}}
{{- $serviceName := include "moodle.fullname" . }}
{{- if .Values.ingress.enabled }}
{{- range .Values.ingress.hosts }}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
{{- if .Values.ingress.annotations }}
annotations:
{{ toYaml .Values.ingress.annotations | indent 4}}
{{- end }}
name: "{{- printf "%s-%s" .name $.Release.Name | trunc 63 | trimSuffix "-" -}}"
labels:
app: {{ template "moodle.fullname" . }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
component: "{{ .Values.name }}"
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
name: {{ template "moodle.fullname" . }}
app: {{ template "moodle.fullname" $ }}
chart: {{ template "moodle.chart" $ }}
release: "{{ $.Release.Name }}"
heritage: "{{ $.Release.Service }}"
annotations:
{{- if .certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
{{- range $key, $value := .annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
spec:
rules:
{{- range .Values.ingress.hosts }}
- host: {{ . }}
http:
paths:
- backend:
serviceName: {{ $serviceName }}
servicePort: 80
{{- end -}}
{{- if .Values.ingress.tls }}
- host: {{ .name }}
http:
paths:
- path: {{ default "/" .path }}
backend:
serviceName: {{ template "moodle.fullname" $ }}
servicePort: 80
{{- if .tls }}
tls:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
- hosts:
- {{ .name }}
secretName: {{ .tlsSecret }}
{{- end }}
---
{{- end }}
{{- end }}
+1 -1
View File
@@ -5,7 +5,7 @@ metadata:
name: {{ template "moodle.fullname" . }}
labels:
app: {{ template "moodle.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "moodle.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
+1 -1
View File
@@ -4,7 +4,7 @@ metadata:
name: {{ template "moodle.fullname" . }}
labels:
app: {{ template "moodle.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "moodle.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
+1 -1
View File
@@ -4,7 +4,7 @@ metadata:
name: {{ template "moodle.fullname" . }}
labels:
app: {{ template "moodle.fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
chart: {{ template "moodle.chart" . }}
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
spec:
+38 -20
View File
@@ -139,32 +139,50 @@ mariadb:
##
serviceType: LoadBalancer
## Optionally, create ingress controller
## Configure the ingress resource that allows you to access the
## Moodle installation. Set up the URL
## ref: http://kubernetes.io/docs/user-guide/ingress/
##
ingress:
## If true, Moodle server Ingress will be created
##
## Set to true to enable ingress record generation
enabled: false
## Moodle server Ingress annotations
##
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: 'true'
## 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: moodle.local
## Moodle server Ingress hostnames
## Must be provided if Ingress is enabled
##
hosts: []
# - moodle.domain.com
## Set this to true in order to enable TLS on the ingress record
## A side effect of this will be that the backend moodle service will be connected at port 443
tls: false
## Moodle server Ingress TLS configuration
## Secrets must be manually created in the namespace
## kubectl create secret tls moodle-server-tls --cert=tls.crt --key=tls.key
## 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: moodle.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
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
## -----BEGIN RSA PRIVATE KEY-----
##
tls: []
# - secretName: moodle-server-tls
# hosts:
# - moodle.domain.com
## 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: moodle.local-tls
# key:
# certificate:
## Enable persistence using Persistent Volume Claims
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/