X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharmed_install.sh;h=9fda5166ff9189c525e9f7a8272a8db173ac1e6e;hb=c52339680d17351fd5c873d82292d4c63af81c70;hp=d4f0b8f7d1dfa4502194a1a27a1704b16e65563e;hpb=62e6044e4e5feded25e1a0c781d386d301841b3c;p=osm%2Fdevops.git diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index d4f0b8f7..9fda5166 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -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 @@ -43,6 +43,7 @@ function install_snaps(){ mkdir -p ~/.kube sudo chown -f -R `whoami` ~/.kube KUBEGRP="microk8s" + microk8s status --wait-ready else KUBECTL="kubectl" sudo snap install kubectl --classic @@ -67,6 +68,17 @@ using this command: juju destroy-controller --release-storage --destroy-all-models -y ${CONTROLLER_NAME} Please retry the installation once this conflict has been resolved. +EOF + exit 1 + fi + else + CONTROLLER_PRESENT=$(juju controllers 2>/dev/null| grep ${CONTROLLER_NAME} | wc -l) + if [ $CONTROLLER_PRESENT -le 0 ]; then + cat << EOF +Threre is no VCA present with the name "${CONTROLLER_NAME}". Please specify a VCA +that exists, or remove the --vca ${CONTROLLER_NAME} option. + +Please retry the installation with one of the solutions applied. EOF exit 1 fi @@ -79,6 +91,7 @@ EOF --agent-version=2.8.1 else sg ${KUBEGRP} -c "echo ${DEFAULT_IP}-${DEFAULT_IP} | microk8s.enable metallb" + sg ${KUBEGRP} -c "microk8s.enable ingress" sg ${KUBEGRP} -c "microk8s.enable storage dns" TIME_TO_WAIT=30 start_time="$(date -u +%s)" @@ -159,7 +172,6 @@ EOF juju add-cloud -c $CONTROLLER_NAME lxd-cloud $LXD_CLOUD --force juju add-credential -c $CONTROLLER_NAME lxd-cloud -f $LXD_CREDENTIALS sg lxd -c "lxd waitready" - #juju add-model test lxd-cloud || true juju controller-config features=[k8s-operators] } @@ -176,7 +188,7 @@ function wait_for_port(){ exit 1 fi - if [ $(sg ${KUBEGRP} -c "${KUBECTL} get ingress -n osm -o json | jq -r '.items[$INDEX].metadata.name'") == ${SERVICE} ] ; then + if [ $(sg ${KUBEGRP} -c "${KUBECTL} get ingresses.networking -n osm -o json | jq -r '.items[$INDEX].metadata.name'") == ${SERVICE} ] ; then break fi sleep 1 @@ -197,14 +209,13 @@ 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..." check_osm_deployed echo "OSM with charms deployed" if [ ! -v KUBECFG ]; then - sg ${KUBEGRP} -c "microk8s.enable ingress" API_SERVER=${DEFAULT_IP} else API_SERVER=$(kubectl config view --minify | grep server | cut -f 2- -d ":" | tr -d " ") @@ -215,30 +226,44 @@ function deploy_charmed_osm(){ API_SERVER="$(echo $hostport | sed -e 's,:.*,,g')" fi + # Expose OSM services + # Expose Grafana + juju config grafana-k8s juju-external-hostname=grafana.${API_SERVER}.xip.io + juju expose grafana-k8s + wait_for_port grafana-k8s 0 + + # Expose NBI juju config nbi-k8s juju-external-hostname=nbi.${API_SERVER}.xip.io juju expose nbi-k8s + wait_for_port nbi-k8s 1 - wait_for_port nbi-k8s 0 - 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 -" - + # Expose NG UI juju config ng-ui juju-external-hostname=ui.${API_SERVER}.xip.io juju expose ng-ui + wait_for_port ng-ui 2 - 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} --validate=false replace -f -" + # Expose Prometheus + juju config prometheus-k8s juju-external-hostname=prometheus.${API_SERVER}.xip.io + juju expose prometheus-k8s + wait_for_port prometheus-k8s 3 + # Expose UI juju config ui-k8s juju-external-hostname=osm.${API_SERVER}.xip.io juju expose ui-k8s + wait_for_port ui-k8s 4 - 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} --validate=false replace -f -" + # Apply annotations + sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/backend-protocol=HTTPS -n osm -l juju-app=nbi-k8s" + sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/proxy-body-size=0 -n osm -l juju-app=nbi-k8s" + sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/proxy-body-size=0 -n osm -l juju-app=ng-ui" + sg ${KUBEGRP} -c "${KUBECTL} annotate ingresses.networking nginx.ingress.kubernetes.io/proxy-body-size=0 -n osm -l juju-app=ui-k8s" } 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 +271,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" @@ -377,14 +406,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"