Skip to content

Commit f0eaa31

Browse files
authored
[RHOAIENG-36673] - Investigate and Refactor KServe E2E Test Suite for RawDeployment mode only (#987)
chore: Fix tests. Adapt the setup and run e2e tests to work with Raw Deployment Update failing tests to work with Raw Deployment mode Signed-off-by: Spolti <[email protected]>
1 parent 0207b4a commit f0eaa31

23 files changed

+315
-113
lines changed

config/overlays/odh/inferenceservice-config-patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ data:
7777
}
7878
deploy: |-
7979
{
80-
"defaultDeploymentMode": "Serverless"
80+
"defaultDeploymentMode": "RawDeployment"
8181
}
8282
metricsAggregator: |-
8383
{

config/overlays/test/dsc.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ spec:
1919
kserve:
2020
defaultDeploymentMode: Serverless
2121
managementState: Managed
22+
nim:
23+
managementState: Removed
2224
serving:
2325
ingressGateway:
2426
certificate:
2527
type: OpenshiftDefaultIngress
26-
managementState: Managed
28+
managementState: Removed
2729
name: knative-serving
2830
modelmeshserving:
2931
managementState: Removed

python/kserve/kserve/constants/constants.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737

3838
KSERVE_LOGLEVEL = os.environ.get("KSERVE_LOGLEVEL", "INFO").upper()
3939

40+
# KServe label constants
41+
KSERVE_LABEL_NETWORKING_VISIBILITY = "networking.kserve.io/visibility"
42+
KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED = "exposed"
43+
4044
# INFERENCESERVICE credentials common constants
4145
INFERENCESERVICE_CONFIG_MAP_NAME = "inferenceservice-config"
4246
INFERENCESERVICE_SYSTEM_NAMESPACE = "kserve"

test/e2e/batcher/test_batcher.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ async def test_batcher(rest_v1_client):
5252
api_version=constants.KSERVE_V1BETA1,
5353
kind=constants.KSERVE_KIND_INFERENCESERVICE,
5454
metadata=client.V1ObjectMeta(
55-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
55+
name=service_name,
56+
namespace=KSERVE_TEST_NAMESPACE,
57+
labels={
58+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
59+
},
5660
),
5761
spec=V1beta1InferenceServiceSpec(predictor=predictor),
5862
)

test/e2e/batcher/test_batcher_custom_port.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ async def test_batcher_custom_port(rest_v1_client):
5656
api_version=constants.KSERVE_V1BETA1,
5757
kind=constants.KSERVE_KIND_INFERENCESERVICE,
5858
metadata=client.V1ObjectMeta(
59-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
59+
name=service_name,
60+
namespace=KSERVE_TEST_NAMESPACE,
61+
labels={
62+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
63+
},
6064
),
6165
spec=V1beta1InferenceServiceSpec(predictor=predictor),
6266
)

test/e2e/common/utils.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,9 @@ def grpc_client(host, cluster_ip):
4343
if ":" not in cluster_ip:
4444
cluster_ip = cluster_ip + ":80"
4545
logger.info("Cluster IP: %s", cluster_ip)
46-
logger.info("gRPC target host: %s", host)
4746
return InferenceGRPCClient(
4847
cluster_ip,
4948
verbose=True,
50-
channel_args=[
51-
("grpc.ssl_target_name_override", host),
52-
],
53-
timeout=120,
5449
)
5550

5651

@@ -277,6 +272,7 @@ async def predict_grpc(
277272

278273
if model_name is None:
279274
model_name = service_name
275+
280276
client = grpc_client(host, cluster_ip)
281277

282278
response = await client.infer(
@@ -312,10 +308,16 @@ def get_isvc_endpoint(isvc, network_layer: str = "istio"):
312308
scheme = urlparse(isvc["status"]["url"]).scheme
313309
host = urlparse(isvc["status"]["url"]).netloc
314310
path = urlparse(isvc["status"]["url"]).path
315-
if os.environ.get("CI_USE_ISVC_HOST") == "1":
311+
ci_use_isvc_host = os.environ.get("CI_USE_ISVC_HOST")
312+
logger.info(f"CI_USE_ISVC_HOST = {ci_use_isvc_host}")
313+
logger.info(f"Host from isvc status URL = {host}")
314+
logger.info(f"Network layer = {network_layer}")
315+
if ci_use_isvc_host == "1":
316316
cluster_ip = host
317+
logger.info(f"Using external route host: {cluster_ip}")
317318
elif network_layer == "istio" or network_layer == "istio-ingress":
318319
cluster_ip = get_cluster_ip()
320+
logger.info(f"Using internal cluster IP: {cluster_ip}")
319321
elif network_layer == "envoy-gatewayapi":
320322
cluster_ip = get_cluster_ip(
321323
namespace="envoy-gateway-system",

test/e2e/logger/test_logger.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,13 @@ async def test_kserve_logger(rest_v1_client):
5353
isvc = V1beta1InferenceService(
5454
api_version=constants.KSERVE_V1BETA1,
5555
kind=constants.KSERVE_KIND_INFERENCESERVICE,
56-
metadata=client.V1ObjectMeta(name=msg_dumper, namespace=KSERVE_TEST_NAMESPACE),
56+
metadata=client.V1ObjectMeta(
57+
name=msg_dumper,
58+
namespace=KSERVE_TEST_NAMESPACE,
59+
labels={
60+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
61+
},
62+
),
5763
spec=V1beta1InferenceServiceSpec(predictor=predictor),
5864
)
5965

@@ -65,7 +71,7 @@ async def test_kserve_logger(rest_v1_client):
6571
min_replicas=1,
6672
logger=V1beta1LoggerSpec(
6773
mode="all",
68-
url=f"http://{msg_dumper}." + KSERVE_TEST_NAMESPACE + ".svc.cluster.local",
74+
url=f"http://{msg_dumper}-predictor." + KSERVE_TEST_NAMESPACE + ".svc.cluster.local",
6975
),
7076
sklearn=V1beta1SKLearnSpec(
7177
storage_uri="gs://kfserving-examples/models/sklearn/1.0/model",
@@ -80,7 +86,11 @@ async def test_kserve_logger(rest_v1_client):
8086
api_version=constants.KSERVE_V1BETA1,
8187
kind=constants.KSERVE_KIND_INFERENCESERVICE,
8288
metadata=client.V1ObjectMeta(
83-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
89+
name=service_name,
90+
namespace=KSERVE_TEST_NAMESPACE,
91+
labels={
92+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
93+
},
8494
),
8595
spec=V1beta1InferenceServiceSpec(predictor=predictor),
8696
)

test/e2e/predictor/test_autoscaling.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
@pytest.mark.predictor
5252
@pytest.mark.asyncio(scope="session")
53+
@pytest.mark.skip("We do not test anymore with Knative")
5354
async def test_sklearn_kserve_concurrency(rest_v1_client):
5455
service_name = "isvc-sklearn-scale-concurrency"
5556
predictor = V1beta1PredictorSpec(
@@ -68,7 +69,8 @@ async def test_sklearn_kserve_concurrency(rest_v1_client):
6869
api_version=constants.KSERVE_V1BETA1,
6970
kind=constants.KSERVE_KIND_INFERENCESERVICE,
7071
metadata=client.V1ObjectMeta(
71-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
72+
name=service_name,
73+
namespace=KSERVE_TEST_NAMESPACE
7274
),
7375
spec=V1beta1InferenceServiceSpec(predictor=predictor),
7476
)
@@ -94,6 +96,7 @@ async def test_sklearn_kserve_concurrency(rest_v1_client):
9496

9597
@pytest.mark.predictor
9698
@pytest.mark.asyncio(scope="session")
99+
@pytest.mark.skip("We do not test anymore with Knative")
97100
async def test_sklearn_kserve_rps(rest_v1_client):
98101
service_name = "isvc-sklearn-scale-rps"
99102
predictor = V1beta1PredictorSpec(
@@ -113,7 +116,8 @@ async def test_sklearn_kserve_rps(rest_v1_client):
113116
api_version=constants.KSERVE_V1BETA1,
114117
kind=constants.KSERVE_KIND_INFERENCESERVICE,
115118
metadata=client.V1ObjectMeta(
116-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
119+
name=service_name,
120+
namespace=KSERVE_TEST_NAMESPACE
117121
),
118122
spec=V1beta1InferenceServiceSpec(predictor=predictor),
119123
)
@@ -137,7 +141,7 @@ async def test_sklearn_kserve_rps(rest_v1_client):
137141
kserve_client.delete(service_name, KSERVE_TEST_NAMESPACE)
138142

139143

140-
@pytest.mark.skip()
144+
@pytest.mark.skip("Not needed to test with knative")
141145
@pytest.mark.asyncio(scope="session")
142146
async def test_sklearn_kserve_cpu(rest_v1_client):
143147
service_name = "isvc-sklearn-scale-cpu"

test/e2e/predictor/test_canary.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
@pytest.mark.predictor
3535
@pytest.mark.path_based_routing
36+
@pytest.mark.skip(reason="Canary rollouts require Knative Serving and are not supported in RawDeployment mode")
3637
def test_canary_rollout():
3738
service_name = "isvc-canary"
3839
default_endpoint_spec = V1beta1InferenceServiceSpec(
@@ -52,7 +53,8 @@ def test_canary_rollout():
5253
api_version=constants.KSERVE_V1BETA1,
5354
kind=constants.KSERVE_KIND_INFERENCESERVICE,
5455
metadata=client.V1ObjectMeta(
55-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
56+
name=service_name,
57+
namespace=KSERVE_TEST_NAMESPACE,
5658
),
5759
spec=default_endpoint_spec,
5860
)
@@ -96,6 +98,7 @@ def test_canary_rollout():
9698

9799
@pytest.mark.predictor
98100
@pytest.mark.path_based_routing
101+
@pytest.mark.skip(reason="Canary rollouts require Knative Serving and are not supported in RawDeployment mode")
99102
def test_canary_rollout_runtime():
100103
service_name = "isvc-canary-runtime"
101104
default_endpoint_spec = V1beta1InferenceServiceSpec(
@@ -118,7 +121,8 @@ def test_canary_rollout_runtime():
118121
api_version=constants.KSERVE_V1BETA1,
119122
kind=constants.KSERVE_KIND_INFERENCESERVICE,
120123
metadata=client.V1ObjectMeta(
121-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
124+
name=service_name,
125+
namespace=KSERVE_TEST_NAMESPACE,
122126
),
123127
spec=default_endpoint_spec,
124128
)

test/e2e/predictor/test_lightgbm.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ async def test_lightgbm_kserve(rest_v1_client):
5454
api_version=constants.KSERVE_V1BETA1,
5555
kind=constants.KSERVE_KIND_INFERENCESERVICE,
5656
metadata=client.V1ObjectMeta(
57-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
57+
name=service_name,
58+
namespace=KSERVE_TEST_NAMESPACE,
59+
labels={
60+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
61+
},
5862
),
5963
spec=V1beta1InferenceServiceSpec(predictor=predictor),
6064
)
@@ -93,7 +97,11 @@ async def test_lightgbm_runtime_kserve(rest_v1_client):
9397
api_version=constants.KSERVE_V1BETA1,
9498
kind=constants.KSERVE_KIND_INFERENCESERVICE,
9599
metadata=client.V1ObjectMeta(
96-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
100+
name=service_name,
101+
namespace=KSERVE_TEST_NAMESPACE,
102+
labels={
103+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
104+
},
97105
),
98106
spec=V1beta1InferenceServiceSpec(predictor=predictor),
99107
)
@@ -148,7 +156,11 @@ async def test_lightgbm_v2_runtime_mlserver(rest_v2_client):
148156
api_version=constants.KSERVE_V1BETA1,
149157
kind=constants.KSERVE_KIND_INFERENCESERVICE,
150158
metadata=client.V1ObjectMeta(
151-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
159+
name=service_name,
160+
namespace=KSERVE_TEST_NAMESPACE,
161+
labels={
162+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
163+
},
152164
),
153165
spec=V1beta1InferenceServiceSpec(predictor=predictor),
154166
)
@@ -201,7 +213,11 @@ async def test_lightgbm_v2_kserve(rest_v2_client):
201213
api_version=constants.KSERVE_V1BETA1,
202214
kind=constants.KSERVE_KIND_INFERENCESERVICE,
203215
metadata=client.V1ObjectMeta(
204-
name=service_name, namespace=KSERVE_TEST_NAMESPACE
216+
name=service_name,
217+
namespace=KSERVE_TEST_NAMESPACE,
218+
labels={
219+
constants.KSERVE_LABEL_NETWORKING_VISIBILITY: constants.KSERVE_LABEL_NETWORKING_VISIBILITY_EXPOSED,
220+
},
205221
),
206222
spec=V1beta1InferenceServiceSpec(predictor=predictor),
207223
)

0 commit comments

Comments
 (0)