mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/mariadb] Add support to existing configMaps as init scripts (#10338)
Signed-off-by: juan131 <juan@bitnami.com>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
f7e5f0a3fa
commit
96e19d643e
@@ -1,5 +1,5 @@
|
||||
name: mariadb
|
||||
version: 5.2.6
|
||||
version: 5.3.0
|
||||
appVersion: 10.1.37
|
||||
description: Fast, reliable, scalable, and easy to use open-source relational database system. MariaDB Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software. Highly available MariaDB cluster.
|
||||
keywords:
|
||||
|
||||
@@ -70,6 +70,8 @@ The following table lists the configurable parameters of the MariaDB chart and t
|
||||
| `replication.enabled` | MariaDB replication enabled | `true` |
|
||||
| `replication.user` | MariaDB replication user | `replicator` |
|
||||
| `replication.password` | MariaDB replication user password | _random 10 character alphanumeric string_ |
|
||||
| `initdbScripts` | List of initdb scripts | `nil` |
|
||||
| `initdbScriptsConfigMap` | ConfigMap with the initdb scripts (Note: Overrides `initdbScripts`) | `nil` |
|
||||
| `master.annotations[].key` | key for the the annotation list item | `nil` |
|
||||
| `master.annotations[].value` | value for the the annotation list item | `nil` |
|
||||
| `master.affinity` | Master affinity (in addition to master.antiAffinity when set) | `{}` |
|
||||
@@ -152,6 +154,10 @@ $ helm install --name my-release -f values.yaml stable/mariadb
|
||||
|
||||
The [Bitnami MariaDB](https://github.com/bitnami/bitnami-docker-mariadb) image allows you to use your custom scripts to initialize a fresh instance. In order to execute the scripts, they must be located inside the chart folder `files/docker-entrypoint-initdb.d` so they can be consumed as a ConfigMap.
|
||||
|
||||
Alternatively, you can specify custom scripts using the `initdbScripts` parameter as dict.
|
||||
|
||||
In addition to these options, you can also set an external ConfigMap with all the initialization scripts. This is done by setting the `initdbScriptsConfigMap` parameter. Note that this will override the two previous options.
|
||||
|
||||
The allowed extensions are `.sh`, `.sql` and `.sql.gz`.
|
||||
|
||||
## Persistence
|
||||
|
||||
@@ -63,3 +63,15 @@ Return the proper metrics image name
|
||||
{{- $tag := .Values.metrics.image.tag | toString -}}
|
||||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ template "mariadb.initdbScriptsCM" . }}
|
||||
{{/*
|
||||
Get the initialization scripts ConfigMap name.
|
||||
*/}}
|
||||
{{- define "mariadb.initdbScriptsCM" -}}
|
||||
{{- if .Values.initdbScriptsConfigMap -}}
|
||||
{{- printf "%s" .Values.initdbScriptsConfigMap -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-init-scripts" (include "mariadb.fullname" .) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
{{ 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 "master.fullname" . }}-init-scripts
|
||||
labels:
|
||||
app: {{ template "mariadb.name" . }}
|
||||
component: "master"
|
||||
chart: {{ template "mariadb.chart" . }}
|
||||
release: {{ .Release.Name | quote }}
|
||||
heritage: {{ .Release.Service | quote }}
|
||||
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 }}
|
||||
|
||||
@@ -143,7 +143,7 @@ spec:
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /bitnami/mariadb
|
||||
{{- 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 }}
|
||||
@@ -196,10 +196,10 @@ spec:
|
||||
configMap:
|
||||
name: {{ template "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 "master.fullname" . }}-init-scripts
|
||||
name: {{ template "mariadb.initdbScriptsCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.master.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
|
||||
@@ -94,6 +94,19 @@ replication:
|
||||
## If it is not force, a random password will be generated.
|
||||
forcePassword: true
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionnary 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:
|
||||
## Mariadb Master additional pod annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||
|
||||
@@ -94,6 +94,19 @@ replication:
|
||||
## If it is not force, a random password will be generated.
|
||||
forcePassword: false
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionnary 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:
|
||||
## Mariadb Master additional pod annotations
|
||||
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/
|
||||
|
||||
Reference in New Issue
Block a user