Merge "Update docker version"
[it/dep.git] / ric-infra / 10-Nexus / bin / install
index 452924b..f1ca83a 100755 (executable)
@@ -27,95 +27,61 @@ if [ -z "$RICINFRA_RELEASE_NAME" ];then
 else
    RELEASE_NAME=$RICINFRA_RELEASE_NAME
 fi
-if [ -z "$RICINFRA_NAMESPACE" ];then
-   NAMESPACE=$namespace
+
+# Namespace configuration
+if [ -z "$RICPLT_NAMESPACE" ];then
+   PLT_NAMESPACE=$plt_namespace
 else
-   NAMESPACE=$RICINFRA_NAMESPACE
+   PLT_NAMESPACE=$RICPLT_NAMESPACE
 fi
-if [ -z "$INGRESS_PORT" ];then
-   INGRESS_PORT_NEXUS=$ingress_port
+if [ -z "$RICXAPP_NAMESPACE" ];then
+   XAPP_NAMESPACE=$xapp_namespace
 else
-   INGRESS_PORT_NEXUS=$INGRESS_PORT
+   XAPP_NAMESPACE=$RICXAPP_NAMESPACE
+fi
+if [ -z "$RICAUX_NAMESPACE" ];then
+   AUX_NAMESPACE=$aux_namespace
+else
+   AUX_NAMESPACE=$RICAUX_NAMESPACE
+fi
+if [ -z "$RICINFRA_NAMESPACE" ];then
+   INFRA_NAMESPACE=$infra_namespace
+else
+   INFRA_NAMESPACE=$RICINFRA_NAMESPACE
 fi
 
-
+if [ -z "$RIC_COMMON_OVERRIDE" ];then
+   COMMON_OVERRIDE="--set global.namespace.platform=$PLT_NAMESPACE --set global.namespace.xapp=$XAPP_NAMESPACE --set global.namespace.aux=$AUX_NAMESPACE --set global.namespace.infra=$INFRA_NAMESPACE"
+else
+   COMMON_OVERRIDE=$RIC_COMMON_OVERRIDE
+fi
 
 echo "Deploying nexus repo managers for local docker registry and helm repo."
-echo "Name Space: $NAMESPACE"
 echo "Helm Release: $RELEASE_NAME"
 
-HOSTPOSTFIX=$(cat $DIR/../helm/values.yaml  | grep hostpostfix | awk '{print $2}')
-
-
-echo "****************************************************************************************************************"
-echo "                                                     WARNING                                                    "
-echo "****************************************************************************************************************"
-
-echo "Nexus is deployed using default admin password. It is not for production deployment."
-echo "If you want to secure the repositories, you should change the admin password immediately."
-echo "You can access this nexus here: http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS"
-echo "If nexus.$HOSTPOSTFIX is not resolved by your DNS server, please add an entry in your /etc/hosts file."
-echo "****************************************************************************************************************"
-
-. ./deploy_nexus_data $OVERRIDEYAML
 
 
 
 NODENAME=$(kubectl get node | awk 'NR==2{print $1}')
 kubectl label --overwrite nodes $NODENAME nexus-node=enable
 
+. ./clear_nexus_data_path
 
 
 
-
-
-COMMON_CHART_VERSION=$(cat $DIR/../../../ric-platform/50-RIC-Platform/helm/common/Chart.yaml | grep version | awk '{print $2}')
-helm package -d /tmp $DIR/../../../ric-platform/50-RIC-Platform/helm/common
+COMMON_CHART_VERSION=$(cat $DIR/../../../ric-common/Common-Template/helm/ric-common/Chart.yaml | grep version | awk '{print $2}')
+helm package -d /tmp $DIR/../../../ric-common/Common-Template/helm/ric-common
 
 
 mkdir -p  $DIR/../helm/charts/
-cp /tmp/common-$COMMON_CHART_VERSION.tgz $DIR/../helm/charts/
+cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/charts/
 
 if [ -z $OVERRIDEYAML ]; then
-helm install --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-nexus" $DIR/../helm
+helm install --namespace $INFRA_NAMESPACE --name "${RELEASE_NAME}-nexus" $COMMON_OVERRIDE $DIR/../helm
 else
-helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-nexus" $DIR/../helm
+helm install -f $OVERRIDEYAML --namespace $INFRA_NAMESPACE --name "${RELEASE_NAME}-nexus" $COMMON_OVERRIDE $DIR/../helm
 fi
 
 
 
-NEXUS_POD_NAME=$(kubectl get pod -n $NAMESPACE | grep nexus | grep -v "Terminating" | awk '{print $1}')
-
-
-echo "Waiting Nexus to be ready."
-echo " "
-
-sleep 10
-
-IS_NEXUS_READY=$(kubectl logs -n $NAMESPACE $NEXUS_POD_NAME | grep "Started Sonatype Nexus OSS")
-
-COUNTER=1
-while [[ -z $IS_NEXUS_READY ]]; do
-        echo -e "\033[2AWaiting Nexus to be ready."
-        echo -e "\033[2K"
-        PROGRESS=$(printf "%0.s-" $(seq 1 $COUNTER))
-        echo -e "\033[1A$PROGRESS"
-
-
-        COUNTER=$((COUNTER+1))
-        if [ $COUNTER -gt 5 ]; then
-                COUNTER=1
-        fi
-
-       IS_NEXUS_READY=$(kubectl logs -n $NAMESPACE $NEXUS_POD_NAME | grep "Started Sonatype Nexus OSS")
-
-        sleep 5
-done
-
-echo $IS_NEXUS_READY
-
-
-. ./change_password $OVERRIDEYAML
-
-