Fixes bug 1377 20/10120/2
authorbeierlm <mark.beierl@canonical.com>
Wed, 16 Dec 2020 13:46:40 +0000 (08:46 -0500)
committerbeierlm <mark.beierl@canonical.com>
Wed, 16 Dec 2020 18:34:29 +0000 (19:34 +0100)
Adds the system VIM and k8s cluster the same way that the
k8s installer does.

Change-Id: I11ad41c35f11467c51f0edc2aba4b3cb5e048823
Signed-off-by: beierlm <mark.beierl@canonical.com>
installers/charmed_install.sh

index 85569a3..75a7259 100755 (executable)
@@ -51,6 +51,8 @@ function install_snaps(){
         sudo chown -f -R `whoami` ~/.kube
         KUBEGRP="microk8s"
         sg ${KUBEGRP} -c "microk8s status --wait-ready"
+        KUBECONFIG=~/.osm/microk8s-config.yaml
+        sg ${KUBEGRP} -c "microk8s config" > ${KUBECONFIG}
     else
         KUBECTL="kubectl"
         sudo snap install kubectl --classic
@@ -396,6 +398,25 @@ function install_osmclient() {
     sudo snap alias osmclient.osm osm
 }
 
+function add_local_k8scluster() {
+    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}'
+    tmpfile=$(mktemp --tmpdir=${HOME})
+    cp ${KUBECONFIG} ${tmpfile}
+    osm --all-projects k8scluster-add \
+      --creds ${tmpfile} \
+      --vim _system-osm-vim \
+      --k8s-nets '{"net1": null}' \
+      --version '1.19' \
+      --description "OSM Internal Cluster" \
+      _system-osm-k8s
+    rm -f ${tmpfile}
+}
 
 function install_microstack() {
     sudo snap install microstack --classic --beta
@@ -435,11 +456,13 @@ install_snaps
 bootstrap_k8s_lxd
 deploy_charmed_osm
 install_osmclient
+OSM_HOSTNAME=$(juju config nbi site_url | sed "s/http.*\?:\/\///"):443
+add_local_k8scluster
+
 if [ -v MICROSTACK ]; then
     install_microstack
 fi
 
-OSM_HOSTNAME=$(juju config nbi site_url | sed "s/http.*\?:\/\///"):443
 
 echo "Your installation is now complete, follow these steps for configuring the osmclient:"
 echo