From 072475a4a48bb3bbe5e7ecdeb97af23a8a71e890 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 09:30:11 +0100 Subject: [PATCH 1/9] [bitnami/redis] Fix issues in initializacion/restarts --- bitnami/redis/Chart.yaml | 2 +- bitnami/redis/README.md | 1 + .../redis/templates/configmap-scripts.yaml | 70 ++++++++++++++++++- bitnami/redis/values.yaml | 9 ++- 4 files changed, 78 insertions(+), 4 deletions(-) diff --git a/bitnami/redis/Chart.yaml b/bitnami/redis/Chart.yaml index 9b516023109a9d..b48e3b2150a95b 100644 --- a/bitnami/redis/Chart.yaml +++ b/bitnami/redis/Chart.yaml @@ -25,4 +25,4 @@ name: redis sources: - https://github.com/bitnami/bitnami-docker-redis - http://redis.io/ -version: 12.7.4 +version: 12.7.5 diff --git a/bitnami/redis/README.md b/bitnami/redis/README.md index f3f259b0a3d17d..40cecd6ec40801 100644 --- a/bitnami/redis/README.md +++ b/bitnami/redis/README.md @@ -258,6 +258,7 @@ The following table lists the configurable parameters of the RedisTM | `sentinel.failoverTimeout` | Timeout for performing a election failover | `18000` | | `sentinel.parallelSyncs` | Number of parallel syncs in the cluster | `1` | | `sentinel.port` | RedisTM Sentinel port | `26379` | +| `sentinel.cleanWait` | Seconds to wait when cleaning nodes IPs | `5` | | `sentinel.configmap` | Additional RedisTM configuration for the sentinel nodes (this value is evaluated as a template) | `nil` | | `sentinel.staticID` | Enable static IDs for sentinel replicas (If disabled IDs will be randomly generated on startup) | `false` | | `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` | diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index 4d8f7c6c3bdd53..d067123d657a78 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -12,6 +12,8 @@ data: {{- if and .Values.cluster.enabled .Values.sentinel.enabled }} start-node.sh: | #!/bin/bash + set -x + is_boolean_yes() { local -r bool="${1:-}" # comparison is performed without regard to the case of alphabetic characters @@ -22,10 +24,35 @@ data: false fi } + retry_while() { + local cmd="${1:?cmd is missing}" + local retries="${2:-12}" + local sleep_time="${3:-5}" + local return_value=1 + read -r -a command <<< "$cmd" + for ((i = 1 ; i <= retries ; i+=1 )); do + "${command[@]}" && return_value=0 && break + sleep "$sleep_time" + done + return $return_value + } + not_exists_dns_entry() { + myip=$(hostname -i) + + if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then + echo "$HEADLESS_SERVICE is not resolving or not has my IP: ${myip}" + return 1 + fi + echo "$HEADLESS_SERVICE has my IP: ${myip}" + return 0 + } HEADLESS_SERVICE="{{ template "redis.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}" REDIS_SERVICE="{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}" + # Waits for DNS to add this ip to the service DNS entry + retry_while not_exists_dns_entry + export REDIS_REPLICATION_MODE="slave" if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i) ")" ]]; then export REDIS_REPLICATION_MODE="master" @@ -137,6 +164,7 @@ data: start-sentinel.sh: | #!/bin/bash + set -x replace_in_file() { local filename="${1:?filename is required}" local match_regex="${2:?match regex is required}" @@ -184,6 +212,28 @@ data: host_id() { echo "$1" | openssl sha1 | awk '{print $2}' } + retry_while() { + local cmd="${1:?cmd is missing}" + local retries="${2:-12}" + local sleep_time="${3:-5}" + local return_value=1 + read -r -a command <<< "$cmd" + for ((i = 1 ; i <= retries ; i+=1 )); do + "${command[@]}" && return_value=0 && break + sleep "$sleep_time" + done + return $return_value + } + not_exists_dns_entry() { + myip=$(hostname -i) + + if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then + echo "$HEADLESS_SERVICE is not resolving or not has my IP: ${myip}" + return 1 + fi + echo "$HEADLESS_SERVICE has my IP: ${myip}" + return 0 + } HEADLESS_SERVICE="{{ template "redis.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}" REDIS_SERVICE="{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}" @@ -207,16 +257,32 @@ data: fi export REDIS_REPLICATION_MODE="slave" - if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i) ")" ]]; then + + # Waits for DNS to add this ip to the service DNS entry + retry_while not_exists_dns_entry + + if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i)")" ]]; then export REDIS_REPLICATION_MODE="master" fi + # Clean sentineles from the current sentinel nodes + for node in $( getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i)" | cut -f 1 -d ' ' | uniq ); do + echo "Cleaning sentinels in sentinel node: $node" + if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then + redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel reset "*" + else + redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} sentinel reset "*" + fi + sleep {{ .Values.sentinel.cleanWait }} + done + echo "Sentinels clean up done" + if [[ "$REDIS_REPLICATION_MODE" == "master" ]]; then REDIS_MASTER_HOST="$(hostname -i)" REDIS_MASTER_PORT_NUMBER="{{ .Values.redisPort }}" else if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then - sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}" + sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-namesentinel reset "*" {{ .Values.sentinel.masterSet }}" else sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}" fi diff --git a/bitnami/redis/values.yaml b/bitnami/redis/values.yaml index 932086bee34352..26cc6914db0717 100644 --- a/bitnami/redis/values.yaml +++ b/bitnami/redis/values.yaml @@ -78,10 +78,17 @@ sentinel: masterSet: mymaster initialCheckTimeout: 5 quorum: 2 - downAfterMilliseconds: 60000 + downAfterMilliseconds: 20000 failoverTimeout: 18000 parallelSyncs: 1 port: 26379 + + ## Seconds to wait when cleaning nodes IPs + ## When starting it will clean the sentiles IP (RESET "*") in all the nodes + ## This is the time to wait before sending the command to the next node + ## + cleanWait: 5 + ## Additional Redis(TM) configuration for the sentinel nodes ## ref: https://redis.io/topics/config ## From 899a9708cc8c6a51cc79acfb076d42cd44c8f0d1 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 10:32:21 +0100 Subject: [PATCH 2/9] Review fixes --- bitnami/redis/templates/configmap-scripts.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index d067123d657a78..79d22195922c4f 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -40,7 +40,7 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE is not resolving or not has my IP: ${myip}" + echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi echo "$HEADLESS_SERVICE has my IP: ${myip}" @@ -228,7 +228,7 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE is not resolving or not has my IP: ${myip}" + echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi echo "$HEADLESS_SERVICE has my IP: ${myip}" @@ -269,7 +269,7 @@ data: for node in $( getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i)" | cut -f 1 -d ' ' | uniq ); do echo "Cleaning sentinels in sentinel node: $node" if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then - redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel reset "*" + redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel reset "*" else redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} sentinel reset "*" fi @@ -282,7 +282,7 @@ data: REDIS_MASTER_PORT_NUMBER="{{ .Values.redisPort }}" else if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then - sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-namesentinel reset "*" {{ .Values.sentinel.masterSet }}" + sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}" else sentinel_info_command="redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $REDIS_SERVICE -p {{ .Values.sentinel.port }} sentinel get-master-addr-by-name {{ .Values.sentinel.masterSet }}" fi From d39696c53f3de01301166b29a0b3a27c894f3050 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 10:46:24 +0100 Subject: [PATCH 3/9] Removes debugging set --- bitnami/redis/templates/configmap-scripts.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index 79d22195922c4f..5c591149cb4445 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -12,7 +12,6 @@ data: {{- if and .Values.cluster.enabled .Values.sentinel.enabled }} start-node.sh: | #!/bin/bash - set -x is_boolean_yes() { local -r bool="${1:-}" @@ -164,7 +163,7 @@ data: start-sentinel.sh: | #!/bin/bash - set -x + replace_in_file() { local filename="${1:?filename is required}" local match_regex="${2:?match regex is required}" From 8b2baca0fe79754dea6882deb64b40d61cada3d7 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 10:55:30 +0100 Subject: [PATCH 4/9] Update 'cleanWait' description in README --- bitnami/redis/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/redis/README.md b/bitnami/redis/README.md index 40cecd6ec40801..f84dab748ec9f0 100644 --- a/bitnami/redis/README.md +++ b/bitnami/redis/README.md @@ -258,7 +258,7 @@ The following table lists the configurable parameters of the RedisTM | `sentinel.failoverTimeout` | Timeout for performing a election failover | `18000` | | `sentinel.parallelSyncs` | Number of parallel syncs in the cluster | `1` | | `sentinel.port` | RedisTM Sentinel port | `26379` | -| `sentinel.cleanWait` | Seconds to wait when cleaning nodes IPs | `5` | +| `sentinel.cleanWait` | Seconds to wait before issuing the the cleaning in the next node | `5` | | `sentinel.configmap` | Additional RedisTM configuration for the sentinel nodes (this value is evaluated as a template) | `nil` | | `sentinel.staticID` | Enable static IDs for sentinel replicas (If disabled IDs will be randomly generated on startup) | `false` | | `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` | From 920d5fae5a3c3fe0ac09bc2f267d8ce8a4249568 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 11:13:16 +0100 Subject: [PATCH 5/9] Fix indentation --- bitnami/redis/templates/configmap-scripts.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index 5c591149cb4445..a4f0a76276f4ee 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -39,8 +39,8 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" - return 1 + echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + return 1 fi echo "$HEADLESS_SERVICE has my IP: ${myip}" return 0 @@ -227,8 +227,8 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" - return 1 + echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + return 1 fi echo "$HEADLESS_SERVICE has my IP: ${myip}" return 0 From f34aca12671c8dc990b8d1a42458b28dae19e14a Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 11:20:42 +0100 Subject: [PATCH 6/9] Renames 'waitClean' to 'cleanDelaySeconds' --- bitnami/redis/README.md | 2 +- bitnami/redis/templates/configmap-scripts.yaml | 2 +- bitnami/redis/values.yaml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bitnami/redis/README.md b/bitnami/redis/README.md index f84dab748ec9f0..052b4b5a46db8e 100644 --- a/bitnami/redis/README.md +++ b/bitnami/redis/README.md @@ -258,7 +258,7 @@ The following table lists the configurable parameters of the RedisTM | `sentinel.failoverTimeout` | Timeout for performing a election failover | `18000` | | `sentinel.parallelSyncs` | Number of parallel syncs in the cluster | `1` | | `sentinel.port` | RedisTM Sentinel port | `26379` | -| `sentinel.cleanWait` | Seconds to wait before issuing the the cleaning in the next node | `5` | +| `sentinel.cleanDelaySeconds` | Delay seconds before issuing the the cleaning in the next node | `5` | | `sentinel.configmap` | Additional RedisTM configuration for the sentinel nodes (this value is evaluated as a template) | `nil` | | `sentinel.staticID` | Enable static IDs for sentinel replicas (If disabled IDs will be randomly generated on startup) | `false` | | `sentinel.service.type` | Kubernetes Service type (redis sentinel) | `ClusterIP` | diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index a4f0a76276f4ee..866047ba12f1e7 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -272,7 +272,7 @@ data: else redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} sentinel reset "*" fi - sleep {{ .Values.sentinel.cleanWait }} + sleep {{ .Values.sentinel.cleanDelaySeconds }} done echo "Sentinels clean up done" diff --git a/bitnami/redis/values.yaml b/bitnami/redis/values.yaml index 4ebae689118737..fac31158f366f8 100644 --- a/bitnami/redis/values.yaml +++ b/bitnami/redis/values.yaml @@ -83,11 +83,11 @@ sentinel: parallelSyncs: 1 port: 26379 - ## Seconds to wait when cleaning nodes IPs + ## Delay seconds when cleaning nodes IPs ## When starting it will clean the sentiles IP (RESET "*") in all the nodes - ## This is the time to wait before sending the command to the next node + ## This is the delay time before sending the command to the next node ## - cleanWait: 5 + cleanDelaySeconds: 5 ## Additional Redis(TM) configuration for the sentinel nodes ## ref: https://redis.io/topics/config From bea3f334c0ca8b4904bfcd92808762e00865b44e Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 15:45:20 +0100 Subject: [PATCH 7/9] Remove code from config map and use libraries --- .../redis/templates/configmap-scripts.yaml | 70 ++----------------- 1 file changed, 7 insertions(+), 63 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index 866047ba12f1e7..60569138fa7581 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -13,28 +13,9 @@ data: start-node.sh: | #!/bin/bash - is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi - } - retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - read -r -a command <<< "$cmd" - for ((i = 1 ; i <= retries ; i+=1 )); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value - } + . /opt/bitnami/scripts/libos.sh + . /opt/bitnami/scripts/libvalidations.sh + not_exists_dns_entry() { myip=$(hostname -i) @@ -164,25 +145,10 @@ data: start-sentinel.sh: | #!/bin/bash - replace_in_file() { - local filename="${1:?filename is required}" - local match_regex="${2:?match regex is required}" - local substitute_regex="${3:?substitute regex is required}" - local posix_regex=${4:-true} - - local result - - # We should avoid using 'sed in-place' substitutions - # 1) They are not compatible with files mounted from ConfigMap(s) - # 2) We found incompatibility issues with Debian10 and "in-place" substitutions - del=$'\001' # Use a non-printable character as a 'sed' delimiter to avoid issues - if [[ $posix_regex = true ]]; then - result="$(sed -E "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - else - result="$(sed "s${del}${match_regex}${del}${substitute_regex}${del}g" "$filename")" - fi - echo "$result" > "$filename" - } + . /opt/bitnami/scripts/libos.sh + . /opt/bitnami/scripts/libvalidations.sh + . /opt/bitnami/scripts/libfile.sh + sentinel_conf_set() { local -r key="${1:?missing key}" local value="${2:-}" @@ -198,31 +164,9 @@ data: sentinel_conf_add() { echo $'\n'"$@" >> "/opt/bitnami/redis-sentinel/etc/sentinel.conf" } - is_boolean_yes() { - local -r bool="${1:-}" - # comparison is performed without regard to the case of alphabetic characters - shopt -s nocasematch - if [[ "$bool" = 1 || "$bool" =~ ^(yes|true)$ ]]; then - true - else - false - fi - } host_id() { echo "$1" | openssl sha1 | awk '{print $2}' } - retry_while() { - local cmd="${1:?cmd is missing}" - local retries="${2:-12}" - local sleep_time="${3:-5}" - local return_value=1 - read -r -a command <<< "$cmd" - for ((i = 1 ; i <= retries ; i+=1 )); do - "${command[@]}" && return_value=0 && break - sleep "$sleep_time" - done - return $return_value - } not_exists_dns_entry() { myip=$(hostname -i) From c4f7a81eedeaf1c675f666744661abb2564a00af Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 17:20:32 +0100 Subject: [PATCH 8/9] Changes 'echo' by logging functions --- bitnami/redis/templates/configmap-scripts.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index 60569138fa7581..e60c94ee1bbd8f 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -14,16 +14,17 @@ data: #!/bin/bash . /opt/bitnami/scripts/libos.sh + . /opt/bitnami/scripts/liblog.sh . /opt/bitnami/scripts/libvalidations.sh not_exists_dns_entry() { myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + error "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi - echo "$HEADLESS_SERVICE has my IP: ${myip}" + debug "$HEADLESS_SERVICE has my IP: ${myip}" return 0 } @@ -171,10 +172,10 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - echo "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + error "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi - echo "$HEADLESS_SERVICE has my IP: ${myip}" + debug "$HEADLESS_SERVICE has my IP: ${myip}" return 0 } @@ -210,7 +211,7 @@ data: # Clean sentineles from the current sentinel nodes for node in $( getent ahosts "$HEADLESS_SERVICE" | grep -v "^$(hostname -i)" | cut -f 1 -d ' ' | uniq ); do - echo "Cleaning sentinels in sentinel node: $node" + info "Cleaning sentinels in sentinel node: $node" if is_boolean_yes "$REDIS_SENTINEL_TLS_ENABLED"; then redis-cli {{- if .Values.usePassword }} -a $REDIS_PASSWORD {{- end }} -h $node -p {{ .Values.sentinel.port }} --tls --cert ${REDIS_SENTINEL_TLS_CERT_FILE} --key ${REDIS_SENTINEL_TLS_KEY_FILE} --cacert ${REDIS_SENTINEL_TLS_CA_FILE} sentinel reset "*" else @@ -218,7 +219,7 @@ data: fi sleep {{ .Values.sentinel.cleanDelaySeconds }} done - echo "Sentinels clean up done" + info "Sentinels clean up done" if [[ "$REDIS_REPLICATION_MODE" == "master" ]]; then REDIS_MASTER_HOST="$(hostname -i)" From 89660097d58e5d9959c351fe34e42e1619422b93 Mon Sep 17 00:00:00 2001 From: rafael Date: Wed, 24 Feb 2021 17:26:14 +0100 Subject: [PATCH 9/9] Changes log levels for messages --- bitnami/redis/templates/configmap-scripts.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitnami/redis/templates/configmap-scripts.yaml b/bitnami/redis/templates/configmap-scripts.yaml index e60c94ee1bbd8f..377fbea90e9b71 100644 --- a/bitnami/redis/templates/configmap-scripts.yaml +++ b/bitnami/redis/templates/configmap-scripts.yaml @@ -21,10 +21,10 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - error "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + warn "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi - debug "$HEADLESS_SERVICE has my IP: ${myip}" + info "$HEADLESS_SERVICE has my IP: ${myip}" return 0 } @@ -172,10 +172,10 @@ data: myip=$(hostname -i) if [[ -z "$(getent ahosts "$HEADLESS_SERVICE" | grep "^${myip}" )" ]]; then - error "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" + warn "$HEADLESS_SERVICE does not contain the IP of this pod: ${myip}" return 1 fi - debug "$HEADLESS_SERVICE has my IP: ${myip}" + info "$HEADLESS_SERVICE has my IP: ${myip}" return 0 }