From 1923acfa5c8f7dadc4b401bb6a2678e662526eeb Mon Sep 17 00:00:00 2001 From: Sivanantham Chinnaiyan Date: Mon, 12 Feb 2024 21:32:07 +0530 Subject: [PATCH] Remove knative installation in raw tests Signed-off-by: Sivanantham Chinnaiyan --- .github/actions/kserve-dep-setup/action.yml | 6 ++++- .github/workflows/e2e-test.yml | 16 ++++++------ test/e2e/common/utils.py | 5 ---- test/scripts/gh-actions/setup-deps.sh | 27 ++++++++++++--------- test/scripts/gh-actions/setup-kserve.sh | 9 ++++++- 5 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.github/actions/kserve-dep-setup/action.yml b/.github/actions/kserve-dep-setup/action.yml index c3cf92a4f18..37a08dd830f 100644 --- a/.github/actions/kserve-dep-setup/action.yml +++ b/.github/actions/kserve-dep-setup/action.yml @@ -5,6 +5,10 @@ inputs: description: 'Network layer to install' required: true default: 'istio' + deployment-mode: + description: 'Kserve deployment mode. Supported values are serverless and raw' + required: false + default: 'serverless' runs: using: "composite" steps: @@ -15,7 +19,7 @@ runs: if [[ "${{ inputs.network-layer }}" == "istio" ]]; then echo "Selected network layer ${{ inputs.network-layer }}" - ./test/scripts/gh-actions/setup-deps.sh + ./test/scripts/gh-actions/setup-deps.sh ${{ inputs.deployment-mode }} kubectl get pods -n istio-system kubectl describe svc -n istio-system istio-ingressgateway diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 02a5301b736..17f7b921f3f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -275,6 +275,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Free-up disk space + uses: ./.github/actions/free-up-disk-space + - name: Setup Go uses: actions/setup-go@v4 with: @@ -285,18 +288,15 @@ jobs: with: python-version: "3.9" - - name: Free-up disk space - uses: ./.github/actions/free-up-disk-space - - name: Setup Minikube uses: ./.github/actions/minikube-setup - - name: Download base images - uses: ./.github/actions/base-download - - name: KServe dependency setup uses: ./.github/actions/kserve-dep-setup + - name: Download base images + uses: ./.github/actions/base-download + - name: Download predictor artifacts uses: actions/download-artifact@v4 with: @@ -670,6 +670,8 @@ jobs: - uses: ./.github/actions/free-up-disk-space - uses: ./.github/actions/minikube-setup - uses: ./.github/actions/kserve-dep-setup + with: + deployment-mode: "raw" - uses: ./.github/actions/base-download - name: Download sklearn server image @@ -700,7 +702,7 @@ jobs: - name: Install KServe run: | - ./test/scripts/gh-actions/setup-kserve.sh + ./test/scripts/gh-actions/setup-kserve.sh "raw" kubectl get pods -n kserve kubectl describe pods -n kserve diff --git a/test/e2e/common/utils.py b/test/e2e/common/utils.py index cfa990b83e2..2870de3f46c 100644 --- a/test/e2e/common/utils.py +++ b/test/e2e/common/utils.py @@ -13,7 +13,6 @@ import json import logging import os -import time from urllib.parse import urlparse import grpc @@ -81,8 +80,6 @@ def predict_str(service_name, input_json, protocol_version="v1", namespace=KSERVE_TEST_NAMESPACE, version=version, ) - # temporary sleep until this is fixed https://github.com/kserve/kserve/issues/604 - time.sleep(10) cluster_ip, host, path = get_isvc_endpoint(isvc) headers = {"Host": host, "Content-Type": "application/json"} @@ -151,8 +148,6 @@ def explain_response(service_name, input_json): namespace=KSERVE_TEST_NAMESPACE, version=constants.KSERVE_V1BETA1_VERSION, ) - # temporary sleep until this is fixed https://github.com/kserve/kserve/issues/604 - time.sleep(10) cluster_ip, host, _ = get_isvc_endpoint(isvc) url = "http://{}/v1/models/{}:explain".format(cluster_ip, service_name) headers = {"Host": host} diff --git a/test/scripts/gh-actions/setup-deps.sh b/test/scripts/gh-actions/setup-deps.sh index aa2f4b69fa8..a7152d98c3a 100755 --- a/test/scripts/gh-actions/setup-deps.sh +++ b/test/scripts/gh-actions/setup-deps.sh @@ -22,6 +22,7 @@ set -o nounset set -o pipefail SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]:-$0}"; )" &> /dev/null && pwd 2> /dev/null; )"; +DEPLOYMENT_MODE="$1" ISTIO_VERSION="1.19.4" CERT_MANAGER_VERSION="v1.5.0" @@ -56,18 +57,20 @@ spec: controller: istio.io/ingress-controller EOF -source ./test/scripts/gh-actions/install-knative-operator.sh - -echo "Installing Knative serving ..." -kubectl apply -f ./test/overlays/knative/knative-serving-istio.yaml -# sleep to avoid running kubectl wait before pods are created -sleep 15 - -echo "Waiting for Knative to be ready ..." -kubectl wait --for=condition=Ready pods --all --timeout=400s -n knative-serving -l 'app in (webhook, activator,autoscaler,autoscaler-hpa,controller,net-istio-controller,net-istio-webhook)' - -# echo "Add knative hpa..." -# kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.0.0/serving-hpa.yaml +shopt -s nocasematch +if [[ $DEPLOYMENT_MODE != "raw" ]];then + source ./test/scripts/gh-actions/install-knative-operator.sh + + echo "Installing Knative serving ..." + kubectl apply -f ./test/overlays/knative/knative-serving-istio.yaml + # sleep to avoid running kubectl wait before pods are created + sleep 15 + echo "Waiting for Knative to be ready ..." + kubectl wait --for=condition=Ready pods --all --timeout=400s -n knative-serving -l 'app in (webhook, activator,autoscaler,autoscaler-hpa,controller,net-istio-controller,net-istio-webhook)' + # echo "Add knative hpa..." + # kubectl apply -f https://github.com/knative/serving/releases/download/knative-v1.0.0/serving-hpa.yaml +fi +shopt -u nocasematch echo "Installing cert-manager ..." kubectl create namespace cert-manager diff --git a/test/scripts/gh-actions/setup-kserve.sh b/test/scripts/gh-actions/setup-kserve.sh index 4e0d6baf3de..addd61df6d1 100755 --- a/test/scripts/gh-actions/setup-kserve.sh +++ b/test/scripts/gh-actions/setup-kserve.sh @@ -16,13 +16,20 @@ # The script will install KServe dependencies in the GH Actions environment. # (Istio, Knative, cert-manager, kustomize, yq) +# Usage: setup-kserve.sh $DEPLOYMENT_MODE set -o errexit set -o nounset set -o pipefail +DEPLOYMENT_MODE=$1 make deploy-ci - +shopt -s nocasematch +if [[ $DEPLOYMENT_MODE == "raw" ]];then + echo "Patching default deployment mode to raw deployment" + kubectl patch cm -n kserve inferenceservice-config --patch='{"data": {"deploy": "{\"defaultDeploymentMode\": \"RawDeployment\"}"}}' +fi +shopt -u nocasematch echo "Waiting for KServe started ..." kubectl wait --for=condition=Ready pods --all --timeout=180s -n kserve kubectl get events -A