X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=ric-infra%2F10-Nexus%2Fbin%2Finstall;h=cacb3a91262456a0ef047bd94d0b2625d2d0c30a;hb=a032714587f6e95ab9c00867f6532d2799e66aea;hp=c0c5ed04aea7563cf4f90b561730b2a28c07702a;hpb=7f1e409379856025977fc8a6ea04ddb215f21a13;p=it%2Fdep.git diff --git a/ric-infra/10-Nexus/bin/install b/ric-infra/10-Nexus/bin/install index c0c5ed04..cacb3a91 100755 --- a/ric-infra/10-Nexus/bin/install +++ b/ric-infra/10-Nexus/bin/install @@ -27,97 +27,62 @@ 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 - - - -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 "****************************************************************************************************************" - -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 - - -mkdir -p $DIR/../helm/charts/ -cp /tmp/common-$COMMON_CHART_VERSION.tgz $DIR/../helm/charts/ - -if [ -z $OVERRIDEYAML ]; then -helm install --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-nexus" $DIR/../helm +if [ -z "$RICAUX_NAMESPACE" ];then + AUX_NAMESPACE=$aux_namespace else -helm install -f $OVERRIDEYAML --namespace "${NAMESPACE}" --name "${RELEASE_NAME}-nexus" $DIR/../helm + AUX_NAMESPACE=$RICAUX_NAMESPACE +fi +if [ -z "$RICINFRA_NAMESPACE" ];then + INFRA_NAMESPACE=$infra_namespace +else + INFRA_NAMESPACE=$RICINFRA_NAMESPACE fi -NEXUS_POD_NAME=$(kubectl get pod -n $NAMESPACE | grep nexus | grep ContainerCreating | 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" - +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 - COUNTER=$((COUNTER+1)) - if [ $COUNTER -gt 5 ]; then - COUNTER=1 - fi +echo "Deploying nexus repo managers for local docker registry and helm repo." +echo "Helm Release: $RELEASE_NAME" - IS_NEXUS_READY=$(kubectl logs -n $NAMESPACE $NEXUS_POD_NAME | grep "Started Sonatype Nexus OSS") - sleep 5 -done -echo $IS_NEXUS_READY +NODENAME=$(kubectl get node | awk 'NR==2{print $1}') +kubectl label --overwrite nodes $NODENAME nexus-node=enable -DOCKERPORT=$(cat $DIR/../helm/templates/deployment.yaml | awk '/.*- name: docker.*/{getline; print $2}') +. "$DIR/clear_nexus_data_path" -DOCKERREPOSCRIPT="{\"name\":\"create_docker_repo\",\ - \"type\":\"groovy\",\ - \"content\":\"repository.createDockerHosted('docker.snapshot',\ - $DOCKERPORT, null, 'default', false, true)\"}" -echo $DOCKERREPOSCRIPT +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 -# This line uses the default admin password -curl -u admin:admin123 -X POST -H "Content-Type: application/json" --data "$DOCKERREPOSCRIPT" http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script -curl -u admin:admin123 -X POST -H 'Content-Type: text/plain' -H 'Accept: application/json' http://nexus.$HOSTPOSTFIX:$INGRESS_PORT_NEXUS/service/rest/v1/script/create_docker_repo/run +mkdir -p $DIR/../helm/charts/ +mkdir -p /tmp/nexus3-data +cp /tmp/ric-common-$COMMON_CHART_VERSION.tgz $DIR/../helm/charts/ +if [ -z $OVERRIDEYAML ]; then +helm install --namespace $INFRA_NAMESPACE --name "${RELEASE_NAME}-nexus" $COMMON_OVERRIDE $DIR/../helm +else +helm install -f $OVERRIDEYAML --namespace $INFRA_NAMESPACE --name "${RELEASE_NAME}-nexus" $COMMON_OVERRIDE $DIR/../helm +fi