forked from kserve/kserve
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added github action to test kserve helm (kserve#2588)
* added github action to test kserve helm Signed-off-by: Suresh Nakkeran <[email protected]> * added testcase for modelmesh helm installation Signed-off-by: Suresh-Nakkeran <[email protected]> * add portforward in modelmesh helm testcase Signed-off-by: Suresh-Nakkeran <[email protected]> * added wait flag in helm installation Signed-off-by: Suresh-Nakkeran <[email protected]> Signed-off-by: Suresh Nakkeran <[email protected]> Signed-off-by: Suresh-Nakkeran <[email protected]>
- Loading branch information
1 parent
50648a5
commit 4778517
Showing
11 changed files
with
473 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
{ | ||
"inputs": [ | ||
{ | ||
"name": "predict", | ||
"shape": [ | ||
1, | ||
64 | ||
], | ||
"datatype": "FP32", | ||
"data": [ | ||
0.0, | ||
0.0, | ||
1.0, | ||
11.0, | ||
14.0, | ||
15.0, | ||
3.0, | ||
0.0, | ||
0.0, | ||
1.0, | ||
13.0, | ||
16.0, | ||
12.0, | ||
16.0, | ||
8.0, | ||
0.0, | ||
0.0, | ||
8.0, | ||
16.0, | ||
4.0, | ||
6.0, | ||
16.0, | ||
5.0, | ||
0.0, | ||
0.0, | ||
5.0, | ||
15.0, | ||
11.0, | ||
13.0, | ||
14.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
2.0, | ||
12.0, | ||
16.0, | ||
13.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
13.0, | ||
16.0, | ||
16.0, | ||
6.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
16.0, | ||
16.0, | ||
16.0, | ||
7.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
0.0, | ||
11.0, | ||
13.0, | ||
12.0, | ||
1.0, | ||
0.0 | ||
] | ||
} | ||
] | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright 2022 The KServe Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
|
||
import pytest | ||
from kubernetes import client | ||
from kubernetes.client import V1ResourceRequirements | ||
|
||
from kserve import ( | ||
KServeClient, | ||
V1beta1InferenceService, | ||
V1beta1InferenceServiceSpec, | ||
V1beta1ModelFormat, | ||
V1beta1ModelSpec, | ||
V1beta1PredictorSpec, | ||
constants | ||
) | ||
|
||
from ..common.utils import KSERVE_TEST_NAMESPACE, predict | ||
|
||
|
||
@pytest.mark.helm | ||
def test_sklearn_kserve(): | ||
service_name = "isvc-sklearn-kserve" | ||
|
||
predictor = V1beta1PredictorSpec( | ||
min_replicas=1, | ||
model=V1beta1ModelSpec( | ||
model_format=V1beta1ModelFormat( | ||
name="sklearn", | ||
), | ||
runtime="kserve-mlserver", | ||
storage_uri="gs://seldon-models/sklearn/mms/lr_model", | ||
protocol_version="v2", | ||
resources=V1ResourceRequirements( | ||
requests={"cpu": "50m", "memory": "128Mi"}, | ||
limits={"cpu": "100m", "memory": "512Mi"}, | ||
), | ||
), | ||
) | ||
|
||
isvc = V1beta1InferenceService( | ||
api_version=constants.KSERVE_V1BETA1, | ||
kind=constants.KSERVE_KIND, | ||
metadata=client.V1ObjectMeta( | ||
name=service_name, namespace=KSERVE_TEST_NAMESPACE | ||
), | ||
spec=V1beta1InferenceServiceSpec(predictor=predictor), | ||
) | ||
|
||
kserve_client = KServeClient( | ||
config_file=os.environ.get("KUBECONFIG", "~/.kube/config")) | ||
kserve_client.create(isvc) | ||
kserve_client.wait_isvc_ready( | ||
service_name, namespace=KSERVE_TEST_NAMESPACE) | ||
|
||
res = predict(service_name, "./data/iris_input_v2.json", | ||
protocol_version="v2") | ||
assert res["outputs"][0]["data"] == [1, 1] | ||
|
||
kserve_client.delete(service_name, KSERVE_TEST_NAMESPACE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright 2022 The KServe Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import os | ||
|
||
import pytest | ||
from kubernetes import client | ||
from kubernetes.client import V1ResourceRequirements | ||
|
||
from kserve import ( | ||
KServeClient, | ||
V1beta1InferenceService, | ||
V1beta1InferenceServiceSpec, | ||
V1beta1ModelFormat, | ||
V1beta1ModelSpec, | ||
V1beta1PredictorSpec, | ||
V1beta1StorageSpec, | ||
constants | ||
) | ||
|
||
from ..common.utils import predict_modelmesh | ||
|
||
|
||
@pytest.mark.helm | ||
def test_sklearn_modelmesh(): | ||
service_name = "isvc-sklearn-modelmesh" | ||
annotations = dict() | ||
annotations["serving.kserve.io/deploymentMode"] = "ModelMesh" | ||
predictor = V1beta1PredictorSpec( | ||
min_replicas=1, | ||
model=V1beta1ModelSpec( | ||
model_format=V1beta1ModelFormat( | ||
name="sklearn", | ||
), | ||
resources=V1ResourceRequirements( | ||
requests={"cpu": "50m", "memory": "128Mi"}, | ||
limits={"cpu": "100m", "memory": "512Mi"}, | ||
), | ||
storage=V1beta1StorageSpec( | ||
key="localMinIO", | ||
path="sklearn/mnist-svm.joblib" | ||
) | ||
), | ||
) | ||
|
||
isvc = V1beta1InferenceService( | ||
api_version=constants.KSERVE_V1BETA1, | ||
kind=constants.KSERVE_KIND, | ||
metadata=client.V1ObjectMeta( | ||
name=service_name, | ||
annotations=annotations | ||
), | ||
spec=V1beta1InferenceServiceSpec(predictor=predictor), | ||
) | ||
|
||
kserve_client = KServeClient( | ||
config_file=os.environ.get("KUBECONFIG", "~/.kube/config")) | ||
kserve_client.create(isvc) | ||
kserve_client.wait_isvc_ready(service_name) | ||
pods = kserve_client.core_api.list_namespaced_pod("default", label_selector="name=modelmesh-serving-mlserver-0.x") | ||
|
||
pod_name = pods.items[0].metadata.name | ||
res = predict_modelmesh(service_name, "./data/mm_sklearn_input.json", pod_name) | ||
assert res["outputs"][0]["data"] == [8] | ||
|
||
kserve_client.delete(service_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ markers = | |
pmml: pmml e2e tests | ||
grpc: grpc tests | ||
graph: inference graph tests | ||
helm: helm e2e tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2022 The KServe Authors. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# The script will install KServe dependencies in the GH Actions environment. | ||
# (Istio, Knative, cert-manager, kustomize, yq) | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
sed -i -e "s/*defaultVersion/${GITHUB_SHA}/g" charts/kserve-resources/values.yaml | ||
|
||
cat ./charts/kserve-resources/values.yaml | ||
|
||
make deploy-helm | ||
|
||
echo "Updating modelmesh default replicas count..." | ||
kubectl patch servingruntimes mlserver-0.x --type='merge' -p '{"spec":{"replicas":1}}' | ||
|
||
echo "Get events of all pods ..." | ||
kubectl get events -A | ||
|
||
echo "Add testing models to minio storage ..." | ||
kubectl apply -f config/overlays/test/minio/minio-init-job.yaml | ||
kubectl wait --for=condition=complete --timeout=90s job/minio-init | ||
|
||
echo "Creating a namespace kserve-ci-test ..." | ||
kubectl create namespace kserve-ci-e2e-test | ||
|
||
echo "Add storageSpec testing secrets ..." | ||
kubectl apply -f config/overlays/test/minio/minio-user-secret.yaml -n kserve-ci-e2e-test | ||
|
||
echo "Installing KServe Python SDK ..." | ||
python3 -m pip install --upgrade pip | ||
pushd python/kserve >/dev/null | ||
pip3 install -e .[test] --user | ||
popd |
Oops, something went wrong.