From 312bb5a2abdb4d88378401a989a9dcd876cca66f Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sat, 15 Oct 2022 22:11:42 +0200 Subject: [PATCH] Better disbaled CONFIG command detection and fallback to 16 databases --- engine/add.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/add.sh b/engine/add.sh index d86618e..fc84a83 100755 --- a/engine/add.sh +++ b/engine/add.sh @@ -82,7 +82,7 @@ echo "${write} is write service" (kubectl get secret -n "${namespace}" "${secret}") if [[ "$?" == "1" ]] ; then - maxDatabases=$((redis-cli -u "${write}" CONFIG GET databases | grep -v databases) || echo "16") + maxDatabases=$(((redis-cli -u "${write}" CONFIG GET databases | grep -v databases) | grep -q "ERR" && echo "16") || (redis-cli -u "${write}" CONFIG GET databases | grep -v databases)) redisServerIsKnown=$(kubectl get configmap redis-database-assignment-operator-in-use-dbs-list -o json | jq -r -c '.data.dbs' | jq -r ".\"${uri_host_port}\"" | wc -l) if [[ "$redisServerIsKnown" == "1" ]] ; then kubectl create configmap redis-database-assignment-operator-in-use-dbs-list --from-literal=dbs=$(kubectl get configmap redis-database-assignment-operator-in-use-dbs-list -o json | jq -r '.data.dbs' | jq -r ". * {\"${uri_host_port}\": {}}" | jq -c) --dry-run -o yaml | kubectl apply -f -