From 0280f27f9016abb4505d24415f36fe8c43c8dc09 Mon Sep 17 00:00:00 2001 From: Chus Date: Fri, 13 Dec 2019 18:52:38 +0100 Subject: [PATCH] restore check --- operator/redisfailover/service/generator.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/operator/redisfailover/service/generator.go b/operator/redisfailover/service/generator.go index 071ea4867..b2f8e8e03 100644 --- a/operator/redisfailover/service/generator.go +++ b/operator/redisfailover/service/generator.go @@ -170,7 +170,16 @@ func generateRedisReadinessConfigMap(rf *redisfailoverv1.RedisFailover, labels m ROLE_SLAVE="role:slave" IN_SYNC="master_sync_in_progress:1" NO_MASTER="master_host:127.0.0.1" - + RESPONSE="PONG" + + check_connection(){ + connected=$(redis-cli -h $(hostname) ping | grep $RESPONSE | tr -d "\r" | tr -d "\n") + echo $connected + if [ -z "$connected" ]; then + exit 1 + fi + } + check_master(){ exit 0 } @@ -186,6 +195,7 @@ func generateRedisReadinessConfigMap(rf *redisfailoverv1.RedisFailover, labels m exit 1 } + check_connection role=$(redis-cli info replication | grep $ROLE | tr -d "\r" | tr -d "\n") case $role in