Skip to content

Commit eeb3497

Browse files
committed
change: work on pr reviews
1 parent 0e2b69a commit eeb3497

File tree

3 files changed

+24
-31
lines changed

3 files changed

+24
-31
lines changed

tests/model_registry/async_job/conftest.py

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,17 @@ def s3_secret_for_async_job(
6161
f"http://{minio_service.name}.{minio_service.namespace}.svc.cluster.local:{MinIo.Metadata.DEFAULT_PORT}"
6262
)
6363

64-
# Create S3 secret data using existing utility
65-
secret_data = get_async_job_s3_secret_dict(
66-
access_key=MinIo.Credentials.ACCESS_KEY_VALUE,
67-
secret_access_key=MinIo.Credentials.SECRET_KEY_VALUE,
68-
s3_bucket=MinIo.Buckets.MODELMESH_EXAMPLE_MODELS,
69-
s3_endpoint=minio_endpoint,
70-
s3_region="us-east-1", # Default region for MinIO
71-
)
72-
73-
secret_name = f"async-job-s3-secret-{shortuuid.uuid().lower()}"
74-
7564
with Secret(
7665
client=admin_client,
77-
name=secret_name,
66+
name=f"async-job-s3-secret-{shortuuid.uuid().lower()}",
7867
namespace=service_account.namespace,
79-
data_dict=secret_data,
68+
data_dict=get_async_job_s3_secret_dict(
69+
access_key=MinIo.Credentials.ACCESS_KEY_VALUE,
70+
secret_access_key=MinIo.Credentials.SECRET_KEY_VALUE,
71+
s3_bucket=MinIo.Buckets.MODELMESH_EXAMPLE_MODELS,
72+
s3_endpoint=minio_endpoint,
73+
s3_region="us-east-1", # Default region for MinIO
74+
),
8075
type="Opaque",
8176
) as secret:
8277
yield secret
@@ -86,36 +81,30 @@ def s3_secret_for_async_job(
8681
def oci_secret_for_async_job(
8782
admin_client: DynamicClient,
8883
service_account: ServiceAccount,
89-
oci_registry_route: Route,
84+
oci_registry_host: str,
9085
) -> Generator[Secret, Any, Any]:
9186
"""Create OCI registry credentials secret for async upload job"""
92-
# Get OCI registry endpoint from route
93-
registry_host = oci_registry_route.instance.spec.host
9487

9588
# Create anonymous dockerconfig for OCI registry (no authentication)
9689
# This matches the zot registry setup which allows anonymous access
9790
dockerconfig = {
9891
"auths": {
99-
f"{registry_host}:{OCIRegistry.Metadata.DEFAULT_PORT}": {
92+
f"{oci_registry_host}:{OCIRegistry.Metadata.DEFAULT_PORT}": {
10093
"auth": "",
10194
"email": "user@example.com", # Anonymous access
10295
}
10396
}
10497
}
10598

106-
secret_data = {
107-
".dockerconfigjson": b64_encoded_string(json.dumps(dockerconfig)),
108-
"ACCESS_TYPE": b64_encoded_string(json.dumps('["Push,Pull"]')),
109-
"OCI_HOST": b64_encoded_string(json.dumps(f"{registry_host}:{OCIRegistry.Metadata.DEFAULT_PORT}")),
110-
}
111-
112-
secret_name = f"async-job-oci-secret-{shortuuid.uuid().lower()}"
113-
11499
with Secret(
115100
client=admin_client,
116-
name=secret_name,
101+
name=f"async-job-oci-secret-{shortuuid.uuid().lower()}",
117102
namespace=service_account.namespace,
118-
data_dict=secret_data,
103+
data_dict={
104+
".dockerconfigjson": b64_encoded_string(json.dumps(dockerconfig)),
105+
"ACCESS_TYPE": b64_encoded_string(json.dumps('["Push,Pull"]')),
106+
"OCI_HOST": b64_encoded_string(json.dumps(f"{oci_registry_host}:{OCIRegistry.Metadata.DEFAULT_PORT}")),
107+
},
119108
type="kubernetes.io/dockerconfigjson",
120109
) as secret:
121110
yield secret
@@ -130,13 +119,12 @@ def model_sync_async_job(
130119
model_registry_instance: list[ModelRegistry],
131120
s3_secret_for_async_job: Secret,
132121
oci_secret_for_async_job: Secret,
133-
oci_registry_route: Route,
122+
oci_registry_host: str,
134123
mr_access_role_binding: RoleBinding,
135124
teardown_resources: bool,
136125
) -> Generator[Job, Any, Any]:
137126
"""Core Job fixture focused on Job deployment and configuration"""
138127
# Get dynamic OCI URI from route
139-
oci_registry_host = oci_registry_route.instance.spec.host
140128
dynamic_oci_uri = f"{oci_registry_host}/{REPO_NAME}"
141129

142130
# Get model registry service and endpoint
@@ -360,6 +348,12 @@ def oci_registry_route(admin_client: DynamicClient, oci_registry_service: Servic
360348
yield oci_route
361349

362350

351+
@pytest.fixture(scope="class")
352+
def oci_registry_host(oci_registry_route: Route) -> str:
353+
"""Get the OCI registry host from the route"""
354+
return oci_registry_route.instance.spec.host
355+
356+
363357
@pytest.fixture(scope="function")
364358
def create_test_data_in_minio(
365359
minio_service: Service,

tests/model_registry/async_job/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Midstream temporary image (until downstream is available)
55
# TODO: Update before async job goes live
6-
ASYNC_UPLOAD_IMAGE = "quay.io/opendatahub/model-registry-job-async-upload:main-500be9d"
6+
ASYNC_UPLOAD_IMAGE = "quay.io/opendatahub/model-registry-job-async-upload:v0.2.22"
77

88
# Job labels and annotations
99
ASYNC_JOB_LABELS = {

tests/model_registry/async_job/utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ def upload_test_model_to_minio(
181181
minio_service: MinIO service resource
182182
object_key: S3 object key path (default: "my-model/mnist-8.onnx")
183183
"""
184-
from ocp_resources.pod import Pod
185184
from utilities.constants import MinIo
186185
import base64
187186
import os

0 commit comments

Comments
 (0)