diff --git a/base-defaultconfig/init.sh b/base-defaultconfig/init.sh index 00b1b00..9572875 100644 --- a/base-defaultconfig/init.sh +++ b/base-defaultconfig/init.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -x +set -exo pipefail [ "$(pwd)" != "/etc/mysql/conf.d" ] && cp * /etc/mysql/conf.d/ HOST_ID=${HOSTNAME##*-} @@ -32,8 +32,8 @@ function wsrepForceBootstrap { if [ $HOST_ID -eq 0 ]; then echo "This is the 1st statefulset pod. Checking if the statefulset is down ..." - getent hosts mariadb-ready - [ $? -eq 2 ] && { + GETENT_EXIT=0; getent hosts mariadb-ready || GETENT_EXIT="$?" + [ $GETENT_EXIT -eq 2 ] && { # https://github.com/docker-library/mariadb/commit/f76084f0f9dc13f29cce48c727440eb79b4e92fa#diff-b0fa4b30392406b32de6b8ffe36e290dR80 if [ ! -d "$DATADIR/mysql" ]; then echo "No database in $DATADIR; configuring $POD_NAME for initial start" @@ -93,4 +93,4 @@ else fi # https://github.com/docker-library/mariadb/blob/master/10.2/docker-entrypoint.sh#L62 -mysqld --verbose --help --log-bin-index="$(mktemp -u)" | tee /tmp/mariadb-start-config | grep -e ^version -e ^datadir -e ^wsrep -e ^binlog -e ^character-set -e ^collation +mysqld --verbose --help --log-bin-index="$(mktemp -u)" 2>&1 | tee /tmp/mariadb-start-config | grep -e ^version -e ^datadir -e ^wsrep -e ^binlog -e ^character-set -e ^collation diff --git a/base/kustomization.yaml b/base/kustomization.yaml index 387cd35..b71a1d6 100644 --- a/base/kustomization.yaml +++ b/base/kustomization.yaml @@ -1,3 +1,4 @@ +# yaml-language-server: $schema=https://json.schemastore.org/kustomization.json apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization @@ -6,3 +7,9 @@ resources: - mariadb-ready-service.yaml - mysql-service.yaml - mariadb-statefulset.yaml + +images: +- name: mariadb + newTag: 10.11.7-jammy@sha256:f94bd863dc16bf7b44957586d0c325462d4a65598d04ab952a9b73120a259b21 +- name: prom/mysqld-exporter + newTag: v0.14.0@sha256:eb6fe170738bf9181c51f5bc89f93adb26672ec49ffdcb22f55c24834003b45d diff --git a/base/mariadb-statefulset.yaml b/base/mariadb-statefulset.yaml index 58ad66b..c78c140 100644 --- a/base/mariadb-statefulset.yaml +++ b/base/mariadb-statefulset.yaml @@ -47,10 +47,10 @@ spec: mountPath: /etc/mysql/conf.d - name: initdb mountPath: /docker-entrypoint-initdb.d - image: mariadb:10.5.19-focal@sha256:ce75a36261b12948b411f6debb71254d92889c8a06e2ebc34c761f90416b1024 + image: mariadb containers: - name: mariadb - image: mariadb:10.5.19-focal@sha256:ce75a36261b12948b411f6debb71254d92889c8a06e2ebc34c761f90416b1024 + image: mariadb ports: - containerPort: 3306 name: mysql @@ -85,7 +85,7 @@ spec: - name: initdb mountPath: /docker-entrypoint-initdb.d - name: metrics - image: prom/mysqld-exporter:v0.14.0@sha256:eb6fe170738bf9181c51f5bc89f93adb26672ec49ffdcb22f55c24834003b45d + image: prom/mysqld-exporter env: - name: DATA_SOURCE_NAME # https://github.com/prometheus/mysqld_exporter#required-grants