Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize gmc manifest e2e tests #382

Merged
merged 1 commit into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/workflows/gmc-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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..."
Expand All @@ -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
Expand Down
44 changes: 2 additions & 42 deletions ChatQnA/tests/test_gmc_on_gaudi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
43 changes: 2 additions & 41 deletions ChatQnA/tests/test_gmc_on_xeon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down
46 changes: 3 additions & 43 deletions CodeGen/tests/test_gmc_on_gaudi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
;;
Expand Down
46 changes: 3 additions & 43 deletions CodeGen/tests/test_gmc_on_xeon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
;;
Expand Down
46 changes: 3 additions & 43 deletions CodeTrans/tests/test_gmc_on_gaudi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
;;
Expand Down
Loading