[bitnami/mysql] Match init script support to bitnami/mariadb (#1947)

* Updates to mysql chart to have equivalent init script support to mariadb chart

* Updated README with new init script variables

Co-authored-by: Marcos Bjoerkelund <marcosbc@users.noreply.github.com>
This commit is contained in:
OmriHarary
2020-02-19 11:00:10 +01:00
committed by GitHub
co-authored by Marcos Bjoerkelund
parent 1fa6eb9f56
commit fbd69f5ffd
7 changed files with 52 additions and 5 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
apiVersion: v1
name: mysql
version: 6.8.1
version: 6.9.0
appVersion: 8.0.19
description: Chart to create a Highly available MySQL cluster
keywords:
+2
View File
@@ -82,6 +82,8 @@ The following tables lists the configurable parameters of the MySQL chart and th
| `replication.password` | MySQL replication user password | _random 10 character alphanumeric string_ |
| `replication.forcePassword` | Force users to specify a password. That is required for 'helm upgrade' to work properly | `false` |
| `replication.injectSecretsAsVolume` | Mount user password as a file instead of using an environment variable | `false` |
| `initdbScripts` | Dictionary of initdb scripts | `nil` |
| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` |
| `master.config` | Config file for the MySQL Master server | `_default values in the values.yaml file_` |
| `master.updateStrategy.type` | Master statefulset update strategy policy | `RollingUpdate` |
| `master.podAnnotations` | Pod annotations for master nodes | `{}` |
+12
View File
@@ -94,6 +94,18 @@ Also, we can't use a single if because lazy evaluation is not an option
{{- end -}}
{{- end -}}
{{ template "mysql.initdbScriptsCM" . }}
{{/*
Get the initialization scripts ConfigMap name.
*/}}
{{- define "mysql.initdbScriptsCM" -}}
{{- if .Values.initdbScriptsConfigMap -}}
{{- printf "%s" .Values.initdbScriptsConfigMap -}}
{{- else -}}
{{- printf "%s-init-scripts" (include "mysql.master.fullname" .) -}}
{{- end -}}
{{- end -}}
{{/*
Return the proper MySQL metrics exporter image name
*/}}
@@ -1,15 +1,22 @@
{{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") }}
{{- if and (or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScripts) (not .Values.initdbScriptsConfigMap) }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "mysql.master.fullname" . }}-init-scripts
labels: {{- include "mysql.labels" . | nindent 4 }}
component: master
{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz") (not .Values.initdbScriptsConfigMap) }}
binaryData:
{{- $root := . }}
{{- range $path, $bytes := .Files.Glob "files/docker-entrypoint-initdb.d/*.sql.gz" }}
{{ base $path }}: {{ $root.Files.Get $path | b64enc | quote }}
{{- end }}
{{- end }}
data:
{{- if and (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}") (not .Values.initdbScriptsConfigMap) }}
{{ (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql}").AsConfig | indent 2 }}
{{- end }}
{{- with .Values.initdbScripts }}
{{ toYaml . | indent 2 }}
{{- end }}
{{- end }}
@@ -155,7 +155,7 @@ spec:
- name: data
{{- end }}
mountPath: {{ .Values.master.persistence.mountPath }}
{{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|sql|sql.gz]") }}
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
- name: custom-init-scripts
mountPath: /docker-entrypoint-initdb.d
{{- end }}
@@ -222,10 +222,10 @@ spec:
configMap:
name: {{ template "mysql.master.fullname" . }}
{{- end }}
{{- if (.Files.Glob "files/docker-entrypoint-initdb.d/*[sh|sql|sql.gz]") }}
{{- if or (.Files.Glob "files/docker-entrypoint-initdb.d/*.{sh,sql,sql.gz}") .Values.initdbScriptsConfigMap .Values.initdbScripts }}
- name: custom-init-scripts
configMap:
name: {{ template "mysql.master.fullname" . }}-init-scripts
name: {{ template "mysql.initdbScriptsCM" . }}
{{- end }}
{{- if or .Values.root.injectSecretsAsVolume .Values.db.injectSecretsAsVolume .Values.replication.injectSecretsAsVolume }}
- name: mysql-credentials
+13
View File
@@ -134,6 +134,19 @@ replication:
##
injectSecretsAsVolume: true
## initdb scripts
## Specify dictionary of scripts to be run at first boot
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
##
# initdbScripts:
# my_init_script.sh: |
# #!/bin/sh
# echo "Do something."
#
## ConfigMap with scripts to be run at first boot
## Note: This will override initdbScripts
# initdbScriptsConfigMap:
## Master nodes parameters
##
master:
+13
View File
@@ -138,6 +138,19 @@ replication:
##
injectSecretsAsVolume: false
## initdb scripts
## Specify dictionary of scripts to be run at first boot
## Alternatively, you can put your scripts under the files/docker-entrypoint-initdb.d directory
##
# initdbScripts:
# my_init_script.sh: |
# #!/bin/sh
# echo "Do something."
#
## ConfigMap with scripts to be run at first boot
## Note: This will override initdbScripts
# initdbScriptsConfigMap:
## Master nodes parameters
##
master: