blob: 99ea03e1bb8251b1989f1e60c9fe2ac20b7ad21b [file] [log] [blame]
beili.zhouab1c1ab2017-12-07 12:05:06 -05001########################################################################################
2# This script wraps {$OOM}/kubernetes/config/createConfig.sh script #
3# and will only terminated when the configuration is Completed or failed #
4# #
5# To run it, just enter the following command: #
6# ./autoCreateConfig.bash <namespace, default is "onap"> #
7########################################################################################
8#!/bin/bash
9
10
11NS=$1
12if [[ -z $NS ]]
13then
14 echo "Namespace is not specified, use onap namespace."
15 NS="onap"
16fi
17
18echo "Create $NS config under config directory..."
19cd ../../config
20./createConfig.sh -n $NS
21cd -
22
23
24echo "...done : kubectl get namespace
25-----------------------------------------------
26>>>>>>>>>>>>>> k8s namespace"
27kubectl get namespace
28
29
30echo "
31-----------------------------------------------
32>>>>>>>>>>>>>> helm : helm ls --all"
33helm ls --all
34
35
36echo "
37-----------------------------------------------
38>>>>>>>>>>>>>> pod : kubectl get pods -n $NS -a"
39kubectl get pods -n $NS -a
40
41
42while true
43do
44 echo "wait for $NS config pod reach to Completed STATUS"
45 sleep 5
46 echo "-----------------------------------------------"
47 kubectl get pods -n $NS -a
48
49 status=`kubectl get pods -n $NS -a |grep config |xargs echo | cut -d' ' -f3`
50
51 if [ "$status" = "Completed" ]
52 then
53 echo "$NS config is Completed!!!"
54 break
55 fi
56
57 if [ "$status" = "Error" ]
58 then
59 echo "
60$NS config is failed with Error!!!
61Logs are:"
62 kubectl logs config -n $NS -f
63 break
64 fi
65done