From 8e008c783cd4fb6f2cbe11e6315bc4b635648ebd Mon Sep 17 00:00:00 2001 From: Chris Boot Date: Thu, 22 Aug 2024 16:40:41 +0100 Subject: [PATCH] redis-ha: fix busybox-ash-ism in redis_liveness.sh The ${response:0:7} syntax is non-POSIX and not understood by Debian's dash shell, so if a Debian-based Redis image is used the liveness check breaks on slaves. A case statement makes this check more legible anyway, in my opinion, and works in all the POSIX-compatible shells (busybox ash, dash, and bash). Signed-off-by: Chris Boot --- charts/redis-ha/Chart.yaml | 2 +- charts/redis-ha/templates/_configs.tpl | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/charts/redis-ha/Chart.yaml b/charts/redis-ha/Chart.yaml index 34e3384..bb789df 100644 --- a/charts/redis-ha/Chart.yaml +++ b/charts/redis-ha/Chart.yaml @@ -5,7 +5,7 @@ keywords: - redis - keyvalue - database -version: 4.27.2 +version: 4.27.3 appVersion: 7.2.4 description: This Helm chart provides a highly available Redis implementation with a master/slave configuration and uses Sentinel sidecars for failover management icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png diff --git a/charts/redis-ha/templates/_configs.tpl b/charts/redis-ha/templates/_configs.tpl index 459e78a..78420a1 100644 --- a/charts/redis-ha/templates/_configs.tpl +++ b/charts/redis-ha/templates/_configs.tpl @@ -643,11 +643,12 @@ {{- end}} ping ) - if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then - echo "$response" - exit 1 - fi echo "response=$response" + case $response in + PONG|LOADING*) ;; + *) exit 1 ;; + esac + exit 0 {{- end }} {{- define "redis_readiness.sh" }}