summaryrefslogtreecommitdiffstats
path: root/kubernetes/oneclick/tools/autoCreateConfig.bash
blob: 99ea03e1bb8251b1989f1e60c9fe2ac20b7ad21b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
########################################################################################
# This script wraps {$OOM}/kubernetes/config/createConfig.sh script                    #
# and will only terminated when the configuration is Completed or failed               #
#                                                                                      #
# To run it, just enter the following command:                                         #
#    ./autoCreateConfig.bash <namespace, default is "onap">                            #
########################################################################################
#!/bin/bash


NS=$1
if [[ -z $NS ]]
then
  echo "Namespace is not specified, use onap namespace."
  NS="onap"
fi

echo "Create $NS config under config directory..."
cd ../../config
./createConfig.sh -n $NS
cd -


echo "...done : kubectl get namespace
-----------------------------------------------
>>>>>>>>>>>>>> k8s namespace"
kubectl get namespace


echo "
-----------------------------------------------
>>>>>>>>>>>>>> helm : helm ls --all"
helm ls --all


echo "
-----------------------------------------------
>>>>>>>>>>>>>> pod : kubectl get pods -n $NS -a"
kubectl get pods -n $NS -a


while true
do
  echo "wait for $NS config pod reach to Completed STATUS"
  sleep 5
  echo "-----------------------------------------------"
  kubectl get pods -n $NS -a

  status=`kubectl get pods -n $NS -a |grep config |xargs echo | cut -d' ' -f3`

  if [ "$status" = "Completed" ]
  then
    echo "$NS config is Completed!!!"
    break
  fi

  if [ "$status" = "Error" ]
  then
    echo "
$NS config is failed with Error!!!
Logs are:"
    kubectl logs config -n $NS -f
    break
  fi
done