Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use data connection secret to store s3 info, use storage-initializer mage from the cluster #97

Merged
merged 30 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b362382
Create size-labeler.yml
rnetser Dec 18, 2024
3c6a875
Delete .github/workflows/size-labeler.yml
rnetser Dec 18, 2024
ccb63af
Merge branch 'main' of github.com:rnetser/opendatahub-tests
rnetser Dec 24, 2024
da0c898
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 25, 2024
94a82ec
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 26, 2024
c0c82dd
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 27, 2024
5feb447
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 30, 2024
19b9c56
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
e22ac1a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
56ab9c5
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
5a17f03
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
ef5fe65
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Dec 31, 2024
1875a44
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 1, 2025
840d442
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 2, 2025
c0d4436
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 2, 2025
ba7971a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 3, 2025
fd73a94
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 7, 2025
bde0493
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 8, 2025
d3cd799
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 9, 2025
710befa
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 12, 2025
b3bbc6a
get storage-in from cluster
rnetser Jan 15, 2025
689ddaa
move to json-based secrets
rnetser Jan 15, 2025
c5bd402
update storage path
rnetser Jan 16, 2025
47fd3b2
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 16, 2025
a0297ae
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 16, 2025
350e60a
Merge branch 'main' of https://github.com/opendatahub-io/opendatahub-…
rnetser Jan 19, 2025
644627d
fix labels
rnetser Jan 19, 2025
87b1daf
remove unused ci_s3_storage_uri
rnetser Jan 19, 2025
f7f6cf6
refactor annottions class in constants
rnetser Jan 20, 2025
4b9e4a7
resolve conflicts
rnetser Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 10 additions & 23 deletions tests/model_serving/model_server/authentication/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import shlex
from typing import Any, Generator
from urllib.parse import urlparse

import pytest
from _pytest.fixtures import FixtureRequest
Expand Down Expand Up @@ -74,17 +75,17 @@ def grpc_s3_inference_service(
model_namespace: Namespace,
grpc_s3_caikit_serving_runtime: ServingRuntime,
s3_models_storage_uri: str,
grpc_model_service_account: ServiceAccount,
models_endpoint_s3_secret: Secret,
) -> InferenceService:
with create_isvc(
client=admin_client,
name=f"{Protocols.GRPC}-{ModelFormat.CAIKIT}",
namespace=model_namespace.name,
runtime=grpc_s3_caikit_serving_runtime.name,
storage_uri=s3_models_storage_uri,
model_format=grpc_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
storage_key=models_endpoint_s3_secret.name,
storage_path=urlparse(s3_models_storage_uri).path,
deployment_mode=KServeDeploymentType.SERVERLESS,
model_service_account=grpc_model_service_account.name,
enable_auth=True,
) as isvc:
yield isvc
Expand Down Expand Up @@ -199,18 +200,18 @@ def http_s3_caikit_serverless_inference_service(
model_namespace: Namespace,
http_s3_caikit_tgis_serving_runtime: ServingRuntime,
s3_models_storage_uri: str,
model_service_account: ServiceAccount,
models_endpoint_s3_secret: Secret,
) -> InferenceService:
with create_isvc(
client=admin_client,
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}",
namespace=model_namespace.name,
runtime=http_s3_caikit_tgis_serving_runtime.name,
storage_uri=s3_models_storage_uri,
model_format=http_s3_caikit_tgis_serving_runtime.instance.spec.supportedModelFormats[0].name,
deployment_mode=KServeDeploymentType.SERVERLESS,
model_service_account=model_service_account.name,
enable_auth=True,
storage_key=models_endpoint_s3_secret.name,
storage_path=urlparse(s3_models_storage_uri).path,
) as isvc:
yield isvc

Expand Down Expand Up @@ -266,37 +267,23 @@ def unprivileged_models_endpoint_s3_secret(
yield secret


@pytest.fixture(scope="class")
def unprivileged_model_service_account(
unprivileged_client: DynamicClient, unprivileged_models_endpoint_s3_secret: Secret
) -> ServiceAccount:
with ServiceAccount(
client=unprivileged_client,
namespace=unprivileged_models_endpoint_s3_secret.namespace,
name=f"{Protocols.HTTP}-models-bucket-sa",
secrets=[{"name": unprivileged_models_endpoint_s3_secret.name}],
) as sa:
yield sa


@pytest.fixture(scope="class")
def unprivileged_s3_caikit_serverless_inference_service(
request: FixtureRequest,
unprivileged_client: DynamicClient,
unprivileged_model_namespace: Namespace,
unprivileged_s3_caikit_serving_runtime: ServingRuntime,
s3_models_storage_uri: str,
unprivileged_model_service_account: ServiceAccount,
unprivileged_models_endpoint_s3_secret: Secret,
) -> InferenceService:
with create_isvc(
client=unprivileged_client,
name=f"{Protocols.HTTP}-{ModelFormat.CAIKIT}",
namespace=unprivileged_model_namespace.name,
runtime=unprivileged_s3_caikit_serving_runtime.name,
storage_uri=s3_models_storage_uri,
model_format=unprivileged_s3_caikit_serving_runtime.instance.spec.supportedModelFormats[0].name,
deployment_mode=KServeDeploymentType.SERVERLESS,
model_service_account=unprivileged_model_service_account.name,
storage_key=unprivileged_models_endpoint_s3_secret.name,
storage_path=request.param["model-dir"],
) as isvc:
yield isvc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@


@pytest.mark.parametrize(
"unprivileged_model_namespace, s3_models_storage_uri, unprivileged_s3_caikit_serverless_inference_service",
"unprivileged_model_namespace, unprivileged_s3_caikit_serverless_inference_service",
[
pytest.param(
{"name": "non-admin-test"},
{"model-dir": ModelStoragePath.FLAN_T5_SMALL},
{"enable-auth": False},
)
],
indirect=True,
Expand Down
12 changes: 3 additions & 9 deletions tests/model_serving/model_server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,29 +95,23 @@ def serving_runtime_from_template(
yield model_runtime


@pytest.fixture(scope="class")
def ci_s3_storage_uri(request: FixtureRequest, ci_s3_bucket_name: str) -> str:
return f"s3://{ci_s3_bucket_name}/{request.param['model-dir']}/"


@pytest.fixture(scope="class")
def s3_models_inference_service(
request: FixtureRequest,
admin_client: DynamicClient,
model_namespace: Namespace,
serving_runtime_from_template: ServingRuntime,
s3_models_storage_uri: str,
model_service_account: ServiceAccount,
models_endpoint_s3_secret: Secret,
) -> InferenceService:
isvc_kwargs = {
"client": admin_client,
"name": request.param["name"],
"namespace": model_namespace.name,
"runtime": serving_runtime_from_template.name,
"storage_uri": s3_models_storage_uri,
"model_format": serving_runtime_from_template.instance.spec.supportedModelFormats[0].name,
"model_service_account": model_service_account.name,
"deployment_mode": request.param["deployment-mode"],
"storage_key": models_endpoint_s3_secret.name,
"storage_path": request.param["model-dir"],
}

if (external_route := request.param.get("external-route")) is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@
@pytest.mark.serverless
@pytest.mark.jira("RHOAIENG-3236", run=False)
@pytest.mark.parametrize(
"model_namespace, s3_models_storage_uri, serving_runtime_from_template, s3_models_inference_service",
"model_namespace, serving_runtime_from_template, s3_models_inference_service",
[
pytest.param(
{"name": "kserve-tgis-metrics"},
{"model-dir": ModelStoragePath.FLAN_T5_SMALL},
{
"name": f"{Protocols.HTTP}-{ModelInferenceRuntime.CAIKIT_TGIS_RUNTIME}",
"template-name": RuntimeTemplates.CAIKIT_TGIS_SERVING,
"multi-model": False,
"enable-http": True,
},
{"name": f"{Protocols.HTTP}-{ModelFormat.CAIKIT}", "deployment-mode": KServeDeploymentType.SERVERLESS},
{
"name": f"{Protocols.HTTP}-{ModelFormat.CAIKIT}",
"deployment-mode": KServeDeploymentType.SERVERLESS,
"model-dir": ModelStoragePath.FLAN_T5_SMALL,
},
)
],
indirect=True,
Expand Down
20 changes: 3 additions & 17 deletions tests/model_serving/model_server/ovms/kserve/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
from ocp_resources.inference_service import InferenceService
from ocp_resources.namespace import Namespace
from ocp_resources.secret import Secret
from ocp_resources.service_account import ServiceAccount
from ocp_resources.serving_runtime import ServingRuntime

from tests.model_serving.model_server.utils import create_isvc
from utilities.constants import (
KServeDeploymentType,
ModelAndFormat,
Protocols,
RuntimeTemplates,
)
from utilities.infra import s3_endpoint_secret
Expand Down Expand Up @@ -64,35 +62,23 @@ def ci_endpoint_s3_secret(
yield secret


@pytest.fixture(scope="class")
def openvino_model_service_account(admin_client: DynamicClient, ci_endpoint_s3_secret: Secret) -> ServiceAccount:
with ServiceAccount(
client=admin_client,
namespace=ci_endpoint_s3_secret.namespace,
name=f"{Protocols.GRPC}-models-bucket-sa",
secrets=[{"name": ci_endpoint_s3_secret.name}],
) as sa:
yield sa


@pytest.fixture(scope="class")
def ovms_serverless_inference_service(
request: FixtureRequest,
admin_client: DynamicClient,
model_namespace: Namespace,
openvino_kserve_serving_runtime: ServingRuntime,
ci_s3_storage_uri: str,
openvino_model_service_account: ServiceAccount,
ci_endpoint_s3_secret: Secret,
) -> InferenceService:
with create_isvc(
client=admin_client,
name=f"{request.param['name']}-serverless",
namespace=model_namespace.name,
runtime=openvino_kserve_serving_runtime.name,
storage_uri=ci_s3_storage_uri,
storage_path=request.param["model-dir"],
storage_key=ci_endpoint_s3_secret.name,
model_format=ModelAndFormat.OPENVINO_IR,
deployment_mode=KServeDeploymentType.SERVERLESS,
model_service_account=openvino_model_service_account.name,
model_version=request.param["model-version"],
) as isvc:
yield isvc
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@

@pytest.mark.serverless
@pytest.mark.parametrize(
"model_namespace, ci_s3_storage_uri, openvino_kserve_serving_runtime, ovms_serverless_inference_service",
"model_namespace, openvino_kserve_serving_runtime, ovms_serverless_inference_service",
[
pytest.param(
{"name": "kserve-serverless-onnx"},
{"model-dir": "test-dir"},
{
"runtime-name": ModelInferenceRuntime.ONNX_RUNTIME,
"model-format": {ModelFormat.ONNX: ModelVersion.OPSET13},
},
{"name": ModelFormat.ONNX, "model-version": ModelVersion.OPSET13},
{"name": ModelFormat.ONNX, "model-version": ModelVersion.OPSET13, "model-dir": "test-dir"},
)
],
indirect=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@

@pytest.mark.serverless
@pytest.mark.parametrize(
"model_namespace, ci_s3_storage_uri, openvino_kserve_serving_runtime, ovms_serverless_inference_service",
"model_namespace, openvino_kserve_serving_runtime, ovms_serverless_inference_service",
[
pytest.param(
{"name": "kserve-serverless-openvino"},
{"model-dir": ModelStoragePath.KSERVE_OPENVINO_EXAMPLE_MODEL},
{
"runtime-name": ModelInferenceRuntime.OPENVINO_KSERVE_RUNTIME,
"model-format": {ModelAndFormat.OPENVINO_IR: ModelVersion.OPSET1},
},
{"name": ModelFormat.OPENVINO, "model-version": ModelVersion.OPSET1},
{
"name": ModelFormat.OPENVINO,
"model-version": ModelVersion.OPSET1,
"model-dir": ModelStoragePath.KSERVE_OPENVINO_EXAMPLE_MODEL,
},
)
],
indirect=True,
Expand Down
27 changes: 1 addition & 26 deletions tests/model_serving/model_server/ovms/model_mesh/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import shlex
from typing import Generator

import pytest
from _pytest.fixtures import FixtureRequest
Expand All @@ -24,7 +23,7 @@
ModelInferenceRuntime,
RuntimeTemplates,
)
from utilities.infra import create_isvc_view_role, create_storage_config_secret, s3_endpoint_secret
from utilities.infra import create_isvc_view_role, s3_endpoint_secret
from utilities.serving_runtime import ServingRuntimeFromTemplate


Expand Down Expand Up @@ -72,29 +71,6 @@ def ci_model_mesh_endpoint_s3_secret(
yield secret


@pytest.fixture(scope="class")
def model_mesh_storage_config_secret(
admin_client: DynamicClient,
ci_model_mesh_endpoint_s3_secret: Secret,
aws_access_key_id: str,
aws_secret_access_key: str,
ci_s3_bucket_name: str,
ci_s3_bucket_region: str,
ci_s3_bucket_endpoint: str,
) -> Generator[Secret, None, None]:
with create_storage_config_secret(
admin_client=admin_client,
endpoint_secret_name=ci_model_mesh_endpoint_s3_secret.name,
namespace=ci_model_mesh_endpoint_s3_secret.namespace,
aws_access_key=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_s3_bucket=ci_s3_bucket_name,
aws_s3_region=ci_s3_bucket_region,
aws_s3_endpoint=ci_s3_bucket_endpoint,
) as storage_config:
yield storage_config


@pytest.fixture(scope="class")
def model_mesh_model_service_account(
admin_client: DynamicClient, ci_model_mesh_endpoint_s3_secret: Secret
Expand All @@ -115,7 +91,6 @@ def http_s3_openvino_model_mesh_inference_service(
ns_with_modelmesh_enabled: Namespace,
http_s3_openvino_model_mesh_serving_runtime: ServingRuntime,
ci_model_mesh_endpoint_s3_secret: Secret,
model_mesh_storage_config_secret: Secret,
model_mesh_model_service_account: ServiceAccount,
) -> InferenceService:
isvc_kwargs = {
Expand Down
26 changes: 1 addition & 25 deletions tests/model_serving/model_server/private_endpoint/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from tests.model_serving.model_server.private_endpoint.utils import create_sidecar_pod
from tests.model_serving.model_server.utils import create_isvc
from utilities.constants import KServeDeploymentType, ModelFormat, ModelStoragePath
from utilities.infra import create_ns, create_storage_config_secret
from utilities.infra import create_ns

LOGGER = get_logger(name=__name__)

Expand All @@ -28,7 +28,6 @@ def endpoint_isvc(
admin_client: DynamicClient,
serving_runtime_from_template: ServingRuntime,
models_endpoint_s3_secret: Secret,
storage_config_secret: Secret,
) -> Generator[InferenceService, None, None]:
with create_isvc(
client=admin_client,
Expand All @@ -44,29 +43,6 @@ def endpoint_isvc(
yield isvc


@pytest.fixture(scope="class")
def storage_config_secret(
admin_client: DynamicClient,
models_endpoint_s3_secret: Secret,
aws_access_key_id: str,
aws_secret_access_key: str,
models_s3_bucket_name: str,
models_s3_bucket_region: str,
models_s3_bucket_endpoint: str,
) -> Generator[Secret, None, None]:
with create_storage_config_secret(
admin_client=admin_client,
endpoint_secret_name=models_endpoint_s3_secret.name,
namespace=models_endpoint_s3_secret.namespace,
aws_access_key=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_s3_bucket=models_s3_bucket_name,
aws_s3_region=models_s3_bucket_region,
aws_s3_endpoint=models_s3_bucket_endpoint,
) as storage_config:
yield storage_config


@pytest.fixture()
def endpoint_pod_with_istio_sidecar(
admin_client: DynamicClient, model_namespace: Namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@
@pytest.mark.raw_deployment
@pytest.mark.jira("RHOAIENG-11749")
@pytest.mark.parametrize(
"model_namespace, s3_models_storage_uri, serving_runtime_from_template, s3_models_inference_service",
"model_namespace, serving_runtime_from_template, s3_models_inference_service",
[
pytest.param(
{"name": "raw-deployment-caikit-bge"},
{"model-dir": ModelStoragePath.EMBEDDING_MODEL},
{
"name": f"{Protocols.HTTP}-{ModelInferenceRuntime.CAIKIT_STANDALONE_RUNTIME}",
"template-name": RuntimeTemplates.CAIKIT_STANDALONE_SERVING,
"multi-model": False,
"enable-http": True,
},
{"name": "bge-large-en-caikit", "deployment-mode": KServeDeploymentType.RAW_DEPLOYMENT},
{
"name": "bge-large-en-caikit",
"deployment-mode": KServeDeploymentType.RAW_DEPLOYMENT,
"model-dir": ModelStoragePath.EMBEDDING_MODEL,
},
)
],
indirect=True,
Expand Down
Loading
Loading