Merge "This cannot proceed until NG-UI artifacts are produced."
authorbeierlm <mark.beierl@canonical.com>
Wed, 27 May 2020 14:57:12 +0000 (16:57 +0200)
committerGerrit Code Review <root@osm.etsi.org>
Wed, 27 May 2020 14:57:12 +0000 (16:57 +0200)
1  2 
installers/full_install_osm.sh

@@@ -27,7 -27,6 +27,6 @@@ function usage()
      echo -e "                     -b tags/v1.1.0     (a specific tag)"
      echo -e "                     ..."
      echo -e "     -c <orchestrator> deploy osm services using container <orchestrator>. Valid values are <k8s> or <swarm>.  If -c is not used then osm will be deployed using default orchestrator. When used with --uninstall, osm services deployed by the orchestrator will be uninstalled"
-     echo -e "     -n <ui> install OSM with Next Gen UI. Valid values are <lwui> or <ngui>. If -n is not specified osm will be installed with light-ui. When used with uninstall, osm along with the UI specified will be uninstalled"
      echo -e "     -s <stack name> or <namespace>  user defined stack name when installed using swarm or namespace when installed using k8s, default is osm"
      echo -e "     -H <VCA host>   use specific juju host controller IP"
      echo -e "     -S <VCA secret> use VCA/juju secret key"
@@@ -38,7 -37,7 +37,7 @@@
      echo -e "     --elk_stack:    additionally deploy an ELK docker stack for event logging"
      echo -e "     --pla:          install the PLA module for placement support"
      echo -e "     -m <MODULE>:    install OSM but only rebuild the specified docker images (LW-UI, NBI, LCM, RO, MON, POL, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, PLA, NONE)"
 -    echo -e "     -o <ADDON>:     ONLY (un)installs one of the addons (vimemu, elk_stack)"
 +    echo -e "     -o <ADDON>:     ONLY (un)installs one of the addons (vimemu, elk_stack, k8s_monitor)"
      echo -e "     -D <devops path> use local devops installation path"
      echo -e "     -w <work dir>   Location to store runtime installation"
      echo -e "     -t <docker tag> specify osm docker tag (default is latest)"
@@@ -55,7 -54,7 +54,7 @@@
      echo -e "     --source:       install OSM from source code using the latest stable tag"
      echo -e "     --develop:      (deprecated, use '-b master') install OSM from source code using the master branch"
      echo -e "     --pullimages:   pull/run osm images from docker.io/opensourcemano"
 -    echo -e "     --k8s_monitor:  install the OSM kubernetes moitoring with prometheus and grafana"
 +    echo -e "     --k8s_monitor:  install the OSM kubernetes monitoring with prometheus and grafana"
  #    echo -e "     --reconfigure:  reconfigure the modules (DO NOT change NAT rules)"
  #    echo -e "     --update:       update to the latest stable release or to the latest commit if using a specific branch"
      echo -e "     --showopts:     print chosen options and exit (only for debugging)"
@@@ -168,17 -167,6 +167,17 @@@ function remove_k8s_namespace() 
      kubectl delete ns $1
  }
  
 +#removes helm only if there is nothing deployed in helm
 +function remove_helm() {
 +    if [ "$(helm ls -q)" == "" ] ; then
 +        sudo helm reset --force
 +        kubectl delete --namespace kube-system serviceaccount tiller
 +        kubectl delete clusterrolebinding tiller-cluster-rule
 +        sudo rm /usr/local/bin/helm
 +        rm -rf $HOME/.helm
 +    fi
 +}
 +
  #Uninstall osmclient
  function uninstall_osmclient() {
      sudo apt-get remove --purge -y python-osmclient
@@@ -210,6 -198,7 +209,7 @@@ function uninstall_lightweight() 
          newgrp docker << EONG
          docker image rm ${DOCKER_USER}/ro:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/lcm:${OSM_DOCKER_TAG}
+         docker image rm ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/keystone:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/nbi:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/mon:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/pla:${OSM_DOCKER_TAG}
          docker image rm ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}
  EONG
-         if [ -n "$NGUI" ]; then
-             newgrp docker << EONG
-             docker image rm ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}
- EONG
-         else
-             newgrp docker << EONG
-             docker image rm ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}
- EONG
-          fi
  
          if [ -n "$KUBERNETES" ]; then
              OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
@@@ -520,23 -500,13 +511,13 @@@ function generate_docker_images() 
          sg docker -c "docker build ${LWTEMPDIR}/LCM -f ${LWTEMPDIR}/LCM/Dockerfile.local -t ${DOCKER_USER}/lcm --no-cache" || FATAL "cannot build LCM docker image"
      fi
  
-     if [ -n "$NGUI" ]; then
-         if [ -n "$PULL_IMAGES" ]; then
-             sg docker -c "docker pull ${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull ng-ui docker image"
-         elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q NG-UI ; then
-             git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/NG-UI
-             git -C ${LWTEMPDIR}/NG-UI checkout ${COMMIT_ID}
-             sg docker -c "docker build ${LWTEMPDIR}/NG-UI -f ${LWTEMPDIR}/NG-UI/docker/Dockerfile -t ${DOCKER_USER}/ng-ui --no-cache" || FATAL "cannot build NG-UI docker image"
-         fi
-     else
-         if [ -n "$PULL_IMAGES" ]; then
-             sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
-         elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
-             git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
-             git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
-             sg docker -c "docker build ${LWTEMPDIR}/LW-UI -f ${LWTEMPDIR}/LW-UI/docker/Dockerfile -t ${DOCKER_USER}/light-ui --no-cache" || FATAL "cannot build LW-UI docker image"
-         fi
-      fi
+     if [ -n "$PULL_IMAGES" ]; then
+         sg docker -c "docker pull ${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" || FATAL "cannot pull light-ui docker image"
+     elif [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q LW-UI ; then
+         git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/LW-UI
+         git -C ${LWTEMPDIR}/LW-UI checkout ${COMMIT_ID}
+         sg docker -c "docker build ${LWTEMPDIR}/LW-UI -f ${LWTEMPDIR}/LW-UI/docker/Dockerfile -t ${DOCKER_USER}/light-ui --no-cache" || FATAL "cannot build LW-UI docker image"
+     fi
  
      if [ -n "$PULL_IMAGES" ]; then
          sg docker -c "docker pull ${DOCKER_USER}/osmclient:${OSM_DOCKER_TAG}" || FATAL "cannot pull osmclient docker image"
  
      if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q PROMETHEUS ; then
          sg docker -c "docker pull google/cadvisor:${PROMETHEUS_CADVISOR_TAG}" || FATAL "cannot get prometheus cadvisor docker image"
-     fi
+     fi    
  
      echo "Finished generation of docker images"
  }
@@@ -579,15 -549,9 +560,9 @@@ function generate_docker_env_files() 
      if [ -n "$KUBERNETES" ]; then
          #Kubernetes resources
          $WORKDIR_SUDO cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR
-         [ -n "$NGUI" ] && $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_pods/ng-ui.yaml $OSM_K8S_WORK_DIR/ng-ui.yaml && $WORKDIR_SUDO rm $OSM_K8S_WORK_DIR/light-ui.yaml
      else
-         if [ -n "$NGUI" ]; then
-             # For NG-UI
-             $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose-ngui.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
-         else
-             # Docker-compose
-             $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
-         fi
+         # Docker-compose
+         $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml
          if [ -n "$INSTALL_PLA" ]; then
              $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/osm_pla/docker-compose.yaml $OSM_DOCKER_WORK_DIR/osm_pla/docker-compose.yaml
          fi
@@@ -797,44 -761,11 +772,44 @@@ function deploy_osm_pla_service() 
      kubectl apply -n $OSM_STACK_NAME -f $OSM_DOCKER_WORK_DIR/osm_pla
  }
  
 +#Install helm and tiller
 +function install_helm() {
 +    helm > /dev/null 2>&1
 +    if [ $? != 0 ] ; then
 +        # Helm is not installed. Install helm
 +        curl https://get.helm.sh/helm-v2.15.2-linux-amd64.tar.gz --output helm-v2.15.2.tar.gz
 +        tar -zxvf helm-v2.15.2.tar.gz
 +        sudo mv linux-amd64/helm /usr/local/bin/helm
 +        rm -r linux-amd64
 +        rm helm-v2.15.2.tar.gz
 +    fi
 +
 +    # Checking if tiller has being configured
 +    kubectl --namespace kube-system get serviceaccount tiller > /dev/null 2>&1
 +    if [ $? == 1 ] ; then
 +        # tiller account for kubernetes
 +        kubectl --namespace kube-system create serviceaccount tiller
 +        kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
 +        # HELM initialization
 +        helm init --service-account tiller
 +
 +        # Wait for Tiller to be up and running. If timeout expires, continue installing
 +        tiller_timeout=120; counter=0
 +        while (( counter < tiller_timeout ))
 +        do
 +            tiller_status=`kubectl -n kube-system get deployment.apps/tiller-deploy --no-headers |  awk '{print $2'}`
 +            ( [ ! -z "$tiller_status" ] && [ $tiller_status == "1/1" ] ) && break
 +            num=$((counter + 2))
 +            sleep 2
 +        done
 +    fi
 +}
 +
  function parse_yaml() {
-     osm_services="nbi lcm ro pol mon light-ui ng-ui keystone"
+     osm_services="nbi lcm ro pol mon light-ui keystone"
      TAG=$1
      for osm in $osm_services; do
-         $WORKDIR_SUDO sed -i "s/opensourcemano\/$osm:.*/$DOCKER_USER\/$osm:$TAG/g" $OSM_K8S_WORK_DIR/$osm.yaml
+         $WORKDIR_SUDO sed -i "s/opensourcemano\/$osm:.*/opensourcemano\/$osm:$TAG/g" $OSM_K8S_WORK_DIR/$osm.yaml
      done
  }
  
@@@ -1250,7 -1181,6 +1225,6 @@@ function dump_vars()
      echo "OSM_STACK_NAME=$OSM_STACK_NAME"
      echo "PULL_IMAGES=$PULL_IMAGES"
      echo "KUBERNETES=$KUBERNETES"
-     echo "NGUI=$NGUI"
      echo "SHOWOPTS=$SHOWOPTS"
      echo "Install from specific refspec (-b): $COMMIT_ID"
  }
@@@ -1293,7 -1223,6 +1267,6 @@@ INSTALL_NOLXD="
  INSTALL_NODOCKER=""
  INSTALL_NOJUJU=""
  KUBERNETES=""
- NGUI=""
  INSTALL_K8S_MONITOR=""
  INSTALL_NOHOSTCLIENT=""
  SESSION_ID=`date +%s`
@@@ -1329,7 -1258,7 +1302,7 @@@ POD_NETWORK_CIDR=10.244.0.0/1
  K8S_MANIFEST_DIR="/etc/kubernetes/manifests"
  RE_CHECK='^[a-z0-9]([-a-z0-9]*[a-z0-9])?$'
  
- while getopts ":b:r:c:n:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
+ while getopts ":b:r:c:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
      case "${o}" in
          b)
              COMMIT_ID=${OPTARG}
              echo -e "Invalid argument for -i : ' $OPTARG'\n" >&2
              usage && exit 1
              ;;
-         n)
-             [ "${OPTARG}" == "lwui" ] && continue
-             [ "${OPTARG}" == "ngui" ] && NGUI="y" && continue
-             echo -e "Invalid argument for -n : ' $OPTARG'\n" >&2
-             usage && exit 1
-             ;;
          k)
              REPOSITORY_KEY="${OPTARG}"
              REPO_ARGS+=(-k "$REPOSITORY_KEY")
@@@ -1583,4 -1506,3 +1550,4 @@@ wget -q -O- https://osm-download.etsi.o
  track end
  echo -e "\nDONE"
  
 +