Add HA option and minor fixes
This commit adds the --ha option which will
install the osm-ha bundle instead of the standard
osm bundle.
Additionally this commit includes the following
fixes:
- change the use of route to ip route which is
preinstalled in Ubuntu Desktop also.
- Change final command of post install osmclient
message
- Change post install osmclient message to be
only shown during install and not uninstall.
- Fix the deletion of the wrong model in uninstall
- Pining Juju snap to 2.7/stable
Change-Id: Iccf3bda7ec2f9a2279e5535d819e2a1968a59687
Signed-off-by: Dominik Fleischmann <dominik.fleischmann@canonical.com>
diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh
index 62fa547..c2108d6 100755
--- a/installers/charmed_install.sh
+++ b/installers/charmed_install.sh
@@ -26,6 +26,7 @@
--lxd) LXD_CLOUD="$2" ;;
--lxd-cred) LXD_CREDENTIALS="$2" ;;
--microstack) MICROSTACK=y ;;
+ --ha) BUNDLE="osm-ha" ;;
--tag) TAG="$2" ;;
esac
shift
@@ -34,8 +35,8 @@
# echo $BUNDLE $KUBECONFIG $LXDENDPOINT
}
function install_snaps(){
- sudo snap install juju --classic
- [ ! -v KUBECFG ] && sudo snap install microk8s --classic && sudo usermod -a -G microk8s ubuntu && mkdir -p ~/.kube && sudo chown -f -R `whoami` ~/.kube
+ sudo snap install juju --classic --channel=2.7/stable
+ [ ! -v KUBECFG ] && sudo snap install microk8s --classic && sudo usermod -a -G microk8s `whoami` && mkdir -p ~/.kube && sudo chown -f -R `whoami` ~/.kube
}
function bootstrap_k8s_lxd(){
@@ -47,6 +48,14 @@
[ -v BOOTSTRAP_NEEDED ] && juju bootstrap $K8S_CLOUD_NAME $CONTROLLER_NAME
else
sg microk8s -c "microk8s.enable storage dns"
+ while true
+ do
+ sg microk8s -c "microk8s.status" | grep 'storage: enabled'
+ if [ $? -eq 0 ]; then
+ break
+ fi
+ sleep 1
+ done
[ ! -v BOOTSTRAP_NEEDED ] && sg microk8s -c "microk8s.config" | juju add-k8s $K8S_CLOUD_NAME $ADD_K8S_OPTS
[ -v BOOTSTRAP_NEEDED ] && sg microk8s -c "juju bootstrap microk8s $CONTROLLER_NAME" && K8S_CLOUD_NAME=microk8s
@@ -138,7 +147,8 @@
function check_osm_deployed() {
while true
do
- pod_name=`sg microk8s -c "microk8s.kubectl -n osm get pods | grep ui-k8s | grep -v operator" | awk '{print $1}'`
+ pod_name=`sg microk8s -c "microk8s.kubectl -n osm get pods | grep ui-k8s | grep -v operator" | awk '{print $1; exit}'`
+
if [[ `sg microk8s -c "microk8s.kubectl -n osm wait pod $pod_name --for condition=Ready"` ]]; then
if [[ `sg microk8s -c "microk8s.kubectl -n osm wait pod lcm-k8s-0 --for condition=Ready"` ]]; then
break
@@ -164,7 +174,7 @@
local vca_cacert=$(cat $HOME/.local/share/juju/controllers.yaml | yq --arg CONTROLLER_NAME $CONTROLLER_NAME '.controllers[$CONTROLLER_NAME]["ca-cert"]' | base64 | tr -d \\n)
# Calculate the default route of this machine
- local DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'`
+ local DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`
local vca_apiproxy=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'`
# Generate a new overlay.yaml, overriding any existing one
@@ -253,7 +263,7 @@
ubuntu1604
ssh-keygen -t rsa -N "" -f ~/.ssh/microstack
microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack
- export OSM_HOSTNAME=`juju status --format yaml | yq r - applications.nbi-k8s.address`
+ export OSM_HOSTNAME=`juju status --format json | jq -rc '.applications."nbi-k8s".address'`
osm vim-create --name microstack-site \
--user admin \
--password keystone \
@@ -270,7 +280,7 @@
version: 3}'
}
-DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'`
+DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5}'`
DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'`
check_arguments $@