+#deploy charmed services
+function deploy_charmed_services() {
+ juju add-model $OSM_STACK_NAME $OSM_VCA_K8S_CLOUDNAME
+ # deploy mongodb charm
+ namespace=$OSM_STACK_NAME
+ juju deploy cs:~charmed-osm/mongodb-k8s \
+ --config enable-sidecar=true \
+ --config replica-set=rs0 \
+ --config namespace=$namespace \
+ -m $namespace
+}
+
+function deploy_osm_pla_service() {
+ # corresponding to namespace_vol
+ $WORKDIR_SUDO sed -i "s#path: /var/lib/osm#path: $OSM_NAMESPACE_VOL#g" $OSM_DOCKER_WORK_DIR/osm_pla/pla.yaml
+ # corresponding to deploy_osm_services
+ kubectl apply -n $OSM_STACK_NAME -f $OSM_DOCKER_WORK_DIR/osm_pla
+}
+
+#Install helm and tiller
+function install_helm() {
+ helm > /dev/null 2>&1
+ if [ $? != 0 ] ; then
+ # Helm is not installed. Install helm
+ echo "Helm is not installed, installing ..."
+ curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz
+ tar -zxvf helm-v2.15.2.tar.gz
+ sudo mv linux-amd64/helm /usr/local/bin/helm
+ rm -r linux-amd64
+ rm helm-v2.15.2.tar.gz
+ fi
+
+ # Checking if tiller has being configured
+ kubectl --namespace kube-system get serviceaccount tiller > /dev/null 2>&1
+ if [ $? == 1 ] ; then
+ # tiller account for kubernetes
+ kubectl --namespace kube-system create serviceaccount tiller
+ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
+ # HELM initialization
+ helm init --service-account tiller
+
+ # Wait for Tiller to be up and running. If timeout expires, continue installing
+ tiller_timeout=120;
+ counter=0;
+ tiller_status=""
+ while (( counter < tiller_timeout ))
+ do
+ tiller_status=`kubectl -n kube-system get deployment.apps/tiller-deploy --no-headers | awk '{print $2'}`
+ ( [ ! -z "$tiller_status" ] && [ $tiller_status == "1/1" ] ) && echo "Tiller ready" && break
+ counter=$((counter + 5))
+ sleep 5
+ done
+ [ "$tiller_status" != "1/1" ] && echo "Tiller is NOT READY YET. Installation will continue"
+ fi
+}
+