3 . $(dirname "$0")/setenv.bash
10 -n [NAMESPACE] : Kubernetes namespace (required)
11 -s false : Exclude services (default: true)
12 -i [INSTANCE] : ONAP deployment instance # (default: 1)
13 -a [APP] : Specify a specific ONAP component (default: all)
14 from the following choices:
15 sdc, aai ,mso, message-router, robot,
16 vid, sdnc, portal, policy, appc
21 kubectl create namespace $1-$2
24 create_registry_key() {
25 kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7
29 sed -i -- 's/nodePort: [0-9]\{2\}[02468]\{1\}/nodePort: '"$3"'/g' ../$2/all-services.yaml
30 sed -i -- 's/nodePort: [0-9]\{2\}[13579]\{1\}/nodePort: '"$4"'/g' ../$2/all-services.yaml
31 kubectl --namespace $1-$2 create -f ../$2/all-services.yaml
32 mv ../$2/all-services.yaml-- ../$2/all-services.yaml
37 helm install ../$2/ --name $2
41 # if previous configuration exists put back original template file
42 for file in $3/*.yaml; do
43 if [ -e "$file-template" ]; then
44 mv "$file-template" "${file%}"
48 if [ -e "$2/Chart.yaml" ]; then
49 sed -i -- 's/nodePort: [0-9]\{2\}[02468]\{1\}/nodePort: '"$4"'/g' $3/all-services.yaml
50 sed -i -- 's/nodePort: [0-9]\{2\}[13579]\{1\}/nodePort: '"$5"'/g' $3/all-services.yaml
51 sed -i "s/onap-/$1-/g" ../$2/values.yaml
55 # replace the default 'onap' namespace qualification of K8s hostnames within
57 # note: this will create a '-template' file within the component's directory
58 # this is not ideal and should be addressed (along with the replacement
59 # of sed commands for configuration) by the future configuration
60 # user stories (ie. OOM-51 to OOM-53)
61 find $3 -type f -exec sed -i -- "s/onap-/$1-/g" {} \;
63 # replace the default '/dockerdata-nfs/onapdemo' volume mount paths
64 find $3 -iname "*.yaml" -type f -exec sed -i -e 's/dockerdata-nfs\/[a-zA-Z0-9\\-]*\//dockerdata-nfs\/'"$1"'\//g' {} \;
78 while getopts ":n:u:s:i:a:du:dp:" PARAM; do
95 if [[ -z $APP ]]; then
113 if [[ -z $NS ]]; then
118 if [[ ! -z "$APP" ]]; then
122 if [[ "$INCL_SVC" == true ]]; then
124 if [ "$INSTANCE" -gt "$MAX_INSTANCE" ];then
125 printf "\n********** You choose to create ${INSTANCE}th instance of ONAP \n"
126 printf "\n********** Due to port allocation only ${MAX_INSTANCE} instances of ONAP is allowed per kubernetes deployment\n"
130 start=$((300+2*INSTANCE))
132 printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${start}00 and ${end}99\n"
136 printf "\n********** Creating ONAP: ${ONAP_APPS[*]}\n"
138 for i in ${ONAP_APPS[@]}; do
139 printf "\nCreating namespace **********\n"
140 create_namespace $NS $i
142 printf "\nCreating registry secret **********\n"
143 create_registry_key $NS $i $ONAP_DOCKER_REGISTRY_KEY $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
145 if [[ "$INCL_SVC" == true ]]; then
146 printf "\nCreating service **********\n"
147 create_service $NS $i $start $end
153 printf "\n\n********** Creating deployments for ${ONAP_APPS[*]} ********** \n"
154 for i in ${ONAP_APPS[@]}; do
155 _FILES_PATH=$(echo ../$i)
156 configure_app $NS $i $_FILES_PATH $start $end
157 /bin/bash $i.sh $NS $i 'create'
160 for i in ${HELM_APPS[@]}; do
161 printf "\nCreating namespace **********\n"
162 create_namespace $NS $i
164 printf "\nCreating registry secret **********\n"
165 create_registry_key $NS $i $ONAP_DOCKER_REGISTRY_KEY $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
167 printf "\nCreating deployments and services **********\n"
168 _FILES_PATH=$(echo ../$i/templates)
169 configure_app $NS $i $_FILES_PATH $start $end
170 create_onap_helm $NS $i
175 printf "\n**** Done ****\n"