X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Ffull_install_osm.sh;h=90e5c1f95e63b28c075efa87d44583fad0d1cb7c;hb=413bc263cea11a166bf38d11259e153f521dd500;hp=a742155b311b86f8c1c8d0b811c8709ea8b0bb39;hpb=ef3b236c6484787152a268fcacfbacb25a4bbbca;p=osm%2Fdevops.git diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index a742155b..90e5c1f9 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -29,7 +29,6 @@ function usage(){ echo -e " -b tags/v1.1.0 (a specific tag)" echo -e " ..." echo -e " -c deploy osm services using container . Valid values are or . 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 install OSM with Next Gen UI. Valid values are or . 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 or user defined stack name when installed using swarm or namespace when installed using k8s, default is osm" echo -e " -H use specific juju host controller IP" echo -e " -S use VCA/juju secret key" @@ -39,7 +38,7 @@ function usage(){ echo -e " --vimemu: additionally deploy the VIM emulator as a docker container" 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 : install OSM but only rebuild or pull the specified docker images (LW-UI, NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)" + echo -e " -m : install OSM but only rebuild or pull the specified docker images (NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)" echo -e " -o : ONLY (un)installs one of the addons (vimemu, elk_stack, k8s_monitor)" echo -e " -O : Install OSM to an OpenStack infrastructure. is required. If a is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/" echo -e " -N : Public network name required to setup OSM to OpenStack" @@ -54,6 +53,7 @@ function usage(){ echo -e " -d use docker registry URL instead of dockerhub" echo -e " -p set docker proxy URL as part of docker CE configuration" echo -e " -T specify docker tag for the modules specified with option -m" + echo -e " --nocachelxdimages: do not cache local lxd images, do not create cronjob for that cache (will save installation time, might affect instantiation time)" echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)" echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" echo -e " --nojuju: do not juju, assumes already installed" @@ -76,6 +76,7 @@ function usage(){ echo -e " [--lxd ]: Takes a YAML file as a parameter with the LXD Cloud information (--charmed option)" echo -e " [--lxd-cred ]: Takes a YAML file as a parameter with the LXD Credentials information (--charmed option)" echo -e " [--microstack]: Installs microstack as a vim. (--charmed option)" + echo -e " [--overlay]: Add an overlay to override some defaults of the default bundle (--charmed option)" echo -e " [--ha]: Installs High Availability bundle. (--charmed option)" echo -e " [--tag]: Docker image tag. (--charmed option)" echo -e " [--registry]: Docker registry with optional credentials as user:pass@hostname:port (--charmed option)" @@ -137,7 +138,7 @@ function remove_iptables() { if [ -z "$DEFAULT_IP" ]; then DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') - [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}') + [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` [ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" @@ -182,8 +183,6 @@ function remove_k8s_namespace() { 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 @@ -220,18 +219,14 @@ function uninstall_lightweight() { remove_stack osm_elk fi echo "Now osm docker images and volumes will be deleted" - # TODO: clean-up of images should take into account if other tags were used for specific modules + # TODO: clean-up of images should take into account if other tags were used for specific modules newgrp docker << EONG for module in ro lcm keystone nbi mon pol pla osmclient; do docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module}:${OSM_DOCKER_TAG} done EONG - if [ -n "$NGUI" ]; then - sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" - else - sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/light-ui:${OSM_DOCKER_TAG}" - fi + sg docker -c "docker image rm ${DOCKER_REGISTRY_URL}${DOCKER_USER}/ng-ui:${OSM_DOCKER_TAG}" if [ -n "$KUBERNETES" ]; then OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}" @@ -295,7 +290,7 @@ function install_lxd() { # Install LXD snap sudo apt-get remove --purge -y liblxc1 lxc-common lxcfs lxd lxd-client - sudo snap install lxd + sudo snap install lxd --channel $LXD_VERSION/stable # Configure LXD sudo usermod -a -G lxd `whoami` @@ -339,6 +334,13 @@ function install_osmclient(){ sudo -H LC_ALL=C python3 -m pip install -U pip sudo -H LC_ALL=C python3 -m pip install -U python-magic pyangbind verboselogs sudo apt-get install -y python3-osm-im python3-osmclient + if [ -f /usr/lib/python3/dist-packages/osm_im/requirements.txt ]; then + python3 -m pip install -r /usr/lib/python3/dist-packages/osm_im/requirements.txt + fi + if [ -f /usr/lib/python3/dist-packages/osmclient/requirements.txt ]; then + sudo apt-get install -y libcurl4-openssl-dev libssl-dev + python3 -m pip install -r /usr/lib/python3/dist-packages/osmclient/requirements.txt + fi #sed 's,OSM_SOL005=[^$]*,OSM_SOL005=True,' -i ${HOME}/.bashrc #echo 'export OSM_HOSTNAME=localhost' >> ${HOME}/.bashrc #echo 'export OSM_SOL005=True' >> ${HOME}/.bashrc @@ -442,9 +444,9 @@ function install_docker_compose() { function install_juju() { echo "Installing juju" - sudo snap install juju --classic --channel=2.8/stable + sudo snap install juju --classic --channel=$JUJU_VERSION/stable [[ ":$PATH": != *":/snap/bin:"* ]] && PATH="/snap/bin:${PATH}" - update_juju_images + [ -n "$INSTALL_NOCACHELXDIMAGES" ] || update_juju_images echo "Finished installation of juju" return 0 } @@ -460,17 +462,19 @@ function juju_createcontroller() { } function juju_addk8s() { - cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --controller $OSM_STACK_NAME --storage openebs-hostpath + cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --controller $OSM_STACK_NAME --storage openebs-hostpath \ + || FATAL "Failed to add K8s endpoint and credential for controller $OSM_STACK_NAME in cloud $OSM_VCA_K8S_CLOUDNAME" } function juju_createcontroller_k8s(){ - cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --client + cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --client \ + || FATAL "Failed to add K8s endpoint and credential for client in cloud $OSM_VCA_K8S_CLOUDNAME" juju bootstrap $OSM_VCA_K8S_CLOUDNAME $OSM_STACK_NAME \ --config controller-service-type=loadbalancer \ - --agent-version=$JUJU_AGENT_VERSION + --agent-version=$JUJU_AGENT_VERSION \ + || FATAL "Failed to bootstrap controller $OSM_STACK_NAME in cloud $OSM_VCA_K8S_CLOUDNAME" } - function juju_addlxd_cloud(){ mkdir -p /tmp/.osm OSM_VCA_CLOUDNAME="lxd-cloud" @@ -511,7 +515,6 @@ EOF juju controller-config features=[k8s-operators] } - function juju_createproxy() { check_install_iptables_persistent @@ -563,26 +566,16 @@ function generate_docker_images() { if [ -n "$PULL_IMAGES" ]; then echo "Pulling OSM docker images" - for module in MON POL NBI KEYSTONE RO LCM NG-UI LW-UI PLA osmclient; do + for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA osmclient; do module_lower=${module,,} - if [ $module == "LW-UI" ]; then - if [ -n "$NGUI" ]; then - continue - else - module_lower="light-ui" - fi - fi - if [ $module == "NG-UI" -a ! -n "$NGUI" ]; then - continue - fi if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then continue fi - module_tag="${OSM_DOCKER_TAG}" + module_tag="${OSM_DOCKER_TAG}" if [ -n "${MODULE_DOCKER_TAG}" ] && echo $TO_REBUILD | grep -q $module ; then module_tag="${MODULE_DOCKER_TAG}" fi - echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image" + echo "Pulling ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag} docker image" sg docker -c "docker pull ${DOCKER_REGISTRY_URL}${DOCKER_USER}/${module_lower}:${module_tag}" || FATAL "cannot pull $module docker image" done else @@ -590,19 +583,9 @@ function generate_docker_images() { [ -z "$_build_from" ] && _build_from="latest" echo "OSM Docker images generated from $_build_from" - for module in MON POL NBI KEYSTONE RO LCM NG-UI LW-UI PLA; do + for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA; do if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then module_lower=${module,,} - if [ $module == "LW-UI" ]; then - if [ -n "$NGUI" ]; then - continue - else - module_lower="light-ui" - fi - fi - if [ $module == "NG-UI" -a ! -n "$NGUI" ]; then - continue - fi if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then continue fi @@ -638,13 +621,7 @@ function cmp_overwrite() { function generate_docker_compose_files() { $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose.yaml $OSM_DOCKER_WORK_DIR/docker-compose.yaml - 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-ui.yaml - else - # Docker-compose - $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose-lightui.yaml $OSM_DOCKER_WORK_DIR/docker-compose-ui.yaml - fi + $WORKDIR_SUDO cp -b ${OSM_DEVOPS}/installers/docker/docker-compose-ngui.yaml $OSM_DOCKER_WORK_DIR/docker-compose-ui.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 @@ -654,11 +631,6 @@ function generate_k8s_manifest_files() { #Kubernetes resources $WORKDIR_SUDO cp -bR ${OSM_DEVOPS}/installers/docker/osm_pods $OSM_DOCKER_WORK_DIR $WORKDIR_SUDO rm -f $OSM_K8S_WORK_DIR/mongo.yaml - if [ -n "$NGUI" ]; then - $WORKDIR_SUDO rm -f $OSM_K8S_WORK_DIR/light-ui.yaml - else - $WORKDIR_SUDO rm -f $OSM_K8S_WORK_DIR/ng-ui.yaml - fi } function generate_prometheus_grafana_files() { @@ -684,7 +656,6 @@ function generate_docker_env_files() { $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/keystone-db.env{,~} $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/keystone.env{,~} $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/lcm.env{,~} - $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/lwui.env{,~} $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/mon.env{,~} $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/nbi.env{,~} $WORKDIR_SUDO cp $OSM_DOCKER_WORK_DIR/pol.env{,~} @@ -816,11 +787,6 @@ function generate_docker_env_files() { echo "OSMPOL_SQL_DATABASE_URI=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/pol" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/pol.env fi - # LW-UI - if [ ! -f $OSM_DOCKER_WORK_DIR/lwui.env ]; then - echo "OSMUI_SQL_DATABASE_URI=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/lwui" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/lwui.env - fi - echo "Finished generation of docker env files" } @@ -837,12 +803,15 @@ function install_kube() { sudo add-apt-repository "deb https://apt.kubernetes.io/ kubernetes-xenial main" sudo apt-get update echo "Installing Kubernetes Packages ..." - sudo apt-get install -y kubelet=1.15.0-00 kubeadm=1.15.0-00 kubectl=1.15.0-00 + K8S_VERSION=1.20.11-00 + sudo apt-get install -y kubelet=${K8S_VERSION} kubeadm=${K8S_VERSION} kubectl=${K8S_VERSION} + sudo apt-mark hold kubelet kubeadm kubectl } #initializes kubernetes control plane function init_kubeadm() { sudo swapoff -a + sudo sed -i.bak '/.*none.*swap/s/^\(.*\)$/#\1/g' /etc/fstab sudo kubeadm init --config $1 sleep 5 } @@ -855,9 +824,14 @@ function kube_config_dir() { } function install_k8s_storageclass() { - kubectl apply -f https://openebs.github.io/charts/openebs-operator-1.6.0.yaml - local storageclass_timeout=300 + echo "Installing OpenEBS" + helm repo add openebs https://openebs.github.io/charts + helm repo update + helm install --create-namespace --namespace openebs openebs openebs/openebs --version 1.12.0 + helm ls -n openebs + local storageclass_timeout=400 local counter=0 + local storageclass_ready="" echo "Waiting for storageclass" while (( counter < storageclass_timeout )) do @@ -865,18 +839,21 @@ function install_k8s_storageclass() { if [ $? -eq 0 ] ; then echo "Storageclass available" + storageclass_ready="y" break else counter=$((counter + 15)) sleep 15 fi done + [ -n "$storageclass_ready" ] || FATAL "Storageclass not ready after $storageclass_timeout seconds. Cannot install openebs" kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' } function install_k8s_metallb() { - METALLB_IP_RANGE=$DEFAULT_IP-$DEFAULT_IP - cat ${OSM_DEVOPS}/installers/k8s/metallb/metallb.yaml | kubectl apply -f - + METALLB_IP_RANGE=$DEFAULT_IP/32 + kubectl apply -f ${OSM_DEVOPS}/installers/k8s/metallb/metallb.yaml \ + || FATAL "Cannot install MetalLB" echo "apiVersion: v1 kind: ConfigMap metadata: @@ -888,8 +865,105 @@ data: - name: default protocol: layer2 addresses: - - $METALLB_IP_RANGE" | kubectl apply -f - + - $METALLB_IP_RANGE" | kubectl apply -f - \ + || FATAL "Cannot apply MetalLB ConfigMap" +} + +#installs metallb from helm +function install_helm_metallb() { + METALLB_IP_RANGE=$DEFAULT_IP/32 + echo "configInline: + address-pools: + - name: default + protocol: layer2 + addresses: + - $METALLB_IP_RANGE" | sudo tee -a $OSM_DOCKER_WORK_DIR/metallb-config.yaml + helm repo add metallb https://metallb.github.io/metallb + helm install --create-namespace --namespace metallb-system metallb metallb/metallb -f $OSM_DOCKER_WORK_DIR/metallb-config.yaml +} + +#checks openebs and metallb readiness +function check_for_readiness() { + # Default input values + sampling_period=2 # seconds + time_for_readiness=20 # seconds ready + time_for_failure=200 # seconds broken + OPENEBS_NAMESPACE=openebs + METALLB_NAMESPACE=metallb-system + # STACK_NAME=osm # By default, "osm" + + # Equivalent number of samples + oks_threshold=$((time_for_readiness/${sampling_period})) # No. ok samples to declare the system ready + failures_threshold=$((time_for_failure/${sampling_period})) # No. nok samples to declare the system broken + failures_in_a_row=0 + oks_in_a_row=0 + + #################################################################################### + # Loop to check system readiness + #################################################################################### + while [[ (${failures_in_a_row} -lt ${failures_threshold}) && (${oks_in_a_row} -lt ${oks_threshold}) ]] + do + # State of OpenEBS + OPENEBS_STATE=$(kubectl get pod -n ${OPENEBS_NAMESPACE} --no-headers 2>&1) + OPENEBS_READY=$(echo "${OPENEBS_STATE}" | awk '$2=="1/1" || $2=="2/2" {printf ("%s\t%s\t\n", $1, $2)}') + OPENEBS_NOT_READY=$(echo "${OPENEBS_STATE}" | awk '$2!="1/1" && $2!="2/2" {printf ("%s\t%s\t\n", $1, $2)}') + COUNT_OPENEBS_READY=$(echo "${OPENEBS_READY}"| grep -v -e '^$' | wc -l) + COUNT_OPENEBS_NOT_READY=$(echo "${OPENEBS_NOT_READY}" | grep -v -e '^$' | wc -l) + + # State of MetalLB + METALLB_STATE=$(kubectl get pod -n ${METALLB_NAMESPACE} --no-headers 2>&1) + METALLB_READY=$(echo "${METALLB_STATE}" | awk '$2=="1/1" || $2=="2/2" {printf ("%s\t%s\t\n", $1, $2)}') + METALLB_NOT_READY=$(echo "${METALLB_STATE}" | awk '$2!="1/1" && $2!="2/2" {printf ("%s\t%s\t\n", $1, $2)}') + COUNT_METALLB_READY=$(echo "${METALLB_READY}" | grep -v -e '^$' | wc -l) + COUNT_METALLB_NOT_READY=$(echo "${METALLB_NOT_READY}" | grep -v -e '^$' | wc -l) + + # OK sample + if [[ $((${COUNT_OPENEBS_NOT_READY}+${COUNT_METALLB_NOT_READY})) -eq 0 ]] + then + ((++oks_in_a_row)) + failures_in_a_row=0 + echo -ne ===\> Successful checks: "${oks_in_a_row}"/${oks_threshold}\\r + # NOK sample + else + ((++failures_in_a_row)) + oks_in_a_row=0 + echo + echo Bootstraping... "${failures_in_a_row}" checks of ${failures_threshold} + + # Reports failed pods in OpenEBS + if [[ "${COUNT_OPENEBS_NOT_READY}" -ne 0 ]] + then + echo "OpenEBS: Waiting for ${COUNT_OPENEBS_NOT_READY} of $((${COUNT_OPENEBS_NOT_READY}+${COUNT_OPENEBS_READY})) pods to be ready:" + echo "${OPENEBS_NOT_READY}" + echo + fi + + # Reports failed statefulsets + if [[ "${COUNT_METALLB_NOT_READY}" -ne 0 ]] + then + echo "MetalLB: Waiting for ${COUNT_METALLB_NOT_READY} of $((${COUNT_METALLB_NOT_READY}+${COUNT_METALLB_READY})) pods to be ready:" + echo "${METALLB_NOT_READY}" + echo + fi + fi + + #------------ NEXT SAMPLE + sleep ${sampling_period} + done + + #################################################################################### + # OUTCOME + #################################################################################### + if [[ (${failures_in_a_row} -ge ${failures_threshold}) ]] + then + echo + FATAL "K8S CLUSTER IS BROKEN" + else + echo + echo "K8S CLUSTER IS READY" + fi } + #deploys flannel as daemonsets function deploy_cni_provider() { CNI_DIR="$(mktemp -d -q --tmpdir "flannel.XXXXXX")" @@ -908,7 +982,6 @@ function kube_secrets(){ kubectl create secret generic ro-db-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/ro-db.env kubectl create secret generic ro-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/ro.env kubectl create secret generic keystone-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/keystone.env - kubectl create secret generic lwui-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/lwui.env kubectl create secret generic pol-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/pol.env } @@ -927,13 +1000,7 @@ function deploy_osm_services() { #deploy charmed services function deploy_charmed_services() { juju add-model $OSM_STACK_NAME $OSM_VCA_K8S_CLOUDNAME - # deploy mongodb charm - namespace=$OSM_STACK_NAME - juju deploy cs:~charmed-osm/mongodb-k8s \ - --config enable-sidecar=true \ - --config replica-set=rs0 \ - --config namespace=$namespace \ - -m $namespace + juju deploy ch:mongodb-k8s -m $OSM_STACK_NAME } function deploy_osm_pla_service() { @@ -943,40 +1010,19 @@ function deploy_osm_pla_service() { kubectl apply -n $OSM_STACK_NAME -f $OSM_DOCKER_WORK_DIR/osm_pla } -#Install helm and tiller +#Install Helm v3 function install_helm() { helm > /dev/null 2>&1 if [ $? != 0 ] ; then # Helm is not installed. Install helm echo "Helm is not installed, installing ..." - 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 + curl https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz --output helm-v3.6.3.tar.gz + tar -zxvf helm-v3.6.3.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 --stable-repo-url https://charts.helm.sh/stable --service-account tiller - - # Wait for Tiller to be up and running. If timeout expires, continue installing - tiller_timeout=120; - counter=0; - tiller_status="" - 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" ] ) && echo "Tiller ready" && break - counter=$((counter + 5)) - sleep 5 - done - [ "$tiller_status" != "1/1" ] && echo "Tiller is NOT READY YET. Installation will continue" + rm helm-v3.6.3.tar.gz + helm repo add stable https://charts.helm.sh/stable + helm repo update fi } @@ -998,23 +1044,15 @@ function parse_yaml() { } function update_manifest_files() { - if [ -n "$NGUI" ]; then - osm_services="nbi lcm ro pol mon ng-ui keystone pla" - else - osm_services="nbi lcm ro pol mon light-ui keystone pla" - fi + osm_services="nbi lcm ro pol mon ng-ui keystone pla" list_of_services="" for module in $osm_services; do module_upper="${module^^}" - if [ "$module_upper" == "LIGHT-UI" ]; then - module_upper="LW-UI" - fi if ! echo $TO_REBUILD | grep -q $module_upper ; then list_of_services="$list_of_services $module" fi done - list_of_services_to_rebuild=$(echo ${TO_REBUILD,,} |sed "s/lw-ui/light-ui/g") - if [ ! "$OSM_DOCKER_TAG" == "9" ]; then + if [ ! "$OSM_DOCKER_TAG" == "10" ]; then parse_yaml $OSM_DOCKER_TAG $list_of_services fi if [ -n "$MODULE_DOCKER_TAG" ]; then @@ -1198,7 +1236,7 @@ function install_lightweight() { DEFAULT_IF=$(ip route list|awk '$1=="default" {print $5; exit}') [ -z "$DEFAULT_IF" ] && DEFAULT_IF=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}') [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" - DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]}'` + DEFAULT_IP=`ip -o -4 a s ${DEFAULT_IF} |awk '{split($4,a,"/"); print a[1]}'` [ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}') @@ -1242,10 +1280,13 @@ function install_lightweight() { remove_k8s_namespace $OSM_STACK_NAME deploy_cni_provider taint_master_node + install_helm + track install_helm install_k8s_storageclass track k8s_storageclass - install_k8s_metallb + install_helm_metallb track k8s_metallb + check_for_readiness else #install_docker_compose [ -n "$INSTALL_NODOCKER" ] || init_docker_swarm @@ -1371,8 +1412,6 @@ EOF track deploy_osm_pla fi track deploy_osm_services_k8s - install_helm - track install_helm if [ -n "$INSTALL_K8S_MONITOR" ]; then # install OSM MONITORING install_k8s_monitoring @@ -1411,7 +1450,7 @@ EOF [ -n "$KUBERNETES" ] && add_local_k8scluster track add_local_k8scluster - wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README2.txt &> /dev/null + wget -q -O- https://osm-download.etsi.org/ftp/osm-10.0-ten/README2.txt &> /dev/null track end return 0 } @@ -1525,6 +1564,7 @@ function dump_vars(){ echo "INSTALL_LIGHTWEIGHT=$INSTALL_LIGHTWEIGHT" echo "INSTALL_ONLY=$INSTALL_ONLY" echo "INSTALL_ELK=$INSTALL_ELK" + echo "INSTALL_NOCACHELXDIMAGES=$INSTALL_NOCACHELXDIMAGES" #echo "INSTALL_PERFMON=$INSTALL_PERFMON" echo "INSTALL_TO_OPENSTACK=$INSTALL_TO_OPENSTACK" echo "OPENSTACK_PUBLIC_NET_NAME=$OPENSTACK_PUBLIC_NET_NAME" @@ -1555,7 +1595,6 @@ function dump_vars(){ echo "OSM_STACK_NAME=$OSM_STACK_NAME" echo "PULL_IMAGES=$PULL_IMAGES" echo "KUBERNETES=$KUBERNETES" - echo "NGUI=$NGUI" echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL" echo "SHOWOPTS=$SHOWOPTS" @@ -1582,7 +1621,9 @@ function parse_docker_registry_url() { DOCKER_REGISTRY_URL=$(echo "$DOCKER_REGISTRY_URL" | awk '{split($1,a,"@"); print a[2]}') } -JUJU_AGENT_VERSION=2.8.6 +LXD_VERSION=4.0 +JUJU_VERSION=2.9 +JUJU_AGENT_VERSION=2.9.17 UNINSTALL="" DEVELOP="" UPDATE="" @@ -1593,7 +1634,7 @@ SHOWOPTS="" COMMIT_ID="" ASSUME_YES="" INSTALL_FROM_SOURCE="" -RELEASE="ReleaseNINE" +RELEASE="ReleaseTEN" REPOSITORY="stable" INSTALL_VIMEMU="" INSTALL_PLA="" @@ -1615,9 +1656,9 @@ INSTALL_NOLXD="" INSTALL_NODOCKER="" INSTALL_NOJUJU="" KUBERNETES="y" -NGUI="y" INSTALL_K8S_MONITOR="" INSTALL_NOHOSTCLIENT="" +INSTALL_NOCACHELXDIMAGES="" SESSION_ID=`date +%s` OSM_DEVOPS= OSM_VCA_HOST= @@ -1671,12 +1712,6 @@ while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o echo -e "Invalid argument for -i : ' $OPTARG'\n" >&2 usage && exit 1 ;; - n) - [ "${OPTARG}" == "lwui" ] && NGUI="" && REPO_ARGS+=(-n "${OPTARG}") && continue - [ "${OPTARG}" == "ngui" ] && continue - echo -e "Invalid argument for -n : ' $OPTARG'\n" >&2 - usage && exit 1 - ;; k) REPOSITORY_KEY="${OPTARG}" REPO_ARGS+=(-k "$REPOSITORY_KEY") @@ -1717,7 +1752,6 @@ while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o OPENSTACK_PUBLIC_NET_NAME="${OPTARG}" ;; m) - [ "${OPTARG}" == "LW-UI" ] && TO_REBUILD="$TO_REBUILD LW-UI" && continue [ "${OPTARG}" == "NG-UI" ] && TO_REBUILD="$TO_REBUILD NG-UI" && continue [ "${OPTARG}" == "NBI" ] && TO_REBUILD="$TO_REBUILD NBI" && continue [ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue @@ -1806,12 +1840,15 @@ while getopts ":b:r:c:n:k:u:R:D:o:O:m:N:H:S:s:w:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o [ "${OPTARG}" == "lxd" ] && continue [ "${OPTARG}" == "lxd-cred" ] && continue [ "${OPTARG}" == "microstack" ] && continue + [ "${OPTARG}" == "overlay" ] && continue + [ "${OPTARG}" == "only-vca" ] && continue [ "${OPTARG}" == "vca" ] && continue [ "${OPTARG}" == "ha" ] && continue [ "${OPTARG}" == "tag" ] && continue [ "${OPTARG}" == "registry" ] && continue [ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue [ "${OPTARG}" == "volume" ] && OPENSTACK_ATTACH_VOLUME="true" && continue + [ "${OPTARG}" == "nocachelxdimages" ] && INSTALL_NOCACHELXDIMAGES="y" && continue echo -e "Invalid option: '--$OPTARG'\n" >&2 usage && exit 1 ;; @@ -1908,7 +1945,7 @@ fi [ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0 #Installation starts here -wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README.txt &> /dev/null +wget -q -O- https://osm-download.etsi.org/ftp/osm-10.0-ten/README.txt &> /dev/null track start [ -n "$INSTALL_LIGHTWEIGHT" ] && install_lightweight && echo -e "\nDONE" && exit 0 @@ -1929,8 +1966,6 @@ export OSM_USE_LOCAL_DEVOPS=true #Install vim-emu (optional) [ -n "$INSTALL_VIMEMU" ] && install_docker_ce && install_vimemu -wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README2.txt &> /dev/null +wget -q -O- https://osm-download.etsi.org/ftp/osm-10.0-ten/README2.txt &> /dev/null track end echo -e "\nDONE" - -