diff --git a/bitnami/mariadb-galera/10.2/debian-10/Dockerfile b/bitnami/mariadb-galera/10.2/debian-10/Dockerfile index 4a1377b799f4..2e57633057f4 100644 --- a/bitnami/mariadb-galera/10.2/debian-10/Dockerfile +++ b/bitnami/mariadb-galera/10.2/debian-10/Dockerfile @@ -18,7 +18,7 @@ RUN mkdir /docker-entrypoint-initdb.d COPY rootfs / RUN /opt/bitnami/scripts/mariadb-galera/postunpack.sh ENV BITNAMI_APP_NAME="mariadb-galera" \ - BITNAMI_IMAGE_VERSION="10.2.41-debian-10-r24" \ + BITNAMI_IMAGE_VERSION="10.2.41-debian-10-r25" \ PATH="/opt/bitnami/common/bin:/opt/bitnami/mariadb/bin:/opt/bitnami/mariadb/sbin:$PATH" EXPOSE 3306 4444 4567 4568 diff --git a/bitnami/mariadb-galera/10.2/debian-10/rootfs/opt/bitnami/scripts/libmariadbgalera.sh b/bitnami/mariadb-galera/10.2/debian-10/rootfs/opt/bitnami/scripts/libmariadbgalera.sh index 92bb0ce4b032..e9a00e9bf729 100644 --- a/bitnami/mariadb-galera/10.2/debian-10/rootfs/opt/bitnami/scripts/libmariadbgalera.sh +++ b/bitnami/mariadb-galera/10.2/debian-10/rootfs/opt/bitnami/scripts/libmariadbgalera.sh @@ -138,15 +138,13 @@ should_bootstrap_implicitly() { # None ######################### has_galera_cluster_other_nodes() { - # - This function works on a best-effort basis and only works reliably with Kubernetes pods. - # - We are using `getent hosts` to check for the availability of other hosts, but this may not work when the hosts are defined as IP addresses. - # In some environments, there may be no reverse DNS lookup for IPs, so this function may wrongly return "no". - # It should work fine if the hosts are defined as hostnames of Services (usually of a StatefulSet) inside a Kubernetes environment. + local local_ip node_ip cluster_address address has_nodes - local local_ip - local node_ip - local cluster_address - local has_nodes + hostname_has_ips() { + local hostname="${1:?hostname is required}" + [[ "$(getent ahosts "$hostname")" != "" ]] && return 0 + return 1 + } has_nodes="yes" cluster_address="$DB_GALERA_CLUSTER_ADDRESS" @@ -160,7 +158,8 @@ has_galera_cluster_other_nodes() { if validate_ipv4 "$(echo "${addresses[0]}" | cut -d':' -f1)"; then has_nodes="yes" else - if is_hostname_resolved "$(echo "${addresses[0]}" | cut -d':' -f1)"; then + address="$(echo "${addresses[0]}" | cut -d':' -f1)" + if retry_while "hostname_has_ips $address"; then has_nodes="yes" else has_nodes="no" @@ -174,7 +173,9 @@ has_galera_cluster_other_nodes() { if validate_ipv4 "$address"; then node_ip="$address" else - is_hostname_resolved "$address" && node_ip="$(dns_lookup "$address")" + if retry_while "hostname_has_ips $address"; then + node_ip="$(dns_lookup "$address")" + fi fi if [[ -n "$node_ip" ]] && [[ "$node_ip" != "$local_ip" ]]; then has_nodes="yes" diff --git a/bitnami/mariadb-galera/README.md b/bitnami/mariadb-galera/README.md index 562b1224fecd..8dd70d4962f4 100644 --- a/bitnami/mariadb-galera/README.md +++ b/bitnami/mariadb-galera/README.md @@ -57,7 +57,7 @@ Learn more about the Bitnami tagging policy and the difference between rolling t * [`10.5`, `10.5-debian-10`, `10.5.13`, `10.5.13-debian-10-r24` (10.5/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mariadb-galera/blob/10.5.13-debian-10-r24/10.5/debian-10/Dockerfile) * [`10.4`, `10.4-debian-10`, `10.4.22`, `10.4.22-debian-10-r24` (10.4/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mariadb-galera/blob/10.4.22-debian-10-r24/10.4/debian-10/Dockerfile) * [`10.3`, `10.3-debian-10`, `10.3.32`, `10.3.32-debian-10-r24` (10.3/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mariadb-galera/blob/10.3.32-debian-10-r24/10.3/debian-10/Dockerfile) -* [`10.2`, `10.2-debian-10`, `10.2.41`, `10.2.41-debian-10-r24` (10.2/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mariadb-galera/blob/10.2.41-debian-10-r24/10.2/debian-10/Dockerfile) +* [`10.2`, `10.2-debian-10`, `10.2.41`, `10.2.41-debian-10-r25` (10.2/debian-10/Dockerfile)](https://github.com/bitnami/bitnami-docker-mariadb-galera/blob/10.2.41-debian-10-r25/10.2/debian-10/Dockerfile) Subscribe to project updates by watching the [bitnami/mariadb-galera GitHub repo](https://github.com/bitnami/bitnami-docker-mariadb-galera).