File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,14 @@ if [[ "$?" == "1" ]] ; then
9898 do
9999 isDatabaseFree=$( kubectl get configmap redis-database-assignment-operator-in-use-dbs-list -o json | jq -r ' .data.dbs' | jq " .[\" ${uri_host_port} \" ].db${i} " | grep free | wc -l)
100100 if [[ " $isDatabaseFree " == " 1" ]] ; then
101- echo " Database ${i} is available"
102- kubectl create secret generic " ${secret} " -n " ${namespace} " --from-literal=DATABASE=" ${i} " --from-literal=READ=" ${read_dsn}${i} " --from-literal=WRITE=" ${write_dsn}${i} "
103- 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} \" : {\" db${i} \" : \" ${namespace} /${secret} \" }}" | jq -c) --dry-run -o yaml | kubectl apply -f -
104- echo " Database ${i} has now been claimed"
105- break
101+ isDatabaseEmpty=$( redis-cli -u " ${write} " INFO keyspace | grep -v Keyspace | grep " db${i} " | wc -l)
102+ if [[ " $isDatabaseEmpty " == " 0" ]] ; then
103+ echo " Database ${i} is available"
104+ kubectl create secret generic " ${secret} " -n " ${namespace} " --from-literal=DATABASE=" ${i} " --from-literal=READ=" ${read_dsn}${i} " --from-literal=WRITE=" ${write_dsn}${i} "
105+ 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} \" : {\" db${i} \" : \" ${namespace} /${secret} \" }}" | jq -c) --dry-run -o yaml | kubectl apply -f -
106+ echo " Database ${i} has now been claimed"
107+ break
108+ fi
106109 fi
107110 done
108111else
You can’t perform that action at this time.
0 commit comments