2 #------------------nanobot Pre-modification------------------------------------------------------------
\r
3 cd RIC/test/ric_robot_suite
\r
4 #------------------Build the robot suite---------------------------------------------------------------
\r
5 docker build -t nanobot:latest -f docker/Dockerfile.nanobot .
\r
7 #---------pre-create the log file directory- find the value from the values.yaml-----------------------
\r
8 sudo chown -R cloudadmin /opt
\r
9 mkdir -p /opt/ric/robot/log
\r
11 kubectl create namespace rictest
\r
12 kubectl create namespace ricxapp
\r
14 #----------create ricplatform danmnet-------------------------------------------------------------------
\r
15 cat <<! | kubectl apply -f -
\r
16 apiVersion: danm.k8s.io/v1
\r
23 NetworkType: flannel
\r
26 docker tag nanobot:latest registry.kube-system.svc.rec.io:5555/rictest/nanobot:latest
\r
27 docker push registry.kube-system.svc.rec.io:5555/rictest/nanobot:latest
\r
30 #--------edit the values.yaml file in the helm chart for nanobot to point to local registry--------------
\r
31 values_files="$(find . -name values.yaml)"
\r
32 for file in $values_files; do
\r
33 #sed -ri 's/^(\s*)(run\s*:\s*nanobot\s*$)/\1run: registry.kube-system.svc.rec.io:5555/rictest/nanobot/' "$file"
\r
34 sed -i 's/ domain: cluster.local/ domain: rec.io/' "$file"
\r
35 sed -i 's/ repository: .*$/ repository: registry.kube-system.svc.rec.io:5555/' "$file"
\r
36 sed -i 's/ name: test\/nanobot/ name: rictest\/nanobot/' "$file"
\r
40 deployment_files="$(find . -name job-ric-robot-run.yaml)"
\r
41 for file in $deployment_files; do
\r
42 sed -i "/restartPolicy: Never/s//&\\n\ nodeSelector:\n nodename: caas_master1\n/" "$file"
\r
45 #-------------------------add the helm chart to the repo-------------------------------------------------
\r
47 mkdir -p dist/packages
\r
49 helm package -d dist/packages nanobot
\r
50 helm serve --repo-path dist/packages &
\r
54 #-----------------------install the helm chart-----------------------------------------------------------
\r
55 helm install localric/nanobot --namespace rictest --name nanobot
\r
57 nanobot_pod=$(kubectl get pods -n rictest -o go-template --template '{{range .items}}{{.metadata.name}}{{"\n"}}{{end}}')
\r
59 kubectl logs $nanobot_pod -n rictest
\r
61 #------------checking the status of the rictest pod--------------------------------------
\r
62 command="$(kubectl get po --no-headers --namespace=rictest --field-selector status.phase=Completed 2> /dev/null)"
\r
63 if [[ $command != "" ]]; then
\r