Update installer shell scripts to set env vars after getopts 95/14495/1
authorgarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 23 Jul 2024 13:24:00 +0000 (15:24 +0200)
committergarciadeblas <gerardo.garciadeblas@telefonica.com>
Tue, 23 Jul 2024 13:24:14 +0000 (15:24 +0200)
Change-Id: I656df0d03d986928768d0f108719cf16002c8f40
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
installers/install_cluster_addons.sh
installers/install_docker_ce.sh
installers/install_helm_client.sh
installers/install_k3s_cluster.sh
installers/install_kubeadm_cluster.sh
installers/install_mongodb.sh
installers/install_ngsa.sh

index 58c64ee..b546418 100755 (executable)
 
 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
index 5010f7e..16fb817 100755 (executable)
@@ -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
index fdaeb79..427a2e1 100755 (executable)
@@ -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
index 68f1b2b..a604ef1 100755 (executable)
@@ -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
index f0f49c2..1a4aedf 100755 (executable)
@@ -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"
index 984eda1..213d2f4 100755 (executable)
@@ -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
index 347ab48..6931432 100755 (executable)
@@ -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