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"
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
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
# MON
if [ ! -f $OSM_DOCKER_WORK_DIR/mon.env ]; then
+ echo "OSMMON_KEYSTONE_SERVICE_PASSWORD=${SERVICE_PASSWORD}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env
echo "OSMMON_DATABASE_COMMONKEY=${OSM_DATABASE_COMMONKEY}" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env
echo "OSMMON_SQL_DATABASE_URI=mysql://root:${MYSQL_ROOT_PASSWORD}@mysql:3306/mon" | $WORKDIR_SUDO tee -a $OSM_DOCKER_WORK_DIR/mon.env
fi
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
+ sudo apt-mark hold kubelet kubeadm kubectl
}
#initializes kubernetes control plane
}
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"
+ kubectl create ns openebs
+ helm repo add openebs https://openebs.github.io/charts
+ helm repo update
+ helm install --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
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"}}}'
}
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
}
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;}')
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
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
fi
# Install Pip for Python3
- $WORKDIR_SUDO apt install -y python3-pip
+ $WORKDIR_SUDO apt install -y python3-pip python3-venv
$WORKDIR_SUDO -H LC_ALL=C python3 -m pip install -U pip
# Create a venv to avoid conflicts with the host installation
source $OPENSTACK_PYTHON_VENV/bin/activate
- # Install Ansible, OpenStack client and SDK
+ # Install Ansible, OpenStack client and SDK, latest openstack version supported is Train
python -m pip install -U wheel
- python -m pip install -U python-openstackclient "openstacksdk>=0.12.0,<1" "ansible>=2.10,<2.11"
+ python -m pip install -U "python-openstackclient<=4.0.2" "openstacksdk>=0.12.0,<=0.36.2" "ansible>=2.10,<2.11"
# Install the Openstack cloud module (ansible>=2.10)
ansible-galaxy collection install openstack.cloud
wget -q -O- https://osm-download.etsi.org/ftp/osm-9.0-nine/README2.txt &> /dev/null
track end
echo -e "\nDONE"
-
-