Add Consul support to 'OneClick' deployment.
[oom.git] / kubernetes / oneclick / createAll.bash
index 0ecee03..afe71af 100755 (executable)
@@ -14,24 +14,29 @@ Usage: $0 [PARAMs]
 -a [APP]            : Specify a specific ONAP component (default: all)
                       from the following choices:
                       sdc, aai ,mso, message-router, robot,
-                      vid, sdnc, portal, policy, appc
+                      vid, sdnc, portal, policy, appc, multicloud, clamp, consul
 EOF
 }
 
-create_namespace() {
-  kubectl create namespace $1-$2
+check_return_code(){
+  ret=$?
+  if [ $ret -ne 0 ]; then
+    printf "The command $1 returned with error code $ret \n" 1>&2
+    exit $ret
+  fi
 }
 
-create_registry_key() {
-  kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7
+
+create_namespace() {
+  cmd=`echo kubectl create namespace $1-$2`
+  eval ${cmd}
+  check_return_code $cmd
 }
 
-create_certs_secret() {
-  if [ -d $LOCATION/config/certs/$i/ ]; then
-    printf "\nCreating certs and keys secret **********\n"
-    _CERTS_FILES=$(find $LOCATION/config/certs/$2/ -type f | awk '$0="--from-file="$0' ORS=' ')
-    kubectl create secret generic secret-$1-$2 $_CERTS_FILES -n $1-$2
-  fi
+create_registry_key() {
+  cmd=`echo kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7`
+  eval ${cmd}
+  check_return_code $cmd
 }
 
 create_onap_helm() {
@@ -39,10 +44,11 @@ create_onap_helm() {
   if [[ ! -z $HELM_VALUES_FILEPATH ]]; then
     HELM_VALUES_ADDITION="--values=$HELM_VALUES_FILEPATH"
   fi
-  helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION}
+  cmd=`echo helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3 ${HELM_VALUES_ADDITION}`
+  eval ${cmd}
+  check_return_code $cmd
 }
 
-
 #MAINs
 NS=
 HELM_VALUES_FILEPATH=""
@@ -126,8 +132,6 @@ for i in ${HELM_APPS[@]}; do
   printf "\nCreating registry secret **********\n"
   create_registry_key $NS $i ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL
 
-  create_certs_secret $NS $i
-
   printf "\nCreating deployments and services **********\n"
   create_onap_helm $NS $i $start