summaryrefslogtreecommitdiffstats
path: root/kubernetes/dcaegen2/charts/dcae-redis/resources
diff options
context:
space:
mode:
authorLusheng Ji <lji@research.att.com>2018-04-26 16:37:17 -0400
committerLusheng Ji <lji@research.att.com>2018-04-26 20:40:14 +0000
commita994d458fc02f414e0e5160d9b1f1be7bbe9bcda (patch)
treee8be1f2b6f37f8e63650c70dbe44f55443d679a9 /kubernetes/dcaegen2/charts/dcae-redis/resources
parent2917c651fd869fb6f6a355542754b2dbff168eeb (diff)
Fix Redis cluster initialization
Issue-ID: DCAEGEN2-245 Change-Id: Ieb234a72897c5f307193cd998bcf64ce7658b700 Signed-off-by: Lusheng Ji <lji@research.att.com>
Diffstat (limited to 'kubernetes/dcaegen2/charts/dcae-redis/resources')
-rwxr-xr-xkubernetes/dcaegen2/charts/dcae-redis/resources/redis/scripts/redis-cluster-config.sh19
1 files changed, 14 insertions, 5 deletions
diff --git a/kubernetes/dcaegen2/charts/dcae-redis/resources/redis/scripts/redis-cluster-config.sh b/kubernetes/dcaegen2/charts/dcae-redis/resources/redis/scripts/redis-cluster-config.sh
index 3431e7e6e7..f4547525c9 100755
--- a/kubernetes/dcaegen2/charts/dcae-redis/resources/redis/scripts/redis-cluster-config.sh
+++ b/kubernetes/dcaegen2/charts/dcae-redis/resources/redis/scripts/redis-cluster-config.sh
@@ -15,8 +15,9 @@
# limitations under the License.
# ============LICENSE_END=========================================================
-
-if [[ "$HOSTNAME" == *{{.Chart.Name}}-0 ]]; then
+(if [[ "$HOSTNAME" == *{{.Chart.Name}}-0 ]]; then
+ echo "delay by 10 seconds for redis server starting"
+ sleep 10
NODES=""
echo "====> wait for all {{.Values.replicaCount}} redis pods up"
@@ -24,11 +25,16 @@ if [[ "$HOSTNAME" == *{{.Chart.Name}}-0 ]]; then
do
echo "======> $(echo $NODES |wc -w) / {{.Values.replicaCount}} pods up"
sleep 5
- RESP=$(wget -vO- --ca-certificate /var/run/secrets/kubernetes.io/serviceaccount/ca.crt --header "Authorization: Bearer $(</var/run/secrets/kubernetes.io/serviceaccount/token)" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT/api/v1/namespaces/{{.Release.Namespace}}/pods?labelSelector=app={{.Chart.Name}})
+ RESP=$(wget -vO- --ca-certificate /var/run/secrets/kubernetes.io/serviceaccount/ca.crt --header "Authorization
+: Bearer $(</var/run/secrets/kubernetes.io/serviceaccount/token)" https://$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT
+_443_TCP_PORT/api/v1/namespaces/{{.Release.Namespace}}/pods?labelSelector=app={{.Chart.Name}})
IPS=$(echo $RESP | jq -r '.items[].status.podIP')
+ IPS2=$(echo $IPS | sed -e 's/[a-zA-Z]*//g')
+ echo "======> IPs: ["$IPS2"]"
NODES=""
- for I in $IPS; do NODES="$NODES $I:{{.Values.service.externalPort}}"; done
+ for I in $IPS2; do NODES="$NODES $I:{{.Values.service.externalPort}}"; done
+ echo "======> nodes: ["$NODES"]"
done
echo "====> all {{.Values.replicaCount}} redis cluster pods are up. wait 10 seconds before the next step"; echo
sleep 10
@@ -36,6 +42,9 @@ if [[ "$HOSTNAME" == *{{.Chart.Name}}-0 ]]; then
echo "====> Configure the cluster"
# $NODES w/o quotes
+ echo "======> nodes: [$(echo $NODES |paste -s)]"
redis-trib create --replicas 1 $(echo $NODES |paste -s)
+fi ) &
+
+redis-server /conf/redis.conf
-fi