#Safe unattended install of iptables-persistent
function check_install_iptables_persistent(){
echo -e "\nChecking required packages: iptables-persistent"
- if dpkg -l iptables-persistent &>/dev/null; then
+ if ! dpkg -l iptables-persistent &>/dev/null; then
echo -e " Not installed.\nInstalling iptables-persistent requires root privileges"
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
function install_lxd() {
# Apply sysctl production values for optimal performance
- sudo cp /usr/share/osm-devops/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
+ sudo cp ${OSM_DEVOPS}/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
sudo sysctl --system
# Install LXD snap
# Configure LXD
sudo usermod -a -G lxd `whoami`
- cat /usr/share/osm-devops/installers/lxd-preseed.conf | sed 's/^config: {}/config:\n core.https_address: '$DEFAULT_IP':8443/' | sg lxd -c "lxd init --preseed"
+ cat ${OSM_DEVOPS}/installers/lxd-preseed.conf | sed 's/^config: {}/config:\n core.https_address: '$DEFAULT_IP':8443/' | sg lxd -c "lxd init --preseed"
sg lxd -c "lxd waitready"
DEFAULT_INTERFACE=$(ip route list|awk '$1=="default" {print $5; exit}')
[ -z "$DEFAULT_INTERFACE" ] && DEFAULT_INTERFACE=$(route -n |awk '$1~/^0.0.0.0/ {print $8; exit}')
sg lxd -c "juju bootstrap --bootstrap-series=xenial $OSM_VCA_CLOUDNAME $OSM_STACK_NAME"
fi
[ $(juju controllers | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
-
- if [ -n "$KUBERNETES" ]; then
- cat .kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --controller $OSM_STACK_NAME
- fi
juju controller-config features=[k8s-operators]
}
+function juju_addk8s() {
+ cat .kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --controller $OSM_STACK_NAME --storage openebs-hostpath
+}
+
function juju_createproxy() {
check_install_iptables_persistent
kubectl create secret generic pol-secret -n $OSM_STACK_NAME --from-env-file=$OSM_DOCKER_WORK_DIR/pol.env
}
-#deploys osm pods and services
-function deploy_osm_services() {
+#taints K8s master node
+function taint_master_node() {
K8S_MASTER=$(kubectl get nodes | awk '$3~/master/'| awk '{print $1}')
kubectl taint node $K8S_MASTER node-role.kubernetes.io/master:NoSchedule-
sleep 5
+}
+
+#deploys osm pods and services
+function deploy_osm_services() {
kubectl apply -n $OSM_STACK_NAME -f $OSM_K8S_WORK_DIR
}
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
sudo mv linux-amd64/helm /usr/local/bin/helm
helm init --service-account tiller
# Wait for Tiller to be up and running. If timeout expires, continue installing
- tiller_timeout=120; counter=0
+ 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" ] ) && break
- num=$((counter + 2))
- sleep 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"
fi
}
function namespace_vol() {
osm_services="nbi lcm ro pol mon kafka mongo mysql"
for osm in $osm_services; do
- $WORKDIR_SUDO sed -i "s#path: /var/lib/osm#path: $OSM_NAMESPACE_VOL#g" $OSM_K8S_WORK_DIR/$osm.yaml
+ $WORKDIR_SUDO sed -i "s#path: /var/lib/osm#path: $OSM_NAMESPACE_VOL#g" $OSM_K8S_WORK_DIR/$osm.yaml
done
}
return 0
}
+function add_local_k8scluster() {
+ /usr/bin/osm --all-projects vim-create \
+ --name _system-osm-vim \
+ --account_type dummy \
+ --auth_url http://dummy \
+ --user osm --password osm --tenant osm \
+ --description "dummy" \
+ --config '{management_network_name: mgmt}'
+ /usr/bin/osm --all-projects k8scluster-add \
+ --creds ${HOME}/.kube/config \
+ --vim _system-osm-vim \
+ --k8s-nets '{"net1": null}' \
+ --version '1.15' \
+ --description "OSM Internal Cluster" \
+ _system-osm-k8s
+}
+
function install_lightweight() {
[ "${OSM_STACK_NAME}" == "osm" ] || OSM_DOCKER_WORK_DIR="$OSM_WORK_DIR/stack/$OSM_STACK_NAME"
[ -n "$KUBERNETES" ] && OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOST_VOL}/${OSM_STACK_NAME}"
track install_k8s
init_kubeadm $OSM_DOCKER_WORK_DIR/cluster-config.yaml
kube_config_dir
- install_k8s_storage_class
track init_k8s
else
#install_docker_compose
kube_secrets
[ ! $OSM_DOCKER_TAG == "7" ] && parse_yaml $OSM_DOCKER_TAG
namespace_vol
+ taint_master_node
deploy_osm_services
if [ -n "$INSTALL_PLA"]; then
# optional PLA install
deploy_osm_pla_service
fi
track deploy_osm_services_k8s
+ install_k8s_storageclass
+ track k8s_storageclass
+ juju_addk8s
+ track juju_addk8s
+ install_helm
+ track install_helm
if [ -n "$INSTALL_K8S_MONITOR" ]; then
# install OSM MONITORING
install_k8s_monitoring
[ -z "$INSTALL_NOHOSTCLIENT" ] && install_osmclient
track osmclient
+
+ echo -e "Checking OSM health state..."
+ if [ -n "$KUBERNETES" ]; then
+ $OSM_DEVOPS/installers/osm_health.sh -s ${OSM_STACK_NAME} -k || \
+ echo -e "OSM is not healthy, but will probably converge to a healthy state soon." && \
+ echo -e "Check OSM status with: kubectl -n ${OSM_STACK_NAME} get all" && \
+ track osm_unhealthy
+ else
+ $OSM_DEVOPS/installers/osm_health.sh -s ${OSM_STACK_NAME} || \
+ echo -e "OSM is not healthy, but will probably converge to a healthy state soon." && \
+ echo -e "Check OSM status with: docker service ls; docker stack ps ${OSM_STACK_NAME}" && \
+ track osm_unhealthy
+ fi
+ track after_healthcheck
+
+ [ -n "$KUBERNETES" ] && add_local_k8scluster
+ track add_local_k8scluster
- wget -q -O- https://osm-download.etsi.org/ftp/osm-7.0-seven/README2.txt &> /dev/null
+ wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README2.txt &> /dev/null
track end
return 0
}
COMMIT_ID=""
ASSUME_YES=""
INSTALL_FROM_SOURCE=""
-RELEASE="ReleaseSEVEN"
+RELEASE="ReleaseEIGHT"
REPOSITORY="stable"
INSTALL_VIMEMU=""
INSTALL_PLA=""
if [ -n "$CHARMED" ]; then
if [ -n "$UNINSTALL" ]; then
- /usr/share/osm-devops/installers/charmed_uninstall.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"
+ ${OSM_DEVOPS}/installers/charmed_uninstall.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"
else
- /usr/share/osm-devops/installers/charmed_install.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"
+ ${OSM_DEVOPS}/installers/charmed_install.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"
echo "Your installation is now complete, follow these steps for configuring the osmclient:"
echo
[ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0
#Installation starts here
-wget -q -O- https://osm-download.etsi.org/ftp/osm-7.0-seven/README.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README.txt &> /dev/null
track start
[ -n "$INSTALL_LIGHTWEIGHT" ] && install_lightweight && echo -e "\nDONE" && exit 0
#Install vim-emu (optional)
[ -n "$INSTALL_VIMEMU" ] && install_docker_ce && install_vimemu
-wget -q -O- https://osm-download.etsi.org/ftp/osm-7.0-seven/README2.txt &> /dev/null
+wget -q -O- https://osm-download.etsi.org/ftp/osm-8.0-eight/README2.txt &> /dev/null
track end
echo -e "\nDONE"