X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharmed_install.sh;h=0f895cd6c9d82eb376d0823133a359b14e616dc4;hb=499b442f67119589220a1ff144e3b26a9b7714ed;hp=06361c8dac8168157c8262f6d745ca024f4a3cc4;hpb=6b1a324f6c63a74948177aacfd0a77868d9eeda1;p=osm%2Fdevops.git diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index 06361c8d..0f895cd6 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -15,9 +15,9 @@ # set -eux -LXD_VERSION=4.17 +LXD_VERSION=4.0 JUJU_VERSION=2.9 -JUJU_AGENT_VERSION=2.9.9 +JUJU_AGENT_VERSION=2.9.17 K8S_CLOUD_NAME="k8s-cloud" KUBECTL="microk8s.kubectl" MICROK8S_VERSION=1.20 @@ -286,6 +286,10 @@ function deploy_charmed_osm(){ echo "Waiting for deployment to finish..." check_osm_deployed + grafana_leader=`juju status -m $MODEL_NAME grafana | grep "*" | cut -d "*" -f 1` + grafana_admin_password=`juju run -m $MODEL_NAME --unit $grafana_leader "echo \\$GF_SECURITY_ADMIN_PASSWORD"` + juju config -m $MODEL_NAME mon grafana_password=$grafana_admin_password + check_osm_deployed echo "OSM with charms deployed" } @@ -418,36 +422,78 @@ function add_local_k8scluster() { } function install_microstack() { - sudo snap install microstack --classic --beta - sudo microstack.init --auto - wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img -P ~/.osm/ - microstack.openstack image create \ - --public \ - --disk-format qcow2 \ - --container-format bare \ - --file ~/.osm/ubuntu-16.04-server-cloudimg-amd64-disk1.img \ - ubuntu1604 - ssh-keygen -t rsa -N "" -f ~/.ssh/microstack - microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack - export OSM_HOSTNAME=`juju status -m $MODEL_NAME --format json | jq -rc '.applications."nbi".address'` - osm vim-create --name microstack-site \ - --user admin \ - --password keystone \ - --auth_url http://10.20.20.1:5000/v3 \ - --tenant admin \ - --account_type openstack \ - --config='{security_groups: default, - keypair: microstack, - project_name: admin, - user_domain_name: default, - region_name: microstack, - insecure: True, - availability_zone: nova, - version: 3}' + + sudo snap install microstack --beta --devmode + + CHECK=$(microstack.openstack server list) + if [ $? -ne 0 ] ; then + if [[ $CHECK == *"not initialized"* ]]; then + echo "Setting MicroStack dashboard to listen to port 8080" + sudo snap set microstack config.network.ports.dashboard=8080 + echo "Initializing MicroStack. This can take several minutes" + sudo microstack.init --auto --control + fi + fi + + sudo snap alias microstack.openstack openstack + + echo "Updating default security group in MicroStack to allow all access" + + for i in $(microstack.openstack security group list | awk '/default/{ print $2 }'); do + for PROTO in icmp tcp udp ; do + echo " $PROTO ingress" + CHECK=$(microstack.openstack security group rule create $i --protocol $PROTO --remote-ip 0.0.0.0/0 2>&1) + if [ $? -ne 0 ] ; then + if [[ $CHECK != *"409"* ]]; then + echo "Error creating ingress rule for $PROTO" + echo $CHECK + fi + fi + done + done + + microstack.openstack network show osm-ext &>/dev/null + if [ $? -ne 0 ]; then + echo "Creating osm-ext network with router to bridge to MicroStack external network" + microstack.openstack network create --enable --no-share osm-ext + microstack.openstack subnet create osm-ext-subnet --network osm-ext --dns-nameserver 8.8.8.8 \ + --subnet-range 172.30.0.0/24 + microstack.openstack router create external-router + microstack.openstack router add subnet external-router osm-ext-subnet + microstack.openstack router set --external-gateway external external-router + fi + + microstack.openstack image list | grep ubuntu20.04 &> /dev/null + if [ $? -ne 0 ] ; then + echo "Fetching Ubuntu 20.04 image and upLoading to MicroStack" + wget -q -O- https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img \ + | microstack.openstack image create --public --container-format=bare \ + --disk-format=qcow2 ubuntu20.04 | grep status + fi + + if [ ! -f ~/.ssh/microstack ]; then + ssh-keygen -t rsa -N "" -f ~/.ssh/microstack + microstack.openstack keypair create --public-key ~/.ssh/microstack.pub microstack + fi + + echo "Creating VIM microstack-site in OSM" + . /var/snap/microstack/common/etc/microstack.rc + + osm vim-create \ + --name microstack-site \ + --user "$OS_USERNAME" \ + --password "$OS_PASSWORD" \ + --auth_url "$OS_AUTH_URL" \ + --tenant "$OS_USERNAME" \ + --account_type openstack \ + --config='{use_floating_ip: True, + insecure: True, + keypair: microstack, + management_network_name: osm-ext}' } -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]}'` +DEFAULT_IF=`ip route list match 0.0.0.0 | awk '{print $5; exit}'` +DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]; exit}'` check_arguments $@ mkdir -p ~/.osm