fix(mariadb): Wait for init (#2226)

* fix(mariadb): Wait for init

* check until..

* also on standalone app

* use correct host on init container

* single space
This commit is contained in:
Stavros Kois
2022-03-21 00:56:33 +02:00
committed by GitHub
parent 5d19df6663
commit f2aa31d365
5 changed files with 40 additions and 5 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ sources:
- https://github.com/prometheus/mysqld_exporter - https://github.com/prometheus/mysqld_exporter
- https://mariadb.org - https://mariadb.org
type: application type: application
version: 2.0.7 version: 2.0.8
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- database - database
+3 -3
View File
@@ -62,7 +62,7 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}" - "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
# -- Redainess probe configuration # -- Redainess probe configuration
# @default -- See below # @default -- See below
@@ -79,7 +79,7 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}" - "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
# -- Startup probe configuration # -- Startup probe configuration
# @default -- See below # @default -- See below
startup: startup:
@@ -94,7 +94,7 @@ probes:
command: command:
- /bin/bash - /bin/bash
- -ec - -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}" - "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
mariadbPassword: "testpass" mariadbPassword: "testpass"
mariadbUsername: "test" mariadbUsername: "test"
+1 -1
View File
@@ -15,4 +15,4 @@ maintainers:
name: common name: common
sources: null sources: null
type: library type: library
version: 9.1.8 version: 9.1.9
@@ -53,6 +53,7 @@ initContainers:
{{- include "common.controller.autopermissions" . | nindent 2 }} {{- include "common.controller.autopermissions" . | nindent 2 }}
{{- include "common.controller.hostpatch" . | nindent 2 }} {{- include "common.controller.hostpatch" . | nindent 2 }}
{{- include "common.dependencies.postgresql.init" . | nindent 2 }} {{- include "common.dependencies.postgresql.init" . | nindent 2 }}
{{- include "common.dependencies.mariadb.init" . | nindent 2 }}
{{- if .Release.IsInstall }} {{- if .Release.IsInstall }}
{{- if .Values.installContainers }} {{- if .Values.installContainers }}
{{- $installContainers := list }} {{- $installContainers := list }}
@@ -0,0 +1,34 @@
{{/*
This template ensures pods with postgresql dependency have a delayed start
*/}}
{{- define "common.dependencies.mariadb.init" -}}
{{- $pghost := printf "%v-%v" .Release.Name "mariadb" }}
{{- if .Values.mariadb.enabled }}
- name: mariadb-init
image: "{{ .Values.mariadblImage.repository}}:{{ .Values.mariadblImage.tag }}"
env:
- name: MARIADB_HOST
valueFrom:
secretKeyRef:
name: mariadbcreds
key: plainhost
- name: MARIADB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mariadbcreds
key: mariadb-root-password
securityContext:
capabilities:
drop:
- ALL
resources:
{{- with .Values.resources }}
{{- toYaml . | nindent 4 }}
{{- end }}
command:
- "bash"
- "-ec"
- "until mysqladmin -uroot -h"${MARIADB_HOST}" -p"${MARIADB_ROOT_PASSWORD}" ping && mysqladmin -uroot -h"${MARIADB_HOST}" -p"${MARIADB_ROOT_PASSWORD}" status; do sleep 2; done"
imagePullPolicy: IfNotPresent
{{- end }}
{{- end -}}