3 . $(dirname "$0")/setenv.bash
10 -n [NAMESPACE] : Kubernetes namespace (required)
11 -v [VALUES] : HELM values filepath (usefull when deploying one component at a time)
12 -l [LOCATION] : Location of oom project
13 -i [INSTANCE] : ONAP deployment instance # (default: 1)
14 -a [APP] : Specify a specific ONAP component (default: all)
15 from the following choices:
16 sdc, aai ,mso, message-router, robot, vid, aaf, uui
17 sdnc, portal, policy, appc, multicloud, clamp, consul, vnfsdk
23 if [ $ret -ne 0 ]; then
24 printf "The command $1 returned with error code $ret \n" 1>&2
29 create_service_account() {
30 cmd=`echo kubectl create clusterrolebinding $1-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default`
32 check_return_code $cmd
36 cmd=`echo kubectl create namespace $1`
40 create_registry_key() {
41 cmd=`echo kubectl --namespace $1 create secret docker-registry $2 --docker-server=$3 --docker-username=$4 --docker-password=$5 --docker-email=$6`
43 check_return_code $cmd
46 configure_dcaegen2() {
47 if [ ! -s "$OPENSTACK_PRIVATE_KEY_PATH" ]
49 echo "ERROR: $OPENSTACK_PRIVATE_KEY_PATH does not exist or is empty. Cannot launch dcae gen2."
53 cmd=`echo kubectl --namespace $1-$2 create secret generic $2-openstack-ssh-private-key --from-file=key=${OPENSTACK_PRIVATE_KEY_PATH}`
55 check_return_code $cmd
57 if [ ! -s "$DCAEGEN2_CONFIG_INPUT_FILE_PATH" ]
59 echo "ERROR: $DCAEGEN2_CONFIG_INPUT_FILE_PATH does not exist or is empty. Cannot launch dcae gen2."
63 cmd=`echo kubectl --namespace $1-$2 create configmap $2-config-inputs --from-file=inputs.yaml=${DCAEGEN2_CONFIG_INPUT_FILE_PATH}`
65 check_return_code $cmd
69 HELM_VALUES_ADDITION=""
70 if [[ ! -z $HELM_VALUES_FILEPATH ]]; then
71 HELM_VALUES_ADDITION="--values=$HELM_VALUES_FILEPATH"
73 # Have to put a check for dcaegen2 because it requires external files to helm
74 # which should not be part of the Chart.
75 if [ "$2" = "dcaegen2" ];
77 configure_dcaegen2 $1 $2
81 echo "ERROR: dcaegen2 failed to configure: Pre-requisites not met. Skipping deploying it and continue"
86 cmd=`echo helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION}`
88 check_return_code $cmd
93 HELM_VALUES_FILEPATH=""
102 SINGLE_COMPONENT=false
104 while getopts ":n:u:s:i:a:du:dp:l:v:" PARAM; do
114 HELM_VALUES_FILEPATH=${OPTARG}
123 SINGLE_COMPONENT=true
125 if [[ -z $APP ]]; then
143 if [[ -z $NS ]]; then
148 if [[ ! -z "$APP" ]]; then
153 if [ "$INSTANCE" -gt "$MAX_INSTANCE" ];then
154 printf "\n********** You choose to create ${INSTANCE}th instance of ONAP \n"
155 printf "\n********** Due to port allocation only ${MAX_INSTANCE} instances of ONAP is allowed per kubernetes deployment\n"
159 start=$((300+2*INSTANCE))
162 printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${start}00 and ${end}99\n"
165 printf "\n********** Creating ONAP: ${ONAP_APPS[*]}\n"
167 if [ "$SINGLE_COMPONENT" == "false" ]
169 printf "\nCreating namespace **********\n"
172 printf "\nCreating registry secret **********\n"
173 create_registry_key $NS ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
175 printf "\nCreating service account **********\n"
176 create_service_account $NS
179 printf "\n\n********** Creating deployments for ${HELM_APPS[*]} ********** \n"
181 for i in ${HELM_APPS[@]}; do
183 printf "\nCreating deployments and services **********\n"
184 create_onap_helm $NS $i $start
189 printf "\n**** Done ****\n"