diff options
Diffstat (limited to 'kubernetes/oneclick/createAll.bash')
-rwxr-xr-x | kubernetes/oneclick/createAll.bash | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/kubernetes/oneclick/createAll.bash b/kubernetes/oneclick/createAll.bash index 5a99b19623..b7d6a64ffb 100755 --- a/kubernetes/oneclick/createAll.bash +++ b/kubernetes/oneclick/createAll.bash @@ -27,19 +27,20 @@ check_return_code(){ } create_service_account() { - cmd=`echo kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1-$2:default` +# cmd=`echo kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1-$2:default` + cmd=`echo kubectl create clusterrolebinding $1-$2-admin-binding --clusterrole=cluster-admin --serviceaccount=$1:default` eval ${cmd} check_return_code $cmd } create_namespace() { - cmd=`echo kubectl create namespace $1-$2` + cmd=`echo kubectl create namespace $1` eval ${cmd} - check_return_code $cmd } 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` +# cmd=`echo 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 create secret docker-registry $2 --docker-server=$3 --docker-username=$4 --docker-password=$5 --docker-email=$6` eval ${cmd} check_return_code $cmd } @@ -86,8 +87,8 @@ create_onap_helm() { # assign default auth token if [[ -z $ONAP_DEFAULT_AUTH_TOKEN ]]; then - DEFAULT_SECRET=`kubectl get secrets -n $1-$2 | grep default-token | awk '{ print $1}'` - ONAP_DEFAULT_AUTH_TOKEN=`kubectl get secrets $DEFAULT_SECRET -n $1-$2 -o yaml | grep 'token:' | awk '{ print $2}' | base64 --decode` + DEFAULT_SECRET=`kubectl get secrets -n $1 | grep default-token | awk '{ print $1}'` + ONAP_DEFAULT_AUTH_TOKEN=`kubectl get secrets $DEFAULT_SECRET -n $1 -o yaml | grep 'token:' | awk '{ print $2}' | base64 --decode` fi cmd=`echo helm install $LOCATION/$2/ --name $1-$2 --namespace $1 --set nsPrefix=$1,nodePortPrefix=$3,kubeMasterAuthToken=$ONAP_DEFAULT_AUTH_TOKEN ${HELM_VALUES_ADDITION}` @@ -106,6 +107,8 @@ MAX_INSTANCE=5 DU=$ONAP_DOCKER_USER DP=$ONAP_DOCKER_PASS +SINGLE_COMPONENT=false + while getopts ":n:u:s:i:a:du:dp:l:v:" PARAM; do case $PARAM in u) @@ -125,6 +128,7 @@ while getopts ":n:u:s:i:a:du:dp:l:v:" PARAM; do LOCATION=${OPTARG} ;; a) + SINGLE_COMPONENT=true APP=${OPTARG} if [[ -z $APP ]]; then usage @@ -168,19 +172,22 @@ printf "\n********** Creating instance ${INSTANCE} of ONAP with port range ${sta printf "\n********** Creating ONAP: ${ONAP_APPS[*]}\n" +if [ "$SINGLE_COMPONENT" == "false" ] +then + printf "\nCreating namespace **********\n" + create_namespace $NS + + printf "\nCreating registry secret **********\n" + create_registry_key $NS ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL +fi printf "\n\n********** Creating deployments for ${HELM_APPS[*]} ********** \n" for i in ${HELM_APPS[@]}; do - printf "\nCreating namespace **********\n" - create_namespace $NS $i printf "\nCreating service account **********\n" create_service_account $NS $i - printf "\nCreating registry secret **********\n" - create_registry_key $NS $i ${NS}-docker-registry-key $ONAP_DOCKER_REGISTRY $DU $DP $ONAP_DOCKER_MAIL - printf "\nCreating deployments and services **********\n" create_onap_helm $NS $i $start |