From 15fc6f971154f19822ac8d9b168141a381c93114 Mon Sep 17 00:00:00 2001 From: Ying Chun Guo Date: Tue, 9 Jul 2024 14:46:58 +0800 Subject: [PATCH] Optimize gmc manifest e2e tests (#382) Signed-off-by: Yingchun Guo --- .github/workflows/gmc-e2e.yaml | 6 ---- ChatQnA/tests/test_gmc_on_gaudi.sh | 44 ++------------------------ ChatQnA/tests/test_gmc_on_xeon.sh | 43 ++----------------------- CodeGen/tests/test_gmc_on_gaudi.sh | 46 ++------------------------- CodeGen/tests/test_gmc_on_xeon.sh | 46 ++------------------------- CodeTrans/tests/test_gmc_on_gaudi.sh | 46 ++------------------------- CodeTrans/tests/test_gmc_on_xeon.sh | 46 ++------------------------- DocSum/tests/test_gmc_on_gaudi.sh | 46 ++------------------------- DocSum/tests/test_gmc_on_xeon.sh | 47 ++-------------------------- 9 files changed, 22 insertions(+), 348 deletions(-) diff --git a/.github/workflows/gmc-e2e.yaml b/.github/workflows/gmc-e2e.yaml index dede3411a..a0aca9c94 100644 --- a/.github/workflows/gmc-e2e.yaml +++ b/.github/workflows/gmc-e2e.yaml @@ -50,7 +50,6 @@ jobs: if [ ${{ matrix.hardware }} == "gaudi" ]; then IMAGE_REPO=${{ vars.IMAGE_REPO_GAUDI }}; else IMAGE_REPO=${{ vars.IMAGE_REPO_XEON }}; fi echo "IMAGE_REPO=$OPEA_IMAGE_REPO" >> $GITHUB_ENV lower_example=$(echo "${{ matrix.example }}" | tr '[:upper:]' '[:lower:]') - echo "SYSTEM_NAMESPACE=opea-system-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV echo "APP_NAMESPACE=$lower_example-$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV echo "ROLLOUT_TIMEOUT_SECONDS=1800s" >> $GITHUB_ENV echo "KUBECTL_TIMEOUT_SECONDS=60s" >> $GITHUB_ENV @@ -66,7 +65,6 @@ jobs: echo "No test script found, exist test!" exit 0 else - ${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh init_${{ matrix.example }} echo "should_cleanup=true" >> $GITHUB_ENV ${{ github.workspace }}/${{ matrix.example }}/tests/test_gmc_on_${{ matrix.hardware }}.sh install_${{ matrix.example }} echo "Testing ${{ matrix.example }}, waiting for pod ready..." @@ -93,10 +91,6 @@ jobs: if: always() run: | if $should_cleanup; then - if ! kubectl delete ns $SYSTEM_NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then - kubectl delete pods --namespace $SYSTEM_NAMESPACE --force --grace-period=0 --all - kubectl delete ns $SYSTEM_NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS - fi if ! kubectl delete ns $APP_NAMESPACE --timeout=$KUBECTL_TIMEOUT_SECONDS; then kubectl delete pods --namespace $APP_NAMESPACE --force --grace-period=0 --all kubectl delete ns $APP_NAMESPACE --force --grace-period=0 --timeout=$KUBECTL_TIMEOUT_SECONDS diff --git a/ChatQnA/tests/test_gmc_on_gaudi.sh b/ChatQnA/tests/test_gmc_on_gaudi.sh index 659a454ba..6dbfd677f 100755 --- a/ChatQnA/tests/test_gmc_on_gaudi.sh +++ b/ChatQnA/tests/test_gmc_on_gaudi.sh @@ -8,43 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_chatqna() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_chatqna() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE -} - -function validate_chatqna() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: chatqa|namespace: $APP_NAMESPACE|g" ./chatQnA_xeon.yaml kubectl apply -f ./chatQnA_xeon.yaml @@ -59,8 +23,9 @@ function validate_chatqna() { TGI_POD_NAME=$(kubectl get pods --namespace=$APP_NAMESPACE | grep ^tgi-service | awk '{print $1}') kubectl describe pod $TGI_POD_NAME -n $APP_NAMESPACE kubectl wait --for=condition=ready pod/$TGI_POD_NAME --namespace=$APP_NAMESPACE --timeout=300s +} - +function validate_chatqna() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -167,11 +132,6 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_ChatQnA) - pushd ChatQnA/kubernetes - init_chatqna - popd - ;; install_ChatQnA) pushd ChatQnA/kubernetes install_chatqna diff --git a/ChatQnA/tests/test_gmc_on_xeon.sh b/ChatQnA/tests/test_gmc_on_xeon.sh index c8dd49075..1fe53de88 100755 --- a/ChatQnA/tests/test_gmc_on_xeon.sh +++ b/ChatQnA/tests/test_gmc_on_xeon.sh @@ -8,43 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_chatqna() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_chatqna() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE -} - -function validate_chatqna() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: chatqa|namespace: $APP_NAMESPACE|g" ./chatQnA_xeon.yaml kubectl apply -f ./chatQnA_xeon.yaml @@ -59,7 +23,9 @@ function validate_chatqna() { TGI_POD_NAME=$(kubectl get pods --namespace=$APP_NAMESPACE | grep ^tgi-service | awk '{print $1}') kubectl describe pod $TGI_POD_NAME -n $APP_NAMESPACE kubectl wait --for=condition=ready pod/$TGI_POD_NAME --namespace=$APP_NAMESPACE --timeout=300s +} +function validate_chatqna() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -167,11 +133,6 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_ChatQnA) - pushd ChatQnA/kubernetes - init_chatqna - popd - ;; install_ChatQnA) pushd ChatQnA/kubernetes install_chatqna diff --git a/CodeGen/tests/test_gmc_on_gaudi.sh b/CodeGen/tests/test_gmc_on_gaudi.sh index b3ae1e477..94ab6bab4 100755 --- a/CodeGen/tests/test_gmc_on_gaudi.sh +++ b/CodeGen/tests/test_gmc_on_gaudi.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_codegen() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_codegen() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_codegen() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: codegen|namespace: $APP_NAMESPACE|g" ./codegen_gaudi.yaml kubectl apply -f ./codegen_gaudi.yaml @@ -55,7 +18,9 @@ function validate_codegen() { wait_until_pod_ready "codegen router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} +function validate_codegen() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -146,13 +111,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_CodeGen) - pushd ChatQnA/kubernetes - init_codegen - popd - ;; install_CodeGen) - pushd ChatQnA/kubernetes + pushd CodeGen/kubernetes install_codegen popd ;; diff --git a/CodeGen/tests/test_gmc_on_xeon.sh b/CodeGen/tests/test_gmc_on_xeon.sh index 2d12a300a..e9496e5f9 100755 --- a/CodeGen/tests/test_gmc_on_xeon.sh +++ b/CodeGen/tests/test_gmc_on_xeon.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_codegen() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_codegen() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_codegen() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: codegen|namespace: $APP_NAMESPACE|g" ./codegen_xeon.yaml kubectl apply -f ./codegen_xeon.yaml @@ -55,7 +18,9 @@ function validate_codegen() { wait_until_pod_ready "codegen router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} +function validate_codegen() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -146,13 +111,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_CodeGen) - pushd ChatQnA/kubernetes - init_codegen - popd - ;; install_CodeGen) - pushd ChatQnA/kubernetes + pushd CodeGen/kubernetes install_codegen popd ;; diff --git a/CodeTrans/tests/test_gmc_on_gaudi.sh b/CodeTrans/tests/test_gmc_on_gaudi.sh index f9d5fe47f..b16b96ac9 100755 --- a/CodeTrans/tests/test_gmc_on_gaudi.sh +++ b/CodeTrans/tests/test_gmc_on_gaudi.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_codetrans() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_codetrans() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_codetrans() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: codetrans|namespace: $APP_NAMESPACE|g" ./codetrans_gaudi.yaml kubectl apply -f ./codetrans_gaudi.yaml @@ -55,7 +18,9 @@ function validate_codetrans() { wait_until_pod_ready "codetrans router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} +function validate_codetrans() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -145,13 +110,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_CodeTrans) - pushd ChatQnA/kubernetes - init_codetrans - popd - ;; install_CodeTrans) - pushd ChatQnA/kubernetes + pushd CodeTrans/kubernetes install_codetrans popd ;; diff --git a/CodeTrans/tests/test_gmc_on_xeon.sh b/CodeTrans/tests/test_gmc_on_xeon.sh index f91023c14..1f15b869f 100755 --- a/CodeTrans/tests/test_gmc_on_xeon.sh +++ b/CodeTrans/tests/test_gmc_on_xeon.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_codetrans() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_codetrans() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_codetrans() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: codetrans|namespace: $APP_NAMESPACE|g" ./codetrans_xeon.yaml kubectl apply -f ./codetrans_xeon.yaml @@ -55,7 +18,9 @@ function validate_codetrans() { wait_until_pod_ready "codetrans router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} +function validate_codetrans() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -145,13 +110,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_CodeTrans) - pushd ChatQnA/kubernetes - init_codetrans - popd - ;; install_CodeTrans) - pushd ChatQnA/kubernetes + pushd CodeTrans/kubernetes install_codetrans popd ;; diff --git a/DocSum/tests/test_gmc_on_gaudi.sh b/DocSum/tests/test_gmc_on_gaudi.sh index f73d15330..77945f37e 100755 --- a/DocSum/tests/test_gmc_on_gaudi.sh +++ b/DocSum/tests/test_gmc_on_gaudi.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_docsum() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_docsum() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_docsum() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: docsum|namespace: $APP_NAMESPACE|g" ./docsum_gaudi.yaml kubectl apply -f ./docsum_gaudi.yaml @@ -55,7 +18,9 @@ function validate_docsum() { wait_until_pod_ready "docsum router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} +function validate_docsum() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -146,13 +111,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_DocSum) - pushd ChatQnA/kubernetes - init_docsum - popd - ;; install_DocSum) - pushd ChatQnA/kubernetes + pushd DocSum/kubernetes install_docsum popd ;; diff --git a/DocSum/tests/test_gmc_on_xeon.sh b/DocSum/tests/test_gmc_on_xeon.sh index 9c0b414fb..b952d90e8 100755 --- a/DocSum/tests/test_gmc_on_xeon.sh +++ b/DocSum/tests/test_gmc_on_xeon.sh @@ -8,44 +8,7 @@ LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub IMAGE_REPO=${IMAGE_REPO:-} -function init_docsum() { - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/crd/bases/gmc.opea.io_gmconnectors.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/rbac/gmc-manager-rbac.yaml - wget https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/manager/gmc-manager.yaml - wget -O manifests/gmc-router.yaml https://raw.githubusercontent.com/opea-project/GenAIInfra/main/microservices-connector/config/gmcrouter/gmc-router.yaml - - # replace namespace for gmc-router and gmc-manager - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager.yaml - sed -i "s|namespace: system|namespace: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - sed -i "s|name: system|name: $SYSTEM_NAMESPACE|g" ./gmc-manager-rbac.yaml - # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" - find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/models#path: $MOUNT_DIR#g" {} \; - # replace the repository "image: opea/*" with "image: ${IMAGE_REPO}opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" {} \; - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; - # set huggingface token - find . -name '*.yaml' -type f -exec sed -i "s#\${HUGGINGFACEHUB_API_TOKEN}#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; - # replace namespace "default" with real namespace - find . -name '*.yaml' -type f -exec sed -i "s#default.svc#$APP_NAMESPACE.svc#g" {} \; -} - function install_docsum() { - # Make sure you have to use image tag $VERSION for microservice-connector installation - echo "install microservice-connector, using repo $DOCKER_REGISTRY and tag $VERSION" - echo "using namespace $SYSTEM_NAMESPACE and $APP_NAMESPACE" - - kubectl apply -f ./gmc.opea.io_gmconnectors.yaml - kubectl apply -f ./gmc-manager-rbac.yaml - kubectl create configmap gmcyaml -n $SYSTEM_NAMESPACE --from-file $(pwd)/../kubernetes/manifests - kubectl apply -f ./gmc-manager.yaml - - # Wait until the gmc controller pod is ready - wait_until_pod_ready "gmc-controller" $SYSTEM_NAMESPACE "gmc-controller" - kubectl get pods -n $SYSTEM_NAMESPACE - rm -f ./gmc.opea.io_gmconnectors.yaml ./gmc-manager-rbac.yaml ./gmc-manager.yaml manifests/gmc-router.yaml -} - -function validate_docsum() { kubectl create ns $APP_NAMESPACE sed -i "s|namespace: docsum|namespace: $APP_NAMESPACE|g" ./docsum_xeon.yaml kubectl apply -f ./docsum_xeon.yaml @@ -55,8 +18,9 @@ function validate_docsum() { wait_until_pod_ready "docsum router" $APP_NAMESPACE "router-service" output=$(kubectl get pods -n $APP_NAMESPACE) echo $output +} - +function validate_docsum() { # deploy client pod for testing kubectl create deployment client-test -n $APP_NAMESPACE --image=python:3.8.13 -- sleep infinity @@ -147,13 +111,8 @@ if [ $# -eq 0 ]; then fi case "$1" in - init_DocSum) - pushd ChatQnA/kubernetes - init_docsum - popd - ;; install_DocSum) - pushd ChatQnA/kubernetes + pushd DocSum/kubernetes install_docsum popd ;;