Optimize gmc manifest e2e tests (#382)
Signed-off-by: Yingchun Guo <yingchun.guo@intel.com>
This commit is contained in:
@@ -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
|
||||
;;
|
||||
|
||||
@@ -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
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user