Skip to content

Commit a69bc77

Browse files
Fix with new kserve version moving from RawDeployment namee to standard (#1283)
* Fix with new kserve version moving from RawDeployment namee to standard Signed-off-by: Milind waykole <mwaykole@redhat.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Milind waykole <mwaykole@redhat.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 70a5608 commit a69bc77

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

tests/model_serving/model_server/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def verify_inference_response(
8888

8989
elif (
9090
isinstance(inference_service, InferenceGraph)
91-
and inference.deployment_mode == KServeDeploymentType.RAW_DEPLOYMENT
91+
and inference.deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES
9292
):
9393
assert "x-forbidden-reason: Access to the InferenceGraph is not allowed" in res["output"]
9494

utilities/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
class KServeDeploymentType:
88
SERVERLESS: str = "Serverless"
99
RAW_DEPLOYMENT: str = "RawDeployment"
10+
STANDARD: str = "Standard"
1011
MODEL_MESH: str = "ModelMesh"
1112

13+
RAW_DEPLOYMENT_MODES: tuple[str, ...] = (RAW_DEPLOYMENT, STANDARD)
14+
1215

1316
class ModelFormat:
1417
CAIKIT: str = "caikit"

utilities/general.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ def create_isvc_label_selector_str(isvc: InferenceService, resource_type: str, r
173173
174174
"""
175175
deployment_mode = isvc.instance.metadata.annotations.get(Annotations.KserveIo.DEPLOYMENT_MODE)
176-
if deployment_mode in (
177-
KServeDeploymentType.SERVERLESS,
178-
KServeDeploymentType.RAW_DEPLOYMENT,
176+
if (
177+
deployment_mode == KServeDeploymentType.SERVERLESS
178+
or deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES
179179
):
180180
return f"{isvc.ApiGroup.SERVING_KSERVE_IO}/inferenceservice={isvc.name}"
181181

utilities/inference_utils.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def is_service_exposed(self) -> bool:
118118
"""
119119
labels = self.inference_service.labels
120120

121-
if self.deployment_mode == KServeDeploymentType.RAW_DEPLOYMENT:
121+
if self.deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES:
122122
if isinstance(self.inference_service, InferenceGraph):
123123
# For InferenceGraph, the logic is similar as in Serverless. Only the label is different.
124124
return not (labels and labels.get(Labels.Kserve.NETWORKING_KSERVE_IO) == "cluster-local")
@@ -310,7 +310,7 @@ def generate_command(
310310

311311
elif self.protocol == "grpc":
312312
cmd_exec = "grpcurl -connect-timeout 10 "
313-
if self.deployment_mode == KServeDeploymentType.RAW_DEPLOYMENT:
313+
if self.deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES:
314314
cmd_exec += " --plaintext "
315315

316316
else:
@@ -536,10 +536,9 @@ def get_target_port(self, svc: Service) -> int:
536536
and port.protocol.lower() == svc_protocol.lower()
537537
and port.name == self.protocol
538538
) or (
539-
self.deployment_mode
540-
in (
541-
KServeDeploymentType.RAW_DEPLOYMENT,
542-
KServeDeploymentType.SERVERLESS,
539+
(
540+
self.deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES
541+
or self.deployment_mode == KServeDeploymentType.SERVERLESS
543542
)
544543
and port.protocol.lower() == svc_protocol.lower()
545544
):
@@ -679,15 +678,18 @@ def create_isvc(
679678
_annotations = {Annotations.KserveIo.DEPLOYMENT_MODE: deployment_mode}
680679

681680
# model mesh auth is set in ServingRuntime
682-
if enable_auth and deployment_mode in {KServeDeploymentType.SERVERLESS, KServeDeploymentType.RAW_DEPLOYMENT}:
681+
if enable_auth and (
682+
deployment_mode == KServeDeploymentType.SERVERLESS
683+
or deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES
684+
):
683685
_annotations[Annotations.KserveAuth.SECURITY] = "true"
684686

685687
# default to True if deployment_mode is Serverless (default behavior of Serverless) if was not provided by the user
686688
# model mesh external route is set in ServingRuntime
687689
if external_route is None and deployment_mode == KServeDeploymentType.SERVERLESS:
688690
external_route = True
689691

690-
if external_route and deployment_mode == KServeDeploymentType.RAW_DEPLOYMENT:
692+
if external_route and deployment_mode in KServeDeploymentType.RAW_DEPLOYMENT_MODES:
691693
labels[Labels.Kserve.NETWORKING_KSERVE_IO] = Labels.Kserve.EXPOSED
692694

693695
if deployment_mode == KServeDeploymentType.SERVERLESS and external_route is False:

utilities/infra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def wait_for_inference_deployment_replicas(
272272
# to be set in deployment spec by HPA
273273
if (
274274
isvc.instance.metadata.annotations.get("serving.kserve.io/deploymentMode")
275-
== KServeDeploymentType.RAW_DEPLOYMENT
275+
in KServeDeploymentType.RAW_DEPLOYMENT_MODES
276276
):
277277
wait_for_replicas_in_deployment(
278278
deployment=deployment,

0 commit comments

Comments
 (0)