Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bitnami/mysql/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 2 additions & 0 deletions bitnami/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `{}` |
Expand Down
12 changes: 12 additions & 0 deletions bitnami/mysql/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/}}
Expand Down
9 changes: 8 additions & 1 deletion bitnami/mysql/templates/initialization-configmap.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
6 changes: 3 additions & 3 deletions bitnami/mysql/templates/master-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions bitnami/mysql/values-production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 13 additions & 0 deletions bitnami/mysql/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down