Pin Juju 2.8.3
[osm/devops.git] / installers / charmed_install.sh
index f5d1389..bed7a14 100755 (executable)
@@ -27,7 +27,7 @@ function check_arguments(){
             --lxd) LXD_CLOUD="$2" ;;
             --lxd-cred) LXD_CREDENTIALS="$2" ;;
             --microstack) MICROSTACK=y ;;
-            --ha) BUNDLE="osm-ha" ;;
+            --ha) BUNDLE="cs:osm-ha-39" ;;
             --tag) TAG="$2" ;;
         esac
         shift
@@ -49,6 +49,7 @@ function install_snaps(){
         export KUBECONFIG=${KUBECFG}
         KUBEGRP=$(id -g -n)
     fi
+    sleep 10
     sudo snap install juju --classic --channel=2.8/stable
 }
 
@@ -74,7 +75,9 @@ EOF
 
     if [ -v KUBECFG ]; then
         cat $KUBECFG | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
-        [ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME --config controller-service-type=loadbalancer
+        [ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME \
+            --config controller-service-type=loadbalancer \
+            --agent-version=2.8.3
     else
         sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
         sg ${KUBEGRP} -c "microk8s.enable storage dns"
@@ -88,15 +91,17 @@ EOF
                 sg ${KUBEGRP} -c "microk8s.status"
                 exit 1
             fi
-            sg ${KUBEGRP} -c "microk8s.status" | grep 'storage: enabled'
-            if [ $? -eq 0 ]; then
+            storage_status=`sg ${KUBEGRP} -c "microk8s.status -a storage"`
+            if [[ $storage_status == "enabled" ]]; then
                 break
             fi
             sleep 1
         done
 
         [ ! -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "microk8s.config" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
-        [ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer" && K8S_CLOUD_NAME=microk8s
+        [ -v BOOTSTRAP_NEEDED ] && sg ${KUBEGRP} -c \
+            "juju bootstrap microk8s $CONTROLLER_NAME --config controller-service-type=loadbalancer --agent-version=2.8.1" \
+            && K8S_CLOUD_NAME=microk8s
     fi
 
     if [ -v LXD_CLOUD ]; then
@@ -193,7 +198,7 @@ function deploy_charmed_osm(){
     if [ -v BUNDLE ]; then
         juju deploy $BUNDLE --overlay ~/.osm/vca-overlay.yaml $images_overlay
     else
-        juju deploy osm --overlay ~/.osm/vca-overlay.yaml $images_overlay
+        juju deploy cs:osm-49 --overlay ~/.osm/vca-overlay.yaml $images_overlay
     fi
 
     echo "Waiting for deployment to finish..."
@@ -234,7 +239,8 @@ function deploy_charmed_osm(){
 function check_osm_deployed() {
     TIME_TO_WAIT=600
     start_time="$(date -u +%s)"
-    total_service_count=14
+    total_service_count=15
+    previous_count=0
     while true
     do
         service_count=$(juju status | grep kubernetes | grep active | wc -l)
@@ -242,6 +248,10 @@ function check_osm_deployed() {
         if [ $service_count -eq $total_service_count ]; then
             break
         fi
+        if [ $service_count -ne $previous_count ]; then
+            previous_count=$service_count
+            start_time="$(date -u +%s)"
+        fi
         now="$(date -u +%s)"
         if [[ $(( now - start_time )) -gt $TIME_TO_WAIT ]];then
             echo "Timed out waiting for OSM services to become ready"
@@ -373,14 +383,16 @@ if [ -v MICROSTACK ]; then
     install_microstack
 fi
 
+OSM_HOSTNAME=$(juju config nbi-k8s juju-external-hostname):443
+
 echo "Your installation is now complete, follow these steps for configuring the osmclient:"
 echo
 echo "1. Create the OSM_HOSTNAME environment variable with the NBI IP"
 echo
-echo "export OSM_HOSTNAME=nbi.$API_SERVER.xip.io:443"
+echo "export OSM_HOSTNAME=$OSM_HOSTNAME"
 echo
 echo "2. Add the previous command to your .bashrc for other Shell sessions"
 echo
-echo "echo \"export OSM_HOSTNAME=nbi.$API_SERVER.xip.io:443\" >> ~/.bashrc"
+echo "echo \"export OSM_HOSTNAME=$OSM_HOSTNAME\" >> ~/.bashrc"
 echo
 echo "DONE"