Skip to content

Commit 379bdd2

Browse files
tompizmork8s-ci-robot
authored andcommitted
[stable/mediawiki] allow use of external database (helm#2814)
* Allow MediaWiki helm chart to use an existing database * Add missing env var * Fix typo * Refactor properties to configure external database * Update dependencies * Avoid exposing the database password for external database setup * Add Sameer feedback * More feedback * Fix lint error
1 parent 235d6bd commit 379bdd2

File tree

8 files changed

+127
-15
lines changed

8 files changed

+127
-15
lines changed

stable/mediawiki/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: mediawiki
2-
version: 0.5.2
2+
version: 0.6.0
33
appVersion: 1.29.2
44
description: Extremely powerful, scalable software and a feature-rich wiki implementation
55
that uses PHP to process and display data stored in a database.

stable/mediawiki/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,24 @@ The following tables lists the configurable parameters of the MediaWiki chart an
5353
| `mediawikiPassword` | Application password | _random 10 character long alphanumeric string_ |
5454
| `mediawikiEmail` | Admin email | `user@example.com` |
5555
| `mediawikiName` | Name for the wiki | `My Wiki` |
56+
| `allowEmptyPassword` | Allow DB blank passwords | `yes` |
5657
| `smtpHost` | SMTP host | `nil` |
5758
| `smtpPort` | SMTP port | `nil` |
5859
| `smtpHostID` | SMTP host ID | `nil` |
5960
| `smtpUser` | SMTP user | `nil` |
6061
| `smtpPassword` | SMTP password | `nil` |
62+
| `externalDatabase.host` | Host of the external database | `nil` |
63+
| `externalDatabase.user` | Existing username in the external db | `bn_mediawiki` |
64+
| `externalDatabase.password` | Password for the above username | `nil` |
65+
| `externalDatabase.database` | Name of the existing databse | `bitnami_mediawiki` |
66+
| `mariadb.enabled` | Use or not the mariadb chart | `true` |
6167
| `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` |
68+
| `mariadb.mariadbDatabase` | Database name to create | `bitnami_mediawiki` |
69+
| `mariadb.mariadbUser` | Database user to create | `bn_mediawiki` |
70+
| `mariadb.mariadbPassword` | Password for the database | _random 10 character long alphanumeric string_ |
6271
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
6372
| `persistence.enabled` | Enable persistence using PVC | `true` |
64-
| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `nil` (uses alpha storage class annotation) |
73+
| `persistence.apache.storageClass` | PVC Storage Class for Apache volume | `nil` (uses alpha storage class annotation) |
6574
| `persistence.apache.accessMode` | PVC Access Mode for Apache volume | `ReadWriteOnce` |
6675
| `persistence.apache.size` | PVC Storage Request for Apache volume | `1Gi` |
6776
| `persistence.mediawiki.storageClass` | PVC Storage Class for MediaWiki volume | `nil` (uses alpha storage class annotation) |

stable/mediawiki/requirements.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ dependencies:
22
- name: mariadb
33
repository: https://kubernetes-charts.storage.googleapis.com/
44
version: 0.7.0
5-
digest: sha256:e1af13ac4ac21f67582006f12d2b4eb78a1a2a59b34338fac850f2bec0b08b41
6-
generated: 2017-08-09T22:52:52.151221478-04:00
5+
digest: sha256:f59f68030aa5c50b9e776b813804875fac911f91c2aa384e991f37a795c5ae34
6+
generated: 2017-12-05T17:16:36.715765+01:00

stable/mediawiki/requirements.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dependencies:
22
- name: mariadb
33
version: 0.7.0
44
repository: https://kubernetes-charts.storage.googleapis.com/
5+
condition: mariadb.enabled

stable/mediawiki/templates/NOTES.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}}
12

23
1. Get the MediaWiki URL by running:
34

@@ -25,3 +26,19 @@
2526

2627
echo Username: {{ .Values.mediawikiUser }}
2728
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mediawiki.fullname" . }} -o jsonpath="{.data.mediawiki-password}" | base64 --decode)
29+
30+
{{- else -}}
31+
32+
########################################################################################
33+
### ERROR: You did not provide an external database host in your 'helm install' call ###
34+
########################################################################################
35+
36+
This deployment will be incomplete until you configure MediaWiki with a resolvable database
37+
host. To configure MediaWiki to use and external database host:
38+
39+
40+
1. Complete your MediaWiki deployment by running:
41+
42+
helm upgrade {{ .Release.Name }} --set serviceType={{ .Values.serviceType }},mariadb.enabled=false,externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST stable/mediawiki
43+
44+
{{- end}}

stable/mediawiki/templates/deployment.yaml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if or .Values.mariadb.enabled .Values.externalDatabase.host -}}
12
apiVersion: extensions/v1beta1
23
kind: Deployment
34
metadata:
@@ -17,36 +18,63 @@ spec:
1718
containers:
1819
- name: {{ template "mediawiki.fullname" . }}
1920
image: "{{ .Values.image }}"
20-
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
21+
imagePullPolicy: {{ .Values.imagePullPolicy | quote }}
2122
env:
23+
- name: ALLOW_EMPTY_PASSWORD
24+
value: {{ .Values.allowEmptyPassword | quote }}
2225
- name: MARIADB_HOST
26+
{{- if .Values.mariadb.enabled }}
2327
value: {{ template "mediawiki.mariadb.fullname" . }}
28+
{{- else }}
29+
value: {{ .Values.externalDatabase.host | quote }}
30+
{{- end }}
2431
- name: MARIADB_PORT_NUMBER
32+
{{- if .Values.mariadb.enabled }}
2533
value: "3306"
26-
- name: MARIADB_PASSWORD
34+
{{ else }}
35+
value: {{ .Values.externalDatabase.port | quote }}
36+
{{ end }}
37+
- name: MEDIAWIKI_DATABASE_NAME
38+
{{- if .Values.mariadb.enabled }}
39+
value: {{ .Values.mariadb.mariadbDatabase | quote }}
40+
{{- else }}
41+
value: {{ .Values.externalDatabase.database | quote }}
42+
{{- end }}
43+
- name: MEDIAWIKI_DATABASE_USER
44+
{{- if .Values.mariadb.enabled }}
45+
value: {{ .Values.mariadb.mariadbUser | quote }}
46+
{{- else }}
47+
value: {{ .Values.externalDatabase.user | quote }}
48+
{{- end }}
49+
- name: MEDIAWIKI_DATABASE_PASSWORD
2750
valueFrom:
2851
secretKeyRef:
52+
{{- if .Values.mariadb.enabled }}
2953
name: {{ template "mediawiki.mariadb.fullname" . }}
30-
key: mariadb-root-password
54+
key: mariadb-password
55+
{{- else }}
56+
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
57+
key: db-password
58+
{{- end }}
3159
- name: MEDIAWIKI_USERNAME
32-
value: {{ default "" .Values.mediawikiUser | quote }}
60+
value: {{ .Values.mediawikiUser | quote }}
3361
- name: MEDIAWIKI_PASSWORD
3462
valueFrom:
3563
secretKeyRef:
3664
name: {{ template "mediawiki.fullname" . }}
3765
key: mediawiki-password
3866
- name: MEDIAWIKI_EMAIL
39-
value: {{ default "" .Values.mediawikiEmail | quote }}
67+
value: {{ .Values.mediawikiEmail | quote }}
4068
- name: MEDIAWIKI_WIKI_NAME
41-
value: {{ default "" .Values.mediawikiName | quote }}
69+
value: {{ .Values.mediawikiName | quote }}
4270
- name: SMTP_HOST_ID
43-
value: {{ default "" .Values.smtpHostID | quote }}
71+
value: {{ .Values.smtpHostID | quote }}
4472
- name: SMTP_HOST
45-
value: {{ default "" .Values.smtpHost | quote }}
73+
value: {{ .Values.smtpHost | quote }}
4674
- name: SMTP_PORT
47-
value: {{ default "" .Values.smtpPort | quote }}
75+
value: {{ .Values.smtpPort | quote }}
4876
- name: SMTP_USER
49-
value: {{ default "" .Values.smtpUser | quote }}
77+
value: {{ .Values.smtpUser | quote }}
5078
- name: SMTP_PASSWORD
5179
valueFrom:
5280
secretKeyRef:
@@ -89,3 +117,4 @@ spec:
89117
{{- else }}
90118
emptyDir: {}
91119
{{- end }}
120+
{{- end }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if not .Values.mariadb.enabled }}
2+
apiVersion: v1
3+
kind: Secret
4+
metadata:
5+
name: {{ printf "%s-%s" .Release.Name "externaldb" }}
6+
labels:
7+
app: {{ printf "%s-%s" .Release.Name "externaldb" }}
8+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
9+
release: "{{ .Release.Name }}"
10+
heritage: "{{ .Release.Service }}"
11+
type: Opaque
12+
data:
13+
db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }}
14+
{{- end }}

stable/mediawiki/values.yaml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Bitnami MediaWiki image version
22
## ref: https://hub.docker.com/r/bitnami/mediawiki/tags/
33
##
4-
image: bitnami/mediawiki:1.29.2-r0
4+
image: bitnami/mediawiki:1.29.2-r1
55

66
## Specify a imagePullPolicy
77
## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent'
@@ -30,6 +30,10 @@ mediawikiEmail: user@example.com
3030
##
3131
mediawikiName: My Wiki
3232

33+
## Set to `yes` to allow the container to be started with blank passwords
34+
## ref: https://github.com/bitnami/bitnami-docker-mediawiki#environment-variables
35+
allowEmptyPassword: "yes"
36+
3337
## SMTP mail delivery configuration
3438
## ref: https://github.com/bitnami/bitnami-docker-mediawiki#smtp-configuration
3539
##
@@ -39,15 +43,53 @@ mediawikiName: My Wiki
3943
# smtpUser:
4044
# smtpPassword:
4145

46+
##
47+
## External database configuration
48+
##
49+
externalDatabase:
50+
## Database host
51+
host:
52+
53+
## Database port
54+
port: 3306
55+
56+
## Database user
57+
user: bn_mediawiki
58+
59+
## Database password
60+
password:
61+
62+
## Database name
63+
database: bitnami_mediawiki
64+
65+
4266
##
4367
## MariaDB chart configuration
4468
##
4569
mariadb:
70+
## 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
71+
enabled: true
72+
4673
## MariaDB admin password
4774
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run
4875
##
4976
# mariadbRootPassword:
5077

78+
## Create a database
79+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-on-first-run
80+
##
81+
mariadbDatabase: bitnami_mediawiki
82+
83+
## Create a database user
84+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
85+
##
86+
mariadbUser: bn_mediawiki
87+
88+
## Password for mariadbUser
89+
## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run
90+
##
91+
# mariadbPassword:
92+
5193
## Enable persistence using Persistent Volume Claims
5294
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
5395
##

0 commit comments

Comments
 (0)