Pin Juju 2.8.3

Updates the juju version and also pins the charmed bundle
versions.

Increases the install timeout by checking for 10 minutes
where no services progress at all, vs 10 minutes total
time.

Fixes bug 1229

Change-Id: I95db91162ad646a2d04b351558ae5f8b64ea579c
Signed-off-by: beierlm <mark.beierl@canonical.com>
diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh
index d4f0b8f..bed7a14 100755
--- a/installers/charmed_install.sh
+++ b/installers/charmed_install.sh
@@ -27,7 +27,7 @@
             --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 @@
         export KUBECONFIG=${KUBECFG}
         KUBEGRP=$(id -g -n)
     fi
+    sleep 10
     sudo snap install juju --classic --channel=2.8/stable
 }
 
@@ -76,7 +77,7 @@
         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 \
-            --agent-version=2.8.1
+            --agent-version=2.8.3
     else
         sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
         sg ${KUBEGRP} -c "microk8s.enable storage dns"
@@ -197,7 +198,7 @@
     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..."
@@ -238,7 +239,8 @@
 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)
@@ -246,6 +248,10 @@
         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"
@@ -377,14 +383,16 @@
     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"
diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh
index 2c0aa5c..c6499cd 100755
--- a/installers/full_install_osm.sh
+++ b/installers/full_install_osm.sh
@@ -416,7 +416,7 @@
     if ! juju show-controller $OSM_STACK_NAME &> /dev/null; then
         # Not found created, create the controller
         sudo usermod -a -G lxd ${USER}
-        sg lxd -c "juju bootstrap --bootstrap-series=xenial --agent-version=2.8.1 $OSM_VCA_CLOUDNAME $OSM_STACK_NAME"
+        sg lxd -c "juju bootstrap --bootstrap-series=xenial --agent-version=2.8.3 $OSM_VCA_CLOUDNAME $OSM_STACK_NAME"
     fi
     [ $(juju controllers | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
     juju controller-config features=[k8s-operators]