diff options
Diffstat (limited to 'kubernetes/oneclick')
-rwxr-xr-x | kubernetes/oneclick/createAll.bash | 32 | ||||
-rwxr-xr-x | kubernetes/oneclick/dcae.sh | 18 | ||||
-rwxr-xr-x | kubernetes/oneclick/deleteAll.bash | 14 | ||||
-rw-r--r-- | kubernetes/oneclick/setenv.bash | 2 |
4 files changed, 59 insertions, 7 deletions
diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash index 7b8e2f8886..5012a52d20 100755 --- a/kubernetes/oneclick/createAll.bash +++ b/kubernetes/oneclick/createAll.bash @@ -18,12 +18,33 @@ Usage: $0 [PARAMs] EOF } +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_namespace() { - kubectl create namespace $1-$2 + cmd=`echo kubectl create namespace $1-$2` + eval ${cmd} + check_return_code $cmd } create_registry_key() { - kubectl --namespace $1-$2 create secret docker-registry $3 --docker-server=$4 --docker-username=$5 --docker-password=$6 --docker-email=$7 + 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_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_onap_helm() { @@ -31,10 +52,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="" @@ -118,6 +140,8 @@ 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 diff --git a/kubernetes/oneclick/dcae.sh b/kubernetes/oneclick/dcae.sh index 8a95e0bfff..5dd1a2f071 100755 --- a/kubernetes/oneclick/dcae.sh +++ b/kubernetes/oneclick/dcae.sh @@ -1,2 +1,18 @@ #!/bin/bash -echo "DCAE under construction" +# manual deployment order is mentioned - but we need to specify dependencies in the service +KUBECTL_CMD="kubectl --namespace $1-$2 $3 -f ../$2" + +printf "dcae....\n" +$KUBECTL_CMD/message-router/dcae-zookeeper.yaml +$KUBECTL_CMD/message-router/dcae-kafka.yaml +$KUBECTL_CMD/message-router/dcae-dmaap.yaml + +$KUBECTL_CMD/pgaas/pgaas.yaml + +$KUBECTL_CMD/dcae-collector-common-event.yaml +$KUBECTL_CMD/dcae-collector-dmaapbc.yaml +$KUBECTL_CMD/dcae-collector-pvs.yaml + +$KUBECTL_CMD/cdap/cdap0-dep.yaml +$KUBECTL_CMD/cdap/cdap1-dep.yaml +$KUBECTL_CMD/cdap/cdap2-dep.yaml diff --git a/kubernetes/oneclick/deleteAll.bash b/kubernetes/oneclick/deleteAll.bash index 40d070124a..f7c48fd18d 100755 --- a/kubernetes/oneclick/deleteAll.bash +++ b/kubernetes/oneclick/deleteAll.bash @@ -16,6 +16,13 @@ delete_registry_key() { kubectl --namespace $1-$2 delete secret ${1}-docker-registry-key } +delete_certs_secret() { + if [ -d $LOCATION/config/certs/$i/ ]; then + kubectl delete secret secret-$1-$2 -n $1-$2 + fi +} + + delete_app_helm() { helm delete $1-$2 --purge } @@ -36,8 +43,9 @@ EOF NS= INCL_SVC=false APP= +LOCATION="../" -while getopts ":n:u:s:a:" PARAM; do +while getopts ":n:u:s:a:l:" PARAM; do case $PARAM in u) usage @@ -53,6 +61,9 @@ while getopts ":n:u:s:a:" PARAM; do exit 1 fi ;; + l) + LOCATION=${OPTARG} + ;; ?) usage exit @@ -74,6 +85,7 @@ printf "\n********** Cleaning up ONAP: ${ONAP_APPS[*]}\n" for i in ${HELM_APPS[@]}; do + delete_certs_secret $NS $i delete_app_helm $NS $i delete_namespace $NS $i diff --git a/kubernetes/oneclick/setenv.bash b/kubernetes/oneclick/setenv.bash index 8fd8cd4d3c..4b0d9403ca 100644 --- a/kubernetes/oneclick/setenv.bash +++ b/kubernetes/oneclick/setenv.bash @@ -1,6 +1,6 @@ #!/bin/bash -HELM_APPS=('mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'appc' 'aai' 'sdc') +HELM_APPS=('mso' 'message-router' 'sdnc' 'vid' 'robot' 'portal' 'policy' 'appc' 'aai' 'sdc' 'dcae') ONAP_DOCKER_REGISTRY=${ONAP_DOCKER_REGISTRY:-nexus3.onap.org:10001} ONAP_DOCKER_USER=${ONAP_DOCKER_USER:-docker} ONAP_DOCKER_PASS=${ONAP_DOCKER_PASS:-docker} |