[stable/moodle] Allow use of external database (#4184)

* [stable/moodle] Allow use of external database

* Add missing secrets file

* Add mariabdRootPassword property

* Fix typo

* Update image tag

* Delete trailing space
This commit is contained in:
Tomas Pizarro
2018-03-16 10:24:24 -07:00
committed by k8s-ci-robot
parent e2aa400670
commit a03f11b36c
8 changed files with 112 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: moodle
version: 0.4.7
version: 0.5.0
appVersion: 3.4.1
description: Moodle is a learning platform designed to provide educators, administrators
and learners with a single robust, secure and integrated system to create personalised
+11 -1
View File
@@ -69,7 +69,17 @@ The following tables lists the configurable parameters of the Moodle chart and t
| `persistence.accessMode` | PVC Access Mode for Moodle volume | `ReadWriteOnce` |
| `persistence.size` | PVC Storage Request for Moodle volume | `8Gi` |
| `persistence.existingClaim` | If PVC exists&bounded for Moodle | `nil` (when nil, new one is requested) |
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` (uses alpha storage class annotation) |
| `allowEmptyPassword` | Allow DB blank passwords | `yes` |
| `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_moodle` |
| `externalDatabase.password` | Password for the above username | `nil` |
| `externalDatabase.database` | Name of the existing databse | `bitnami_moodle` |
| `mariadb.enabled` | Wheter to use or not the mariadb chart | `true` |
| `mariadb.mariadbDatabase` | Database name to create | `bitnami_moodle` |
| `mariadb.mariadbUser` | Database user to create | `bn_moodle` |
| `mariadb.mariadbPassword` | Password for the database | `nil` |
| `mariadb.mariadbRootPassword` | 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` |
+2 -2
View File
@@ -2,5 +2,5 @@ dependencies:
- name: mariadb
repository: https://kubernetes-charts.storage.googleapis.com/
version: 0.7.0
digest: sha256:e1af13ac4ac21f67582006f12d2b4eb78a1a2a59b34338fac850f2bec0b08b41
generated: 2017-08-09T22:52:52.983181778-04:00
digest: sha256:f59f68030aa5c50b9e776b813804875fac911f91c2aa384e991f37a795c5ae34
generated: 2018-03-15T13:58:06.682767+01:00
+1
View File
@@ -2,3 +2,4 @@ dependencies:
- name: mariadb
version: 0.7.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: mariadb.enabled
+17
View File
@@ -1,4 +1,5 @@
{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}}
** Please be patient while the chart is being deployed **
{{- if and .Values.ingress.enabled (ne .Values.serviceType "ClusterIP") }}
** Notice : Usually with ingress the serviceType should be set to ClusterIP, which is not the case to this deployment! **
@@ -39,3 +40,19 @@
echo Username: {{ .Values.moodleUsername }}
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "moodle.fullname" . }} -o jsonpath="{.data.moodle-password}" | base64 --decode)
{{- else -}}
########################################################################################
### ERROR: You did not provide an external database host in your 'helm install' call ###
########################################################################################
This deployment will be incomplete until you configure Moodle with a resolvable database
host. To configure Moodle to use and external database host:
1. Complete your Moodle deployment by running:
helm upgrade {{ .Release.Name }} --set serviceType={{ .Values.serviceType }},mariadb.enabled=false,externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST stable/moodle
{{- end }}
+24 -2
View File
@@ -22,15 +22,37 @@ spec:
image: "{{ .Values.image }}"
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
env:
- name: ALLOW_EMPTY_PASSWORD
value: {{ .Values.allowEmptyPassword | quote }}
{{- if .Values.mariadb.enabled }}
- name: MARIADB_HOST
value: {{ template "moodle.mariadb.fullname" . }}
- name: MARIADB_PORT_NUMBER
value: "3306"
- name: MARIADB_PASSWORD
- name: MOODLE_DATABASE_NAME
value: {{ .Values.mariadb.mariadbDatabase | quote }}
- name: MOODLE_DATABASE_USER
value: {{ .Values.mariadb.mariadbUser | quote }}
- name: MOODLE_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ template "moodle.mariadb.fullname" . }}
key: mariadb-root-password
key: mariadb-password
{{- else }}
- name: MARIADB_HOST
value: {{ .Values.externalDatabase.host | quote }}
- name: MARIADB_PORT_NUMBER
value: {{ .Values.externalDatabase.port | quote }}
- name: MOODLE_DATABASE_NAME
value: {{ .Values.externalDatabase.database | quote }}
- name: MOODLE_DATABASE_USER
value: {{ .Values.externalDatabase.user | quote }}
- name: MOODLE_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
key: db-password
{{- end }}
- name: MOODLE_USERNAME
value: {{ default "" .Values.moodleUsername | quote }}
- name: MOODLE_PASSWORD
@@ -0,0 +1,14 @@
{{- if not .Values.mariadb.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
labels:
app: {{ printf "%s-%s" .Release.Name "externaldb" }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
type: Opaque
data:
db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }}
{{- end }}
+42 -1
View File
@@ -1,7 +1,7 @@
## Bitnami Moodle` image version
## ref: https://hub.docker.com/r/bitnami/moodle/tags/
##
image: bitnami/moodle:3.4.1-r3
image: bitnami/moodle:3.4.1-r4
## Specify a imagePullPolicy
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -24,6 +24,29 @@ moodleUsername: user
## ref: https://github.com/bitnami/bitnami-docker-moodle#configuration
moodleEmail: user@example.com
## Set to `yes` to allow the container to be started with blank passwords
## ref: https://github.com/bitnami/bitnami-docker-moodle#environment-variables
allowEmptyPassword: "yes"
##
## External database configuration
##
externalDatabase:
## Database host
host:
## Database host
port: 3306
## Database user
user: bn_moodle
## Database password
password:
## Database name
database: bitnami_moodle
## SMTP mail delivery configuration
## ref: https://github.com/bitnami/bitnami-docker-moodle/#smtp-configuration
# smtpHost:
@@ -36,6 +59,24 @@ moodleEmail: user@example.com
## MariaDB chart configuration
##
mariadb:
## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters
enabled: true
## Create a database
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-on-first-run
##
mariadbDatabase: bitnami_moodle
## Create a database user
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
##
mariadbUser: bn_moodle
## Password for mariadbUser
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
##
# mariadbPassword:
## MariaDB admin password
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run
##