Add tag option to charmed osm installer 76/8876/7
authorDavid Garcia <david.garcia@canonical.com>
Thu, 7 May 2020 10:14:19 +0000 (12:14 +0200)
committergarciadav <david.garcia@canonical.com>
Fri, 8 May 2020 09:46:13 +0000 (11:46 +0200)
Change-Id: I6093071eb183f2107b08c56f377af01390383782
Signed-off-by: David Garcia <david.garcia@canonical.com>
installers/charmed_install.sh
installers/full_install_osm.sh

index dd26c57..b89855f 100755 (executable)
@@ -16,7 +16,7 @@
 # set -eux
 
 K8S_CLOUD_NAME="k8s-cloud"
-
+IMAGES_OVERLAY_FILE=~/.osm/images-overlay.yaml
 function check_arguments(){
     while [ $# -gt 0 ] ; do
         case $1 in
@@ -25,7 +25,8 @@ function check_arguments(){
             --controller) CONTROLLER="$2" ;;
             --lxd-cloud) LXD_CLOUD="$2" ;;
             --lxd-credentials) LXD_CREDENTIALS="$2" ;;
-            --microstack) MICROSTACK=y
+            --microstack) MICROSTACK=y ;;
+            --tag) TAG="$2" ;;
         esac
         shift
     done
@@ -122,7 +123,9 @@ function deploy_charmed_osm(){
     if [ -v BUNDLE ]; then
         juju deploy $BUNDLE --overlay ~/.osm/vca-overlay.yaml
     else
-        juju deploy osm --overlay ~/.osm/vca-overlay.yaml
+        images_overlay=""
+        [ -v TAG ] && generate_images_overlay && images_overlay="--overlay $IMAGES_OVERLAY_FILE"
+        juju deploy osm --overlay ~/.osm/vca-overlay.yaml $images_overlay
     fi
     echo "Waiting for deployment to finish..."
     check_osm_deployed &> /dev/null
@@ -188,6 +191,32 @@ EOF
     OSM_VCA_HOST=$vca_host
 }
 
+function generate_images_overlay(){
+    cat << EOF > /tmp/images-overlay.yaml
+applications:
+  lcm-k8s:
+    options:
+      image: opensourcemano/lcm:$TAG
+  mon-k8s:
+    options:
+      image: opensourcemano/mon:$TAG
+  ro-k8s:
+    options:
+      image: opensourcemano/ro:$TAG
+  nbi-k8s:
+    options:
+      image: opensourcemano/nbi:$TAG
+  pol-k8s:
+    options:
+      image: opensourcemano/pol:$TAG
+  ui-k8s:
+    options:
+      image: opensourcemano/light-ui:$TAG
+
+EOF
+    mv /tmp/images-overlay.yaml $IMAGES_OVERLAY_FILE
+}
+
 function install_osmclient() {
     sudo snap install osmclient
     sudo snap alias osmclient.osm osm
index 23a8e84..5f26734 100755 (executable)
@@ -67,6 +67,7 @@ function usage(){
     echo -e "     --lxd-cloud <yaml path>:         Takes a YAML file as a parameter with the LXD Cloud information (--charmed option)" 
     echo -e "     --lxd-credentials <yaml path>:   Takes a YAML file as a parameter with the LXD Credentials information (--charmed option)"
     echo -e "     --microstack:                    Installs microstack as a vim. (--charmed option)"
+    echo -e "     --tag:                           Docker image tag"
 
 }
 
@@ -1362,6 +1363,7 @@ while getopts ":b:r:c:k:u:R:D:o:m:H:S:s:w:t:U:P:A:l:L:K:-: hy" o; do
             [ "${OPTARG}" == "lxdendpoint" ] && continue
             [ "${OPTARG}" == "lxdcert" ] && continue
             [ "${OPTARG}" == "microstack" ] && continue
+            [ "${OPTARG}" == "tag" ] && continue
             [ "${OPTARG}" == "pla" ] && INSTALL_PLA="y" && continue
             echo -e "Invalid option: '--$OPTARG'\n" >&2
             usage && exit 1