X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharmed_install.sh;h=d4f0b8f7d1dfa4502194a1a27a1704b16e65563e;hb=62e6044e4e5feded25e1a0c781d386d301841b3c;hp=be6b3819d352309093a262807dfe1662d8d111de;hpb=838e3fd080fe021ea96e855455d41a5cedd8c62d;p=osm%2Fdevops.git diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index be6b3819..d4f0b8f7 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -74,7 +74,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.1 else sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb" sg ${KUBEGRP} -c "microk8s.enable storage dns" @@ -88,15 +90,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 @@ -195,8 +199,9 @@ function deploy_charmed_osm(){ else juju deploy osm --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" @@ -217,34 +222,33 @@ function deploy_charmed_osm(){ 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=14 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 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