88from ocp_resources .guardrails_orchestrator import GuardrailsOrchestrator
99from ocp_resources .inference_service import InferenceService
1010from ocp_resources .namespace import Namespace
11- from ocp_resources .persistent_volume_claim import PersistentVolumeClaim
1211from ocp_resources .pod import Pod
1312from ocp_resources .route import Route
1413from ocp_resources .secret import Secret
1817from utilities .constants import (
1918 KServeDeploymentType ,
2019 Labels ,
21- MinIo ,
22- Timeout ,
2320 Ports ,
2421 RuntimeTemplates ,
2522)
@@ -78,9 +75,11 @@ def guardrails_orchestrator_pod(
7875
7976
8077@pytest .fixture (scope = "class" )
81- def qwen_llm_model (
78+ def qwen_isvc (
8279 admin_client : DynamicClient ,
8380 model_namespace : Namespace ,
81+ minio_pod : Pod ,
82+ minio_service : Service ,
8483 minio_data_connection : Secret ,
8584 vllm_runtime : ServingRuntime ,
8685) -> Generator [InferenceService , Any , Any ]:
@@ -107,7 +106,7 @@ def qwen_llm_model(
107106def vllm_runtime (
108107 admin_client : DynamicClient ,
109108 model_namespace : Namespace ,
110- minio_llm_deployment : Deployment ,
109+ minio_pod : Pod ,
111110 minio_service : Service ,
112111 minio_data_connection : Secret ,
113112) -> Generator [ServingRuntime , Any , Any ]:
@@ -138,7 +137,7 @@ def vllm_runtime(
138137def orchestrator_configmap (
139138 admin_client : DynamicClient ,
140139 model_namespace : Namespace ,
141- qwen_llm_model : InferenceService ,
140+ qwen_isvc : InferenceService ,
142141) -> Generator [ConfigMap , Any , Any ]:
143142 with ConfigMap (
144143 client = admin_client ,
@@ -148,7 +147,7 @@ def orchestrator_configmap(
148147 "config.yaml" : yaml .dump ({
149148 "chat_generation" : {
150149 "service" : {
151- "hostname" : f"{ qwen_llm_model .name } -predictor.{ model_namespace .name } .svc.cluster.local" ,
150+ "hostname" : f"{ qwen_isvc .name } -predictor.{ model_namespace .name } .svc.cluster.local" ,
152151 "port" : GUARDRAILS_ORCHESTRATOR_PORT ,
153152 }
154153 },
@@ -205,82 +204,3 @@ def guardrails_gateway_config(
205204 },
206205 ) as cm :
207206 yield cm
208-
209-
210- @pytest .fixture (scope = "class" )
211- def minio_llm_deployment (
212- admin_client : DynamicClient ,
213- minio_namespace : Namespace ,
214- pvc_minio_namespace : PersistentVolumeClaim ,
215- ) -> Generator [Deployment , Any , Any ]:
216- with Deployment (
217- client = admin_client ,
218- name = "llm-container-deployment" ,
219- namespace = minio_namespace .name ,
220- replicas = 1 ,
221- selector = {"matchLabels" : {Labels .Openshift .APP : MinIo .Metadata .NAME }},
222- template = {
223- "metadata" : {
224- "labels" : {
225- Labels .Openshift .APP : MinIo .Metadata .NAME ,
226- "maistra.io/expose-route" : "true" ,
227- },
228- "name" : MinIo .Metadata .NAME ,
229- },
230- "spec" : {
231- "volumes" : [
232- {
233- "name" : "model-volume" ,
234- "persistentVolumeClaim" : {"claimName" : pvc_minio_namespace .name },
235- }
236- ],
237- "initContainers" : [
238- {
239- "name" : "download-model" ,
240- "image" : "quay.io/trustyai_testing/llm-downloader-bootstrap"
241- "@sha256:d3211cc581fe69ca9a1cb75f84e5d08cacd1854cb2d63591439910323b0cbb57" ,
242- "securityContext" : {"fsGroup" : 1001 },
243- "command" : [
244- "bash" ,
245- "-c" ,
246- 'model="Qwen/Qwen2.5-0.5B-Instruct"'
247- '\n echo "starting download"'
248- "\n /tmp/venv/bin/huggingface-cli download $model "
249- "--local-dir /mnt/models/llms/$(basename $model)"
250- '\n echo "Done!"' ,
251- ],
252- "resources" : {"limits" : {"memory" : "5Gi" , "cpu" : "2" }},
253- "volumeMounts" : [{"mountPath" : "/mnt/models/" , "name" : "model-volume" }],
254- }
255- ],
256- "containers" : [
257- {
258- "args" : ["server" , "/models" ],
259- "env" : [
260- {
261- "name" : MinIo .Credentials .ACCESS_KEY_NAME ,
262- "value" : MinIo .Credentials .ACCESS_KEY_VALUE ,
263- },
264- {
265- "name" : MinIo .Credentials .SECRET_KEY_NAME ,
266- "value" : MinIo .Credentials .SECRET_KEY_VALUE ,
267- },
268- ],
269- "image" : "quay.io/trustyai/modelmesh-minio-examples"
270- "@sha256:65cb22335574b89af15d7409f62feffcc52cc0e870e9419d63586f37706321a5" ,
271- "name" : MinIo .Metadata .NAME ,
272- "securityContext" : {
273- "allowPrivilegeEscalation" : False ,
274- "capabilities" : {"drop" : ["ALL" ]},
275- "seccompProfile" : {"type" : "RuntimeDefault" },
276- },
277- "volumeMounts" : [{"mountPath" : "/models/" , "name" : "model-volume" }],
278- }
279- ],
280- },
281- },
282- label = {Labels .Openshift .APP : MinIo .Metadata .NAME },
283- wait_for_resource = True ,
284- ) as deployment :
285- deployment .wait_for_replicas (timeout = Timeout .TIMEOUT_10MIN )
286- yield deployment
0 commit comments