From 69388c238f11ce1a2a324c64e90958dd2a281aac Mon Sep 17 00:00:00 2001 From: David Garcia Date: Thu, 7 May 2020 12:14:19 +0200 Subject: [PATCH] Add tag option to charmed osm installer Change-Id: I6093071eb183f2107b08c56f377af01390383782 Signed-off-by: David Garcia --- installers/charmed_install.sh | 35 +++++++++++++++++++++++++++++++--- installers/full_install_osm.sh | 2 ++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/installers/charmed_install.sh b/installers/charmed_install.sh index dd26c57d..b89855f2 100755 --- a/installers/charmed_install.sh +++ b/installers/charmed_install.sh @@ -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 diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 23a8e84c..5f267340 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -67,6 +67,7 @@ function usage(){ echo -e " --lxd-cloud : Takes a YAML file as a parameter with the LXD Cloud information (--charmed option)" echo -e " --lxd-credentials : 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 -- 2.17.1