blob: af300f25cdb60d7c77b0a7c59de3e18247f5d5f1 [file] [log] [blame]
Mandeep Khindad6ea9872017-06-24 11:49:37 -04001#!/bin/bash
2
Borislav Glozman5197e2e2017-07-24 10:45:28 +03003. $(dirname "$0")/setenv.bash
4
Mandeep Khindad6ea9872017-06-24 11:49:37 -04005usage() {
6 cat <<EOF
7Usage: $0 [PARAMs]
8-u : Display usage
9-n [NAMESPACE] : Kubernetes namespace (required)
10-s false : Exclude services (default: true)
11-a [APP] : Specify a specific ONAP component (default: all)
12 from the following choices:
13 sdc, aai ,mso, message-router, robot,
14 vid, sdnc, portal, policy, appc
15EOF
16}
17
18create_namespace() {
19 kubectl create namespace $1-$2
20}
21
Borislav Glozman5197e2e2017-07-24 10:45:28 +030022create_registry_key() {
23 kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7
24}
25
Mandeep Khindad6ea9872017-06-24 11:49:37 -040026create_service() {
27 kubectl --namespace $1-$2 create -f ../$2/all-services.yaml
28}
29
30#MAINs
31NS=
32INCL_SVC=true
33APP=
Borislav Glozman5197e2e2017-07-24 10:45:28 +030034DU=$ONAP_DOCKER_USER
35DP=$ONAP_DOCKER_PASS
Mandeep Khindad6ea9872017-06-24 11:49:37 -040036
Borislav Glozman5197e2e2017-07-24 10:45:28 +030037while getopts ":n:u:s:a:du:dp:" PARAM; do
Mandeep Khindad6ea9872017-06-24 11:49:37 -040038 case $PARAM in
39 u)
40 usage
41 exit 1
42 ;;
43 n)
44 NS=${OPTARG}
45 ;;
46 s)
47 INCL_SVC=${OPTARG}
48 ;;
49 a)
50 APP=${OPTARG}
51 if [[ -z $APP ]]; then
52 usage
53 exit 1
54 fi
55 ;;
Borislav Glozman5197e2e2017-07-24 10:45:28 +030056 du)
57 DU=${OPTARG}
58 ;;
59 dp)
60 DP=${OPTARG}
61 ;;
Mandeep Khindad6ea9872017-06-24 11:49:37 -040062 ?)
63 usage
64 exit
65 ;;
66 esac
67done
68
69if [[ -z $NS ]]; then
70 usage
71 exit 1
72fi
73
74if [[ ! -z "$APP" ]]; then
75 ONAP_APPS=($APP)
Mandeep Khindad6ea9872017-06-24 11:49:37 -040076fi
77
78printf "\n********** Creating up ONAP: ${ONAP_APPS[*]}\n"
79
80for i in ${ONAP_APPS[@]}; do
81 printf "\nCreating namespaces **********\n"
82 create_namespace $NS $i
83
84 if [[ "$INCL_SVC" == true ]]; then
85 printf "\nCreating services **********\n"
86 create_service $NS $i
87 fi
88
89 printf "\n"
90done
91
92printf "\n\n********** Creating deployments for ${ONAP_APPS[*]} ********** \n"
93for i in ${ONAP_APPS[@]}; do
Borislav Glozman5197e2e2017-07-24 10:45:28 +030094 create_registry_key $NS $i $ONAP_DOCKER_REGISTRY_KEY $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
Mandeep Khindad6ea9872017-06-24 11:49:37 -040095 /bin/bash $i.sh $NS $i 'create'
96done
97
98printf "**** Done ****"