--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
export KUBECONFIG=${KUBECFG}
KUBEGRP=$(id -g -n)
fi
+ sleep 10
sudo snap install juju --classic --channel=2.8/stable
}
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.1
else
sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb"
sg ${KUBEGRP} -c "microk8s.enable storage dns"
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
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..."
- check_osm_deployed &> /dev/null
+ check_osm_deployed
echo "OSM with charms deployed"
if [ ! -v KUBECFG ]; then
sg ${KUBEGRP} -c "microk8s.enable ingress"
sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[0].metadata.annotations += {\"nginx.ingress.kubernetes.io/backend-protocol\": \"HTTPS\"}' | ${KUBECTL} --validate=false replace -f -"
sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[0].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} replace -f -"
- juju config ng-ui juju-external-hostname=ngui.${API_SERVER}.xip.io
+ juju config ng-ui juju-external-hostname=ui.${API_SERVER}.xip.io
juju expose ng-ui
wait_for_port ng-ui 1
- sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[2].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} replace -f -"
+ sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[2].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} --validate=false replace -f -"
juju config ui-k8s juju-external-hostname=osm.${API_SERVER}.xip.io
juju expose ui-k8s
wait_for_port ui-k8s 2
- sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[1].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} replace -f -"
+ sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq '.items[1].metadata.annotations += {\"nginx.ingress.kubernetes.io/proxy-body-size\": \"0\"}' | ${KUBECTL} --validate=false replace -f -"
}
function check_osm_deployed() {
- TIME_TO_WAIT=300
+ TIME_TO_WAIT=600
start_time="$(date -u +%s)"
+ total_service_count=15
+ previous_count=0
while true
do
- pod_name=`sg ${KUBEGRP} -c "${KUBECTL} -n osm get pods | grep ui-k8s | grep -v operator" | awk '{print $1; exit}'`
-
- if [[ `sg ${KUBEGRP} -c "${KUBECTL} -n osm wait pod $pod_name --for condition=Ready"` ]]; then
- if [[ `sg ${KUBEGRP} -c "${KUBECTL} -n osm wait pod lcm-k8s-0 --for condition=Ready"` ]]; then
- break
- fi
+ service_count=$(juju status | grep kubernetes | grep active | wc -l)
+ echo "$service_count / $total_service_count services active"
+ 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 "Timeout waiting for services to enter ready state"
+ echo "Timed out waiting for OSM services to become ready"
exit 1
fi
sleep 10
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"