X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharmed_install.sh;h=4cee0a3751bec1ad6c201a95add23b46661f6552;hb=HEAD;hp=975cbbdcb8de601e10304f0ca1d92a9651564bf3;hpb=d8b4673088b0a120e3e6a2dcdafd40aee8799662;p=osm%2Fdevops.git diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index 975cbbdc..1e406ddb 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -76,6 +76,11 @@ function install_snaps(){ sudo snap install microk8s --classic --channel=${MICROK8S_VERSION}/stable || FATAL_TRACK k8scluster "snap install microk8s ${MICROK8S_VERSION}/stable failed" sudo usermod -a -G microk8s `whoami` + # Workaround bug in calico MTU detection + if [ ${DEFAULT_IF_MTU} -ne 1500 ] ; then + sudo mkdir -p /var/lib/calico + sudo ln -sf /var/snap/microk8s/current/var/lib/calico/mtu /var/lib/calico/mtu + fi sudo cat /var/snap/microk8s/current/args/kube-apiserver | grep advertise-address || ( echo "--advertise-address $DEFAULT_IP" | sudo tee -a /var/snap/microk8s/current/args/kube-apiserver sg ${KUBEGRP} -c microk8s.stop @@ -278,17 +283,7 @@ function deploy_charmed_osm(){ hostport="$(echo ${url/$user@/} | cut -d/ -f1)" API_SERVER="$(echo $hostport | sed -e 's,:.*,,g')" fi - - configure_vca_integrator - expose_osm_services - echo "Waiting for deployment to finish..." - check_osm_deployed_before_config - config_grafana_and_prometheus - check_osm_deployed_after_config - echo "OSM with charms deployed" -} - -function configure_vca_integrator(){ + # Configure VCA Integrator if [ ! -v INSTALL_NOLXD ]; then juju config vca \ k8s-cloud=microk8s \ @@ -303,61 +298,22 @@ function configure_vca_integrator(){ accounts="`cat ~/.local/share/juju/accounts.yaml`" \ public-key="`cat ~/.local/share/juju/ssh/juju_id_rsa.pub`" fi -} - -function expose_osm_services(){ + # Expose OSM services juju config -m $MODEL_NAME nbi external-hostname=nbi.${API_SERVER}.nip.io juju config -m $MODEL_NAME ng-ui external-hostname=ui.${API_SERVER}.nip.io - juju config -m $MODEL_NAME grafana web_external_url=https://grafana.${API_SERVER}.nip.io -} + juju config -m $MODEL_NAME grafana site_url=https://grafana.${API_SERVER}.nip.io + juju config -m $MODEL_NAME prometheus site_url=https://prometheus.${API_SERVER}.nip.io -function config_grafana_and_prometheus() { - echo "Setting Grafana and Prometheus configuration" + echo "Waiting for deployment to finish..." + check_osm_deployed grafana_leader=`juju status -m $MODEL_NAME grafana | grep "*" | cut -d "*" -f 1` - grafana_admin_password=`juju run-action -m $MODEL_NAME $grafana_leader get-admin-password --wait | grep "admin-password" | cut -d ":" -f 2` - juju config -m $MODEL_NAME mon grafana-password="$grafana_admin_password" - juju config -m $MODEL_NAME mon grafana-user=admin - juju config -m $MODEL_NAME mon grafana-url=http://grafana:3000 - prometheus_url="http://prometheus:9090" - juju config -m $MODEL_NAME mon prometheus-url=$prometheus_url - juju config -m $MODEL_NAME nbi prometheus-url=$prometheus_url - mon_leader=`juju status -m $MODEL_NAME mon | grep "*" | cut -d "*" -f 1` - juju run-action --m $MODEL_NAME $mon_leader create-datasource name=osm_prometheus url=$prometheus_url --wait -} - -function check_osm_deployed_before_config() { - TIME_TO_WAIT=600 - start_time="$(date -u +%s)" - total_active_services=13 - [ -n "$INSTALL_PLA" ] && total_active_services=$((total_active_services + 1)) - previous_count=0 - while true - do - juju_status=$(juju status --format json -m $MODEL_NAME) - active_service_count=$(echo $juju_status | jq '.applications[]."application-status".current'| grep active | wc -l) - echo "$active_service_count / $total_active_services services active" - if [ $active_service_count -eq $total_active_services ]; then - mon_is_blocked=$(echo $juju_status | jq '.applications["mon"].units[]."workload-status".current' | grep blocked | wc -l) - nbi_is_blocked=$(echo $juju_status | jq '.applications["nbi"].units[]."workload-status".current' | grep blocked | wc -l) - if [ $mon_is_blocked -a $nbi_is_blocked ]; then - echo "MON and NBI are blocked" - break - fi - fi - if [ $active_service_count -ne $previous_count ]; then - previous_count=$active_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" - FATAL_TRACK deploy_osm "Timed out waiting for services to become ready" - fi - sleep 10 - done + grafana_admin_password=`juju run -m $MODEL_NAME --unit $grafana_leader "echo \\$GF_SECURITY_ADMIN_PASSWORD"` + juju config -m $MODEL_NAME mon grafana-password=$grafana_admin_password + check_osm_deployed + echo "OSM with charms deployed" } -function check_osm_deployed_after_config() { +function check_osm_deployed() { TIME_TO_WAIT=600 start_time="$(date -u +%s)" total_service_count=15 @@ -384,6 +340,8 @@ function check_osm_deployed_after_config() { } function generate_password_overlay() { + # prometheus + web_config_password=`openssl rand -hex 16` # keystone keystone_db_password=`openssl rand -hex 16` keystone_admin_password=`openssl rand -hex 16` @@ -393,6 +351,9 @@ function generate_password_overlay() { mariadb_root_password=`openssl rand -hex 16` cat << EOF > /tmp/password-overlay.yaml applications: + prometheus: + options: + web_config_password: $web_config_password keystone: options: keystone-db-password: $keystone_db_password @@ -582,6 +543,7 @@ function install_microstack() { DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5; exit}'` DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]; exit}'` +DEFAULT_IF_MTU=`ip a show ${DEFAULT_IF} | grep mtu | awk '{print $5}'` check_arguments $@ mkdir -p ~/.osm