From 5ac4e4f1ed0631318f2e5c5906e6bddd183be554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Blondel?= Date: Fri, 2 Feb 2024 00:28:35 +0100 Subject: [PATCH] fix: redis: move probes scripts from tpl file into configmap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: François Blondel --- charts/argo-cd/templates/redis/_configs.tpl | 29 ------------------- .../templates/redis/health-configmap.yaml | 24 +++++++++++++-- 2 files changed, 22 insertions(+), 31 deletions(-) delete mode 100644 charts/argo-cd/templates/redis/_configs.tpl diff --git a/charts/argo-cd/templates/redis/_configs.tpl b/charts/argo-cd/templates/redis/_configs.tpl deleted file mode 100644 index 7810f010..00000000 --- a/charts/argo-cd/templates/redis/_configs.tpl +++ /dev/null @@ -1,29 +0,0 @@ -{{/* vim: set filetype=mustache: */}} - -{{- define "redis_liveness.sh" }} - response=$( - redis-cli \ - -h localhost \ - -p {{ .Values.redis.containerPorts.redis }} \ - ping - ) - if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then - echo "$response" - exit 1 - fi - echo "response=$response" -{{- end }} - -{{- define "redis_readiness.sh" }} - response=$( - redis-cli \ - -h localhost \ - -p {{ .Values.redis.containerPorts.redis }} \ - ping - ) - if [ "$response" != "PONG" ] ; then - echo "$response" - exit 1 - fi - echo "response=$response" -{{- end }} diff --git a/charts/argo-cd/templates/redis/health-configmap.yaml b/charts/argo-cd/templates/redis/health-configmap.yaml index ca7af228..fd0ecff7 100644 --- a/charts/argo-cd/templates/redis/health-configmap.yaml +++ b/charts/argo-cd/templates/redis/health-configmap.yaml @@ -9,7 +9,27 @@ metadata: {{- include "argo-cd.labels" (dict "context" . "component" .Values.redis.name "name" .Values.redis.name) | nindent 4 }} data: redis_liveness.sh: | -{{- include "redis_liveness.sh" . }} + response=$( + redis-cli \ + -h localhost \ + -p {{ .Values.redis.containerPorts.redis }} \ + ping + ) + if [ "$response" != "PONG" ] && [ "${response:0:7}" != "LOADING" ] ; then + echo "$response" + exit 1 + fi + echo "response=$response" redis_readiness.sh: | -{{- include "redis_readiness.sh" . }} + response=$( + redis-cli \ + -h localhost \ + -p {{ .Values.redis.containerPorts.redis }} \ + ping + ) + if [ "$response" != "PONG" ] ; then + echo "$response" + exit 1 + fi + echo "response=$response" {{- end }}