fi
}
+function remove_crontab_job() {
+ crontab -l | grep -v '${OSM_DEVOPS}/installers/update-juju-lxc-images' | crontab -
+}
+
#Uninstall osmclient
function uninstall_osmclient() {
sudo apt-get remove --purge -y python-osmclient
$WORKDIR_SUDO rm -rf $OSM_DOCKER_WORK_DIR
[ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju destroy-controller --destroy-all-models --yes $OSM_STACK_NAME"
fi
+ remove_crontab_job
[ -z "$INSTALL_NOHOSTCLIENT" ] && uninstall_osmclient
echo "Some docker images will be kept in case they are used by other docker stacks"
echo "To remove them, just run 'docker image prune' in a terminal"
exit 1
}
+function update_juju_images(){
+ crontab -l | grep update-juju-lxc-images || (crontab -l 2>/dev/null; echo "0 4 * * 6 $USER ${OSM_DEVOPS}/installers/update-juju-lxc-images --xenial --bionic") | crontab -
+ ${OSM_DEVOPS}/installers/update-juju-lxc-images --xenial --bionic
+}
+
function install_lxd() {
# Apply sysctl production values for optimal performance
sudo cp ${OSM_DEVOPS}/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf
echo "Installing juju"
sudo snap install juju --classic --channel=2.8/stable
[[ ":$PATH": != *":/snap/bin:"* ]] && PATH="/snap/bin:${PATH}"
+ update_juju_images
echo "Finished installation of juju"
return 0
}
if ! juju show-controller $OSM_STACK_NAME &> /dev/null; then
# Not found created, create the controller
sudo usermod -a -G lxd ${USER}
- sg lxd -c "juju bootstrap --bootstrap-series=xenial $OSM_VCA_CLOUDNAME $OSM_STACK_NAME"
+ sg lxd -c "juju bootstrap --bootstrap-series=xenial --agent-version=2.8.1 $OSM_VCA_CLOUDNAME $OSM_STACK_NAME"
fi
[ $(juju controllers | awk "/^${OSM_STACK_NAME}[\*| ]/{print $1}"|wc -l) -eq 1 ] || FATAL "Juju installation failed"
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
+ cat $HOME/.kube/config | juju add-k8s $OSM_VCA_K8S_CLOUDNAME --controller $OSM_STACK_NAME --storage openebs-hostpath
}
function juju_createproxy() {
function install_k8s_storageclass() {
kubectl apply -f https://openebs.github.io/charts/openebs-operator-1.6.0.yaml
+ local storageclass_timeout=300
+ local counter=0
+ echo "Waiting for storageclass"
+ while (( counter < storageclass_timeout ))
+ do
+ kubectl get storageclass openebs-hostpath &> /dev/null
+
+ if [ $? -eq 0 ] ; then
+ echo "Storageclass available"
+ break
+ else
+ counter=$((counter + 15))
+ sleep 15
+ fi
+ done
kubectl patch storageclass openebs-hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
}
}
function namespace_vol() {
- osm_services="nbi lcm ro pol mon kafka mongo mysql"
+ osm_services="nbi lcm ro pol mon kafka mongo mysql prometheus"
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
done
[ -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 || \
[ "${OPTARG}" == "lxd" ] && continue
[ "${OPTARG}" == "lxd-cred" ] && continue
[ "${OPTARG}" == "microstack" ] && continue
+ [ "${OPTARG}" == "vca" ] && continue
[ "${OPTARG}" == "ha" ] && continue
[ "${OPTARG}" == "tag" ] && continue
[ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue
${OSM_DEVOPS}/installers/charmed_uninstall.sh -R $RELEASE -r $REPOSITORY -u $REPOSITORY_BASE -D /usr/share/osm-devops -t $DOCKER_TAG "$@"
else
${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
- echo "1. Get the NBI IP with the following command:"
- echo
- echo NBI_IP='`juju status --format json | jq -rc '"'"'.applications."nbi-k8s".address'"'"'`'
- echo
- echo "2. Create the OSM_HOSTNAME environment variable with the NBI IP"
- echo
- echo "export OSM_HOSTNAME=\$NBI_IP"
- echo
- echo "3. Add the previous command to your .bashrc for other Shell sessions"
- echo
- echo "echo \"export OSM_HOSTNAME=\$NBI_IP\" >> ~/.bashrc"
- echo
- echo "DONE"
fi
exit 0