Update deployment of OSM to use input OSM_BASE_DOMAIN, otherwise set it from nginx IP address

Change-Id: I4a6191777e021924013f969f009623634b3d6aab
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/installers/40-deploy-osm.sh b/installers/40-deploy-osm.sh
index 93b4630..b1aab27 100755
--- a/installers/40-deploy-osm.sh
+++ b/installers/40-deploy-osm.sh
@@ -40,11 +40,12 @@
 fi
 
 export KUBECONFIG="${OSM_HOME_DIR}/clusters/kubeconfig-osm.yaml"
-if [ -z "${OSM_K8S_NGINX_IPADDRESS}" ]; then
-    echo "OSM_K8S_NGINX_IPADDRESS is not set, will try to get it from the cluster"
+if [ -z "${OSM_BASE_DOMAIN}" ]; then
+    echo "OSM_BASE_DOMAIN is not set, will try to set it from the nginx ingress controller load balancer IP"
     OSM_K8S_NGINX_IPADDRESS=$(kubectl get svc ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}' 2>/dev/null)
+    OSM_BASE_DOMAIN="${OSM_BASE_DOMAIN:-"${OSM_K8S_NGINX_IPADDRESS}.nip.io"}"
 fi
-echo "Using OSM_K8S_NGINX_IPADDRESS=${OSM_K8S_NGINX_IPADDRESS}"
+echo "Using OSM_BASE_DOMAIN=${OSM_BASE_DOMAIN}"
 
 # Create folder to store helm values
 sudo mkdir -p ${OSM_HELM_WORK_DIR}
@@ -80,7 +81,6 @@
 [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set-string global.image.tag=${OSM_DOCKER_TAG}"
 [ ! "$OSM_DOCKER_TAG" == "testing-daily" ] && OSM_HELM_OPTS="${OSM_HELM_OPTS} --set prometheus.server.sidecarContainers.prometheus-config-sidecar.image=${DOCKER_REGISTRY_URL}${DOCKER_USER}/prometheus:${OSM_DOCKER_TAG}"
 
-OSM_BASE_DOMAIN="${OSM_BASE_DOMAIN:-"${OSM_K8S_NGINX_IPADDRESS}.nip.io"}"
 OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.hostname=${OSM_BASE_DOMAIN}"
 if [ -n "${OSM_CLUSTER_INGRESS_CLASS}" ]; then
     OSM_HELM_OPTS="${OSM_HELM_OPTS} --set global.ingressClassName=${OSM_CLUSTER_INGRESS_CLASS}"