forked from easzlab/kubeasz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
2,093 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: mariadb | ||
version: 5.5.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: | ||
- mariadb | ||
- mysql | ||
- database | ||
- sql | ||
- prometheus | ||
home: https://mariadb.org | ||
icon: https://bitnami.com/assets/stacks/mariadb/img/mariadb-stack-220x234.png | ||
sources: | ||
- https://github.com/bitnami/bitnami-docker-mariadb | ||
- https://github.com/prometheus/mysqld_exporter | ||
maintainers: | ||
- name: Bitnami | ||
email: [email protected] | ||
engine: gotpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
approvers: | ||
- prydonius | ||
- tompizmor | ||
- sameersbn | ||
- carrodher | ||
- juan131 | ||
reviewers: | ||
- prydonius | ||
- tompizmor | ||
- sameersbn | ||
- carrodher | ||
- juan131 |
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
manifests/mariadb-cluster/mariadb/files/docker-entrypoint-initdb.d/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
You can copy here your custom .sh, .sql or .sql.gz file so they are executed during the first boot of the image. | ||
|
||
More info in the [bitnami-docker-mariadb](https://github.com/bitnami/bitnami-docker-mariadb#initializing-a-new-instance) repository. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
Please be patient while the chart is being deployed | ||
|
||
Tip: | ||
|
||
Watch the deployment status using the command: kubectl get pods -w --namespace {{ .Release.Namespace }} -l release={{ .Release.Name }} | ||
|
||
Services: | ||
|
||
echo Master: {{ template "mariadb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} | ||
{{- if .Values.replication.enabled }} | ||
echo Slave: {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.port }} | ||
{{- end }} | ||
|
||
Administrator credentials: | ||
|
||
Username: root | ||
Password : $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) | ||
|
||
To connect to your database: | ||
|
||
1. Run a pod that you can use as a client: | ||
|
||
kubectl run {{ template "mariadb.fullname" . }}-client --rm --tty -i --restart='Never' --image {{ template "mariadb.image" . }} --namespace {{ .Release.Namespace }} --command -- bash | ||
|
||
2. To connect to master service (read/write): | ||
|
||
mysql -h {{ template "mariadb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }} | ||
|
||
{{- if .Values.replication.enabled }} | ||
|
||
3. To connect to slave service (read-only): | ||
|
||
mysql -h {{ template "slave.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local -uroot -p {{ .Values.db.name }} | ||
{{- end }} | ||
|
||
To upgrade this helm chart: | ||
|
||
1. Obtain the password as described on the 'Administrator credentials' section and set the 'rootUser.password' parameter as shown below: | ||
|
||
ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mariadb.fullname" . }} -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) | ||
helm upgrade {{ .Release.Name }} stable/mariadb --set rootUser.password=$ROOT_PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "mariadb.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "mariadb.fullname" -}} | ||
{{- if .Values.fullnameOverride -}} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- $name := default .Chart.Name .Values.nameOverride -}} | ||
{{- if contains $name .Release.Name -}} | ||
{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "master.fullname" -}} | ||
{{- if .Values.replication.enabled -}} | ||
{{- printf "%s-%s" .Release.Name "mariadb-master" | trunc 63 | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s-%s" .Release.Name "mariadb" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "slave.fullname" -}} | ||
{{- printf "%s-%s" .Release.Name "mariadb-slave" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{- define "mariadb.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper MariaDB image name | ||
*/}} | ||
{{- define "mariadb.image" -}} | ||
{{- $registryName := .Values.image.registry -}} | ||
{{- $repositoryName := .Values.image.repository -}} | ||
{{- $tag := .Values.image.tag | toString -}} | ||
{{/* | ||
Helm 2.11 supports the assignment of a value to a variable defined in a different scope, | ||
but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. | ||
Also, we can't use a single if because lazy evaluation is not an option | ||
*/}} | ||
{{- if .Values.global }} | ||
{{- if .Values.global.imageRegistry }} | ||
{{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} | ||
{{- else -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Return the proper metrics image name | ||
*/}} | ||
{{- define "metrics.image" -}} | ||
{{- $registryName := .Values.metrics.image.registry -}} | ||
{{- $repositoryName := .Values.metrics.image.repository -}} | ||
{{- $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 -}} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "mariadb.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create -}} | ||
{{ default (include "mariadb.fullname" .) .Values.serviceAccount.name }} | ||
{{- else -}} | ||
{{ default "default" .Values.serviceAccount.name }} | ||
{{- end -}} | ||
{{- end -}} |
26 changes: 26 additions & 0 deletions
26
manifests/mariadb-cluster/mariadb/templates/initialization-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{{- 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" . }} | ||
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 }} |
15 changes: 15 additions & 0 deletions
15
manifests/mariadb-cluster/mariadb/templates/master-configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if .Values.master.config }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "master.fullname" . }} | ||
labels: | ||
app: {{ template "mariadb.name" . }} | ||
component: "master" | ||
chart: {{ template "mariadb.chart" . }} | ||
release: {{ .Release.Name | quote }} | ||
heritage: {{ .Release.Service | quote }} | ||
data: | ||
my.cnf: |- | ||
{{ .Values.master.config | indent 4 }} | ||
{{- end -}} |
Oops, something went wrong.