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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 40 additions and 5 deletions

View File

@ -24,7 +24,7 @@ sources:
- https://github.com/prometheus/mysqld_exporter
- https://mariadb.org
type: application
version: 2.0.7
version: 2.0.8
annotations:
truecharts.org/catagories: |
- database

View File

@ -62,7 +62,7 @@ probes:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
- "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
# -- Redainess probe configuration
# @default -- See below
@ -79,7 +79,7 @@ probes:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
- "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
# -- Startup probe configuration
# @default -- See below
startup:
@ -94,7 +94,7 @@ probes:
command:
- /bin/bash
- -ec
- mysqladmin status -uroot -p"${MARIADB_ROOT_PASSWORD}"
- "until /opt/bitnami/scripts/mariadb/healthcheck.sh; do sleep 2; done"
mariadbPassword: "testpass"
mariadbUsername: "test"

View File

@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 9.1.8
version: 9.1.9

View File

@ -53,6 +53,7 @@ initContainers:
{{- include "common.controller.autopermissions" . | nindent 2 }}
{{- include "common.controller.hostpatch" . | nindent 2 }}
{{- include "common.dependencies.postgresql.init" . | nindent 2 }}
{{- include "common.dependencies.mariadb.init" . | nindent 2 }}
{{- if .Release.IsInstall }}
{{- if .Values.installContainers }}
{{- $installContainers := list }}

View File

@ -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 -}}