From 829811653a85ead18cc39b933a218ba05173545b Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Tue, 23 Jul 2024 15:24:00 +0200 Subject: [PATCH] Update installer shell scripts to set env vars after getopts Change-Id: I656df0d03d986928768d0f108719cf16002c8f40 Signed-off-by: garciadeblas --- installers/install_cluster_addons.sh | 23 +++++++++++++---------- installers/install_docker_ce.sh | 11 +++++------ installers/install_helm_client.sh | 9 +++++---- installers/install_k3s_cluster.sh | 13 ++++++------- installers/install_kubeadm_cluster.sh | 14 +++++++------- installers/install_mongodb.sh | 24 ++++++++++++------------ installers/install_ngsa.sh | 27 ++++++++++++++------------- 7 files changed, 62 insertions(+), 59 deletions(-) diff --git a/installers/install_cluster_addons.sh b/installers/install_cluster_addons.sh index 58c64eec..b5464189 100755 --- a/installers/install_cluster_addons.sh +++ b/installers/install_cluster_addons.sh @@ -15,11 +15,6 @@ set +eux -INSTALL_STORAGECLASS="" -INSTALL_METALLB="" -INSTALL_CERTMANAGER="" -INSTALL_NGINX="" - function install_k8s_storageclass() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function # Openebs versions can be found here: https://github.com/openebs/openebs/releases @@ -257,14 +252,22 @@ while getopts ":D:d:i:-: " o; do esac done +DEBUG_INSTALL=${DEBUG_INSTALL:-} +DEFAULT_IP=${DEFAULT_IP:-} +OSM_DEVOPS=${OSM_DEVOPS:-} +OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR:-} +INSTALL_STORAGECLASS=${INSTALL_STORAGECLASS:-} +INSTALL_METALLB=${INSTALL_METALLB:-} +INSTALL_CERTMANAGER=${INSTALL_CERTMANAGER:-} +INSTALL_NGINX=${INSTALL_NGINX:-} +echo "DEBUG_INSTALL=${DEBUG_INSTALL}" +echo "DEFAULT_IP=${DEFAULT_IP}" +echo "OSM_DEVOPS=${OSM_DEVOPS}" +echo "OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR}" + source $OSM_DEVOPS/common/logging source $OSM_DEVOPS/common/track -echo "DEBUG_INSTALL=${DEBUG_INSTALL:-}" -echo "DEFAULT_IP=${DEFAULT_IP:-}" -echo "OSM_DEVOPS=${OSM_DEVOPS:-}" -echo "OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR:-}" - if [ -n "${INSTALL_STORAGECLASS}" ]; then install_k8s_storageclass track k8scluster k8s_storageclass_ok diff --git a/installers/install_docker_ce.sh b/installers/install_docker_ce.sh index 5010f7e3..16fb817a 100755 --- a/installers/install_docker_ce.sh +++ b/installers/install_docker_ce.sh @@ -116,9 +116,6 @@ EOF" return 0 } -OSM_BEHIND_PROXY="" -DOCKER_PROXY_URL="" - while getopts ":D:p:-: P" o; do case "${o}" in D) @@ -149,12 +146,14 @@ while getopts ":D:p:-: P" o; do esac done -source $OSM_DEVOPS/common/logging - +DEBUG_INSTALL=${DEBUG_INSTALL:-} +DOCKER_PROXY_URL=${DOCKER_PROXY_URL:-} +OSM_BEHIND_PROXY=${OSM_BEHIND_PROXY:-} echo "DEBUG_INSTALL=$DEBUG_INSTALL" echo "DOCKER_PROXY_URL=$DOCKER_PROXY_URL" echo "OSM_BEHIND_PROXY=$OSM_BEHIND_PROXY" echo "USER=$USER" -install_docker_ce +source $OSM_DEVOPS/common/logging +install_docker_ce diff --git a/installers/install_helm_client.sh b/installers/install_helm_client.sh index fdaeb79c..427a2e12 100755 --- a/installers/install_helm_client.sh +++ b/installers/install_helm_client.sh @@ -63,11 +63,12 @@ while getopts ":D:-: " o; do esac done -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - +DEBUG_INSTALL=${DEBUG_INSTALL:-} +OSM_DEVOPS=${OSM_DEVOPS:-} echo "DEBUG_INSTALL=$DEBUG_INSTALL" -echo "DEFAULT_IP=$DEFAULT_IP" echo "OSM_DEVOPS=$OSM_DEVOPS" +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track + install_helm_client diff --git a/installers/install_k3s_cluster.sh b/installers/install_k3s_cluster.sh index 68f1b2b3..a604ef16 100755 --- a/installers/install_k3s_cluster.sh +++ b/installers/install_k3s_cluster.sh @@ -138,10 +138,6 @@ function save_kubeconfig() { } # main -DEFAULT_IP="127.0.0.1" -OSM_DEVOPS="/usr/share/osm-devops" -DEBUG_INSTALL="" - while getopts ":D:i:-: " o; do case "${o}" in i) @@ -169,14 +165,17 @@ while getopts ":D:i:-: " o; do esac done -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - +DEBUG_INSTALL=${DEBUG_INSTALL:-} +DEFAULT_IP=${DEFAULT_IP:-"127.0.0.1"} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} echo "DEBUG_INSTALL=${DEBUG_INSTALL}" echo "DEFAULT_IP=${DEFAULT_IP}" echo "OSM_DEVOPS=${OSM_DEVOPS}" echo "HOME=$HOME" +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track + install_k3s track k8scluster k3s_install_ok check_for_readiness diff --git a/installers/install_kubeadm_cluster.sh b/installers/install_kubeadm_cluster.sh index f0f49c2d..1a4aedf3 100755 --- a/installers/install_kubeadm_cluster.sh +++ b/installers/install_kubeadm_cluster.sh @@ -131,11 +131,8 @@ function remove_k8s_namespace() { kubectl delete ns $1 2>/dev/null [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } -# main -OSM_CLUSTER_WORK_DIR="/etc/osm" -OSM_DEVOPS="/usr/share/osm-devops" -DEBUG_INSTALL="" +# main while getopts ":D:d:-: " o; do case "${o}" in d) @@ -163,14 +160,17 @@ while getopts ":D:d:-: " o; do esac done -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - +DEBUG_INSTALL=${DEBUG_INSTALL:-} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} +OSM_CLUSTER_WORK_DIR=${OSM_CLUSTER_WORK_DIR:-"/etc/osm"} echo "DEBUG_INSTALL=$DEBUG_INSTALL" echo "OSM_DEVOPS=$OSM_DEVOPS" echo "OSM_CLUSTER_WORK_DIR=$OSM_CLUSTER_WORK_DIR" echo "HOME=$HOME" +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track + echo "Creating folders for installation" [ ! -d "$OSM_CLUSTER_WORK_DIR" ] && sudo mkdir -p $OSM_CLUSTER_WORK_DIR echo "Copying kubeadm-config from $OSM_DEVOPS/installers/kubeadm-config.yaml to $OSM_CLUSTER_WORK_DIR/kubeadm-config.yaml" diff --git a/installers/install_mongodb.sh b/installers/install_mongodb.sh index 984eda14..213d2f45 100755 --- a/installers/install_mongodb.sh +++ b/installers/install_mongodb.sh @@ -18,7 +18,6 @@ set +eux # Helm chart 13.9.4 correspondes to Mongo DB 6.0.5 MONGODB_HELM_VERSION=13.9.4 - # Install MongoDB helm chart function install_mongodb() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function @@ -34,14 +33,6 @@ function install_mongodb() { } # main - -DOCKER_REGISTRY_URL= -DOCKER_USER="opensourcemano" -OSM_DEVOPS="/usr/share/osm-devops" -OSM_DOCKER_TAG="testing-daily" -OSM_HELM_WORK_DIR="/etc/osm/helm" -OSM_NAMESPACE="osm" - while getopts ":D:d:s:t:r:U:-: " o; do case "${o}" in D) @@ -81,13 +72,22 @@ while getopts ":D:d:s:t:r:U:-: " o; do esac done -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - +DEBUG_INSTALL=${DEBUG_INSTALL:-} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} +OSM_DOCKER_TAG=${OSM_DOCKER_TAG:-"testing-daily"} +OSM_HELM_WORK_DIR=${OSM_HELM_WORK_DIR:-"/etc/osm/helm"} +OSM_NAMESPACE=${OSM_NAMESPACE:-"osm"} +DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-} +DOCKER_USER=${DOCKER_USER:-"opensourcemano"} echo "DEBUG_INSTALL=$DEBUG_INSTALL" echo "OSM_DEVOPS=$OSM_DEVOPS" echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" echo "OSM_NAMESPACE=$OSM_NAMESPACE" +echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" +echo "DOCKER_USER=$DOCKER_USER" + +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track install_mongodb diff --git a/installers/install_ngsa.sh b/installers/install_ngsa.sh index 347ab489..69314327 100755 --- a/installers/install_ngsa.sh +++ b/installers/install_ngsa.sh @@ -39,15 +39,6 @@ function install_airflow() { } # main - -DOCKER_REGISTRY_URL= -DOCKER_USER="opensourcemano" -OSM_DEVOPS="/usr/share/osm-devops" -OSM_DOCKER_TAG="testing-daily" -OSM_HELM_WORK_DIR="/etc/osm/helm" -OSM_NAMESPACE="osm" -DEFAULT_IP="127.0.0.1" - while getopts ":D:d:i:s:t:r:U:-: " o; do case "${o}" in i) @@ -90,15 +81,25 @@ while getopts ":D:d:i:s:t:r:U:-: " o; do esac done -source $OSM_DEVOPS/common/logging -source $OSM_DEVOPS/common/track - -echo "DEFAULT_IP=$DEFAULT_IP" +DEBUG_INSTALL=${DEBUG_INSTALL:-} +DEFAULT_IP=${DEFAULT_IP:-"127.0.0.1"} +OSM_DEVOPS=${OSM_DEVOPS:-"/usr/share/osm-devops"} +OSM_DOCKER_TAG=${OSM_DOCKER_TAG:-"testing-daily"} +OSM_HELM_WORK_DIR=${OSM_HELM_WORK_DIR:-"/etc/osm/helm"} +OSM_NAMESPACE=${OSM_NAMESPACE:-"osm"} +DOCKER_REGISTRY_URL=${DOCKER_REGISTRY_URL:-} +DOCKER_USER=${DOCKER_USER:-"opensourcemano"} echo "DEBUG_INSTALL=$DEBUG_INSTALL" +echo "DEFAULT_IP=$DEFAULT_IP" echo "OSM_DEVOPS=$OSM_DEVOPS" echo "OSM_DOCKER_TAG=$OSM_DOCKER_TAG" echo "OSM_HELM_WORK_DIR=$OSM_HELM_WORK_DIR" echo "OSM_NAMESPACE=$OSM_NAMESPACE" +echo "DOCKER_REGISTRY_URL=$DOCKER_REGISTRY_URL" +echo "DOCKER_USER=$DOCKER_USER" + +source $OSM_DEVOPS/common/logging +source $OSM_DEVOPS/common/track install_airflow track deploy_osm airflow_ok -- 2.25.1