From a2b02c755356c5655dae6d0ea4a1298ea132a5d8 Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Fri, 31 May 2024 16:50:18 +0200 Subject: [PATCH] Remove unused options from installer This change removes options -b , -m , --source, --develop, --pullimages, --nodockerbuild from full_install_osm.sh and install_osm.sh It also remove unused unctions such as generate_docker_images and cmp_overwrite. Change-Id: I0c307a765671c4af8516afa97808b70baadb964f Signed-off-by: garciadeblas --- installers/full_install_osm.sh | 98 +--------------------------------- installers/install_osm.sh | 10 ---- 2 files changed, 1 insertion(+), 107 deletions(-) diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 349566de..a2677504 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -24,11 +24,6 @@ function usage(){ echo -e " -R : use specified release for osm binaries (deb packages, lxd images, ...)" echo -e " -u : use specified repository url for osm packages" echo -e " -k : use specified repository public key url" - echo -e " -b : install OSM from source code using a specific branch (master, v2.0, ...) or tag" - echo -e " -b master (main dev branch)" - echo -e " -b v2.0 (v2.0 branch)" - echo -e " -b tags/v1.1.0 (a specific tag)" - echo -e " ..." echo -e " -a : use this apt proxy url when downloading apt packages (air-gapped installation)" echo -e " -c : use a specific kubernetes engine (options: kubeadm, k3s, microk8s), default is kubeadm" echo -e " -s namespace when installed using k8s, default is osm" @@ -39,7 +34,6 @@ function usage(){ echo -e " --pla: install the PLA module for placement support" echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway" echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)" - echo -e " -m : install OSM but only rebuild or pull the specified docker images (NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)" echo -e " -o : ONLY (un)installs one of the addons (k8s_monitor, ng-sa)" echo -e " -O : Install OSM to an OpenStack infrastructure. is required. If a is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/" echo -e " -N : Public network name required to setup OSM to OpenStack" @@ -60,13 +54,9 @@ function usage(){ echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)" echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" echo -e " --nojuju: do not juju, assumes already installed" - echo -e " --nodockerbuild:do not build docker images (use existing locally cached images)" echo -e " --nohostports: do not expose docker ports to host (useful for creating multiple instances of osm on the same host)" echo -e " --nohostclient: do not install the osmclient" echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" - echo -e " --source: install OSM from source code using the latest stable tag" - echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch" - echo -e " --pullimages: pull/run osm images from docker.io/opensourcemano" echo -e " --k8s_monitor: install the OSM kubernetes monitoring with prometheus and grafana" echo -e " --volume: create a VM volume when installing to OpenStack" echo -e " --showopts: print chosen options and exit (only for debugging)" @@ -208,50 +198,6 @@ function docker_login() { [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -function generate_docker_images() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - echo "Generating docker images" - _build_from=$COMMIT_ID - [ -z "$_build_from" ] && _build_from="latest" - echo "OSM Docker images generated from $_build_from" - LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")" - trap 'rm -rf "${LWTEMPDIR}"' EXIT - for module in MON POL NBI KEYSTONE RO LCM NG-UI PLA; do - if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q ${module} ; then - module_lower=${module,,} - if [ $module == "PLA" -a ! -n "$INSTALL_PLA" ]; then - continue - fi - git -C ${LWTEMPDIR} clone https://osm.etsi.org/gerrit/osm/$module - git -C ${LWTEMPDIR}/${module} checkout ${COMMIT_ID} - sg docker -c "docker build ${LWTEMPDIR}/${module} -f ${LWTEMPDIR}/${module}/docker/Dockerfile -t ${DOCKER_USER}/${module_lower} --no-cache" || FATAL "cannot build ${module} docker image" - fi - done - if [ -z "$TO_REBUILD" ] || echo $TO_REBUILD | grep -q osmclient; then - BUILD_ARGS+=(--build-arg REPOSITORY="$REPOSITORY") - BUILD_ARGS+=(--build-arg RELEASE="$RELEASE") - BUILD_ARGS+=(--build-arg REPOSITORY_KEY="$REPOSITORY_KEY") - BUILD_ARGS+=(--build-arg REPOSITORY_BASE="$REPOSITORY_BASE") - sg docker -c "docker build -t ${DOCKER_USER}/osmclient ${BUILD_ARGS[@]} -f $OSM_DEVOPS/docker/osmclient ." - fi - echo "Finished generation of docker images" - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - -function cmp_overwrite() { - [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function - file1="$1" - file2="$2" - if ! $(cmp "${file1}" "${file2}" >/dev/null 2>&1); then - if [ -f "${file2}" ]; then - ask_user "The file ${file2} already exists. Overwrite (y/N)? " n && cp -b ${file1} ${file2} - else - cp -b ${file1} ${file2} - fi - fi - [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function -} - #deploys osm pods and services function deploy_osm_services() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function @@ -454,7 +400,6 @@ function install_osm() { trap ctrl_c INT - check_osm_behind_proxy check_packages "git wget curl tar snapd" if [ -n "${INSTALL_JUJU}" ]; then @@ -531,7 +476,6 @@ function install_osm() { track juju juju_ok # Deploy OSM services - [ -z "$DOCKER_NOBUILD" ] && [ -z "$PULL_IMAGES" ] && generate_docker_images track docker_images docker_images_ok deploy_mongodb @@ -646,14 +590,11 @@ function dump_vars(){ [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function echo "APT_PROXY_URL=$APT_PROXY_URL" echo "K8S_CLUSTER_ENGINE=$K8S_CLUSTER_ENGINE" - echo "DEVELOP=$DEVELOP" echo "DEBUG_INSTALL=$DEBUG_INSTALL" - echo "DOCKER_NOBUILD=$DOCKER_NOBUILD" echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL" echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" echo "DOCKER_USER=$DOCKER_USER" echo "INSTALL_CACHELXDIMAGES=$INSTALL_CACHELXDIMAGES" - echo "INSTALL_FROM_SOURCE=$INSTALL_FROM_SOURCE" echo "INSTALL_JUJU=$INSTALL_JUJU" echo "INSTALL_K8S_MONITOR=$INSTALL_K8S_MONITOR" echo "INSTALL_LXD=$INSTALL_LXD" @@ -686,10 +627,8 @@ function dump_vars(){ echo "REPOSITORY_KEY=$REPOSITORY_KEY" echo "SHOWOPTS=$SHOWOPTS" echo "TEST_INSTALLER=$TEST_INSTALLER" - echo "TO_REBUILD=$TO_REBUILD" echo "UNINSTALL=$UNINSTALL" echo "UPDATE=$UPDATE" - echo "Install from specific refspec (-b): $COMMIT_ID" [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } @@ -709,17 +648,14 @@ function ctrl_c() { } UNINSTALL="" -DEVELOP="" UPDATE="" RECONFIGURE="" TEST_INSTALLER="" INSTALL_LXD="" SHOWOPTS="" -COMMIT_ID="" ASSUME_YES="" APT_PROXY_URL="" K8S_CLUSTER_ENGINE="kubeadm" -INSTALL_FROM_SOURCE="" DEBUG_INSTALL="" RELEASE="testing-daily" REPOSITORY="testing" @@ -738,7 +674,6 @@ OPENSTACK_USERDATA_FILE="" OPENSTACK_VM_NAME="server-osm" OPENSTACK_PYTHON_VENV="$HOME/.virtual-envs/osm" INSTALL_ONLY="" -TO_REBUILD="" INSTALL_DOCKER="" INSTALL_JUJU="" INSTALL_NOHOSTCLIENT="" @@ -751,7 +686,6 @@ OSM_VCA_CLOUDNAME="localhost" OSM_VCA_K8S_CLOUDNAME="k8scloud" OSM_NAMESPACE=osm NO_HOST_PORTS="" -DOCKER_NOBUILD="" REPOSITORY_KEY="OSM%20ETSI%20Release%20Key.gpg" REPOSITORY_BASE="https://osm-download.etsi.org/repository/osm/debian" OSM_WORK_DIR="/etc/osm" @@ -779,15 +713,11 @@ DOCKER_PROXY_URL= MODULE_DOCKER_TAG= OSM_INSTALLATION_TYPE="Default" -while getopts ":a:b:c:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do +while getopts ":a:c:r:n:k:u:R:D:o:O:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o; do case "${o}" in a) APT_PROXY_URL=${OPTARG} ;; - b) - COMMIT_ID=${OPTARG} - PULL_IMAGES="" - ;; c) K8S_CLUSTER_ENGINE=${OPTARG} [ "${K8S_CLUSTER_ENGINE}" == "kubeadm" ] && continue @@ -838,23 +768,6 @@ while getopts ":a:b:c:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o N) OPENSTACK_PUBLIC_NET_NAME="${OPTARG}" ;; - m) - [ "${OPTARG}" == "NG-UI" ] && TO_REBUILD="$TO_REBUILD NG-UI" && continue - [ "${OPTARG}" == "NBI" ] && TO_REBUILD="$TO_REBUILD NBI" && continue - [ "${OPTARG}" == "LCM" ] && TO_REBUILD="$TO_REBUILD LCM" && continue - [ "${OPTARG}" == "RO" ] && TO_REBUILD="$TO_REBUILD RO" && continue - [ "${OPTARG}" == "MON" ] && TO_REBUILD="$TO_REBUILD MON" && continue - [ "${OPTARG}" == "POL" ] && TO_REBUILD="$TO_REBUILD POL" && continue - [ "${OPTARG}" == "PLA" ] && TO_REBUILD="$TO_REBUILD PLA" && continue - [ "${OPTARG}" == "osmclient" ] && TO_REBUILD="$TO_REBUILD osmclient" && continue - [ "${OPTARG}" == "KAFKA" ] && TO_REBUILD="$TO_REBUILD KAFKA" && continue - [ "${OPTARG}" == "MONGO" ] && TO_REBUILD="$TO_REBUILD MONGO" && continue - [ "${OPTARG}" == "PROMETHEUS" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS" && continue - [ "${OPTARG}" == "PROMETHEUS-CADVISOR" ] && TO_REBUILD="$TO_REBUILD PROMETHEUS-CADVISOR" && continue - [ "${OPTARG}" == "KEYSTONE-DB" ] && TO_REBUILD="$TO_REBUILD KEYSTONE-DB" && continue - [ "${OPTARG}" == "GRAFANA" ] && TO_REBUILD="$TO_REBUILD GRAFANA" && continue - [ "${OPTARG}" == "NONE" ] && TO_REBUILD="$TO_REBUILD NONE" && continue - ;; H) OSM_VCA_HOST="${OPTARG}" ;; @@ -897,9 +810,7 @@ while getopts ":a:b:c:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o ;; -) [ "${OPTARG}" == "help" ] && usage && exit 0 - [ "${OPTARG}" == "source" ] && INSTALL_FROM_SOURCE="y" && PULL_IMAGES="" && continue [ "${OPTARG}" == "debug" ] && DEBUG_INSTALL="--debug" && continue - [ "${OPTARG}" == "develop" ] && DEVELOP="y" && continue [ "${OPTARG}" == "uninstall" ] && UNINSTALL="y" && continue [ "${OPTARG}" == "update" ] && UPDATE="y" && continue [ "${OPTARG}" == "reconfigure" ] && RECONFIGURE="y" && continue @@ -913,9 +824,7 @@ while getopts ":a:b:c:r:n:k:u:R:D:o:O:m:N:H:S:s:t:U:P:A:l:L:K:d:p:T:f:F:-: hy" o [ "${OPTARG}" == "nohostports" ] && NO_HOST_PORTS="y" && continue [ "${OPTARG}" == "juju" ] && INSTALL_JUJU="y" && continue [ "${OPTARG}" == "nojuju" ] && INSTALL_JUJU="" && continue - [ "${OPTARG}" == "nodockerbuild" ] && DOCKER_NOBUILD="y" && continue [ "${OPTARG}" == "nohostclient" ] && INSTALL_NOHOSTCLIENT="y" && continue - [ "${OPTARG}" == "pullimages" ] && continue [ "${OPTARG}" == "k8s_monitor" ] && INSTALL_K8S_MONITOR="y" && continue [ "${OPTARG}" == "charmed" ] && CHARMED="y" && OSM_INSTALLATION_TYPE="Charmed" && continue [ "${OPTARG}" == "bundle" ] && continue @@ -1005,12 +914,7 @@ elif [ -n "$INSTALL_TO_OPENSTACK" ]; then exit 0 else # Community_installer - # Check incompatible options - [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" != " NONE" ] && echo $TO_REBUILD | grep -q NONE && FATAL "Incompatible option: -m NONE cannot be used with other -m options" - [ -n "$TO_REBUILD" ] && [ "$TO_REBUILD" == " PLA" ] && [ -z "$INSTALL_PLA" ] && FATAL "Incompatible option: -m PLA cannot be used without --pla option" # Special cases go first - # if develop, we force master - [ -z "$COMMIT_ID" ] && [ -n "$DEVELOP" ] && COMMIT_ID="master" [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_K8S_MONITOR" ] && install_k8s_monitoring [ -n "$INSTALL_ONLY" ] && [ -n "$INSTALL_NGSA" ] && install_osm_ngsa_service [ -n "$INSTALL_ONLY" ] && echo -e "\nDONE" && exit 0 diff --git a/installers/install_osm.sh b/installers/install_osm.sh index 23644215..a931c4fa 100755 --- a/installers/install_osm.sh +++ b/installers/install_osm.sh @@ -28,11 +28,6 @@ function usage(){ echo -e " -R : use specified release for osm binaries (deb packages, lxd images, ...)" echo -e " -u : use specified repository url for osm packages" echo -e " -k : use specified repository public key url" - echo -e " -b : install OSM from source code using a specific branch (master, v2.0, ...) or tag" - echo -e " -b master (main dev branch)" - echo -e " -b v2.0 (v2.0 branch)" - echo -e " -b tags/v1.1.0 (a specific tag)" - echo -e " ..." echo -e " -a : use this apt proxy url when downloading apt packages (air-gapped installation)" echo -e " -s namespace when installed using k8s, default is osm" echo -e " -H use specific juju host controller IP" @@ -42,7 +37,6 @@ function usage(){ echo -e " --pla: install the PLA module for placement support" echo -e " --old-sa: install old Service Assurance framework (MON, POL); do not install Airflow and Pushgateway" echo -e " --ng-sa: install new Service Assurance framework (Airflow, AlertManager and Pushgateway) (enabled by default)" - echo -e " -m : install OSM but only rebuild or pull the specified docker images (NG-UI, NBI, LCM, RO, MON, POL, PLA, KAFKA, MONGO, PROMETHEUS, PROMETHEUS-CADVISOR, KEYSTONE-DB, NONE)" echo -e " -o : ONLY (un)installs one of the addons (k8s_monitor, ng-sa)" echo -e " -O : Install OSM to an OpenStack infrastructure. is required. If a is used, the clouds.yaml file should be under ~/.config/openstack/ or /etc/openstack/" echo -e " -N : Public network name required to setup OSM to OpenStack" @@ -63,13 +57,9 @@ function usage(){ echo -e " --nolxd: do not install and configure LXD, allowing unattended installations (assumes LXD is already installed and confifured)" echo -e " --nodocker: do not install docker, do not initialize a swarm (assumes docker is already installed and a swarm has been initialized)" echo -e " --nojuju: do not juju, assumes already installed" - echo -e " --nodockerbuild:do not build docker images (use existing locally cached images)" echo -e " --nohostports: do not expose docker ports to host (useful for creating multiple instances of osm on the same host)" echo -e " --nohostclient: do not install the osmclient" echo -e " --uninstall: uninstall OSM: remove the containers and delete NAT rules" - echo -e " --source: install OSM from source code using the latest stable tag" - echo -e " --develop: (deprecated, use '-b master') install OSM from source code using the master branch" - echo -e " --pullimages: pull/run osm images from docker.io/opensourcemano" echo -e " --k8s_monitor: install the OSM kubernetes monitoring with prometheus and grafana" echo -e " --volume: create a VM volume when installing to OpenStack" echo -e " --showopts: print chosen options and exit (only for debugging)" -- 2.25.1