From bdd224850a23432bb15d1a7ea9a4e715e61285ac Mon Sep 17 00:00:00 2001 From: Kamal Mohammed Date: Thu, 25 Jul 2024 09:23:15 -0600 Subject: [PATCH] GRAD2-2891 - Fix Defunct PIDs on redis-ha cluster (#76) --- redis/redis-ha.dc.yaml | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/redis/redis-ha.dc.yaml b/redis/redis-ha.dc.yaml index ef4b857..45ef5ff 100644 --- a/redis/redis-ha.dc.yaml +++ b/redis/redis-ha.dc.yaml @@ -35,6 +35,22 @@ objects: protected-mode no requirepass ${REDIS_PASSWORD} masterauth ${REDIS_PASSWORD} + redis-readiness.sh: | + #!/bin/sh + export REDISCLI_AUTH=$REDIS_PASSWORD + response=$(timeout 3 $1 redis-cli -h $HOSTNAME -p 6379 ping) + if [ "$response" != "PONG" ]; then + echo "$response" + exit 1 + fi + redis-liveness.sh: | + #!/bin/sh + export REDISCLI_AUTH=$REDIS_PASSWORD + response=$(timeout 3 $1 redis-cli -h $HOSTNAME -p 6379 ping) + if [ "$response" != "PONG" ] && [ "$response" != "LOADING Redis is loading the dataset in memory" ]; then + echo "$response" + exit 1 + fi - kind: Secret apiVersion: v1 metadata: @@ -93,20 +109,22 @@ objects: command: ["/conf/fix-ip.sh", "redis-server", "/conf/redis.conf"] readinessProbe: exec: - command: - - sh - - -c - - "redis-cli -h $(hostname) ping" - initialDelaySeconds: 15 + command: ["/conf/redis-readiness.sh"] + enabled: true + initialDelaySeconds: 20 + periodSeconds: 5 timeoutSeconds: 5 + successThreshold: 1 + failureThreshold: 5 livenessProbe: exec: - command: - - sh - - -c - - "redis-cli -h $(hostname) ping" + command: ["/conf/redis-liveness.sh"] + enabled: true initialDelaySeconds: 20 - periodSeconds: 3 + periodSeconds: 5 + timeoutSeconds: 1 + successThreshold: 1 + failureThreshold: 5 env: - name: POD_IP valueFrom: