@@ -97,6 +97,7 @@ type HandlersProps = {
97
97
DscComponents ?: DataScienceClusterKindStatus [ 'components' ] ;
98
98
disableProjectScoped ?: boolean ;
99
99
disableHardwareProfiles ?: boolean ;
100
+ disablePVCServing ?: boolean ;
100
101
} ;
101
102
import { STOP_MODAL_PREFERENCE_KEY } from '#~/pages/modelServing/useStopModalPreference' ;
102
103
@@ -110,6 +111,7 @@ const initIntercepts = ({
110
111
projectEnableModelMesh,
111
112
disableProjectScoped = true ,
112
113
disableHardwareProfiles = true ,
114
+ disablePVCServing = true ,
113
115
servingRuntimes = [
114
116
mockServingRuntimeK8sResourceLegacy ( { tolerations : [ ] , nodeSelector : { } } ) ,
115
117
mockServingRuntimeK8sResource ( {
@@ -169,6 +171,7 @@ const initIntercepts = ({
169
171
disableKServeRaw,
170
172
disableProjectScoped,
171
173
disableHardwareProfiles,
174
+ disablePVCServing,
172
175
} ) ,
173
176
) ;
174
177
cy . interceptK8sList ( PodModel , mockK8sResourceList ( [ mockPodK8sResource ( { } ) ] ) ) ;
@@ -2356,6 +2359,122 @@ describe('Serving Runtime List', () => {
2356
2359
} ) ;
2357
2360
} ) ;
2358
2361
} ) ;
2362
+
2363
+ it ( 'Deploy model with PVC' , ( ) => {
2364
+ initIntercepts ( {
2365
+ disableModelMeshConfig : false ,
2366
+ disableKServeConfig : false ,
2367
+ disableServingRuntimeParams : false ,
2368
+ disablePVCServing : false ,
2369
+ requiredCapabilities : [ StackCapability . SERVICE_MESH , StackCapability . SERVICE_MESH_AUTHZ ] ,
2370
+ projectEnableModelMesh : false ,
2371
+ } ) ;
2372
+ cy . intercept (
2373
+ 'GET' ,
2374
+ '**/namespaces/test-project/persistentvolumeclaims?labelSelector=opendatahub.io%2Fdashboard%3Dtrue' ,
2375
+ mockK8sResourceList ( [
2376
+ mockPVCK8sResource ( {
2377
+ name : 'test-pvc' ,
2378
+ namespace : 'test-project' ,
2379
+ displayName : 'Test PVC' ,
2380
+ storageClassName : 'openshift-default-sc' ,
2381
+ annotations : {
2382
+ 'dashboard.opendatahub.io/model-name' : 'test-model' ,
2383
+ 'dashboard.opendatahub.io/model-path' : 'test-path' ,
2384
+ } ,
2385
+ labels : {
2386
+ 'opendatahub.io/dashboard' : 'true' ,
2387
+ } ,
2388
+ } ) ,
2389
+ ] ) ,
2390
+ ) ;
2391
+
2392
+ projectDetails . visitSection ( 'test-project' , 'model-server' ) ;
2393
+ modelServingSection . findDeployModelButton ( ) . click ( ) ;
2394
+
2395
+ kserveModal . shouldBeOpen ( ) ;
2396
+
2397
+ kserveModal . findModelNameInput ( ) . type ( 'Test Name' ) ;
2398
+ kserveModal . findServingRuntimeTemplateSearchSelector ( ) . click ( ) ;
2399
+ kserveModal . findGlobalScopedTemplateOption ( 'Caikit' ) . click ( ) ;
2400
+ kserveModal . findModelFrameworkSelect ( ) . findSelectOption ( 'onnx - 1' ) . click ( ) ;
2401
+ // Auto-selects the only pvc
2402
+ kserveModal . findPVCConnectionOption ( ) . should ( 'be.visible' ) . click ( ) ;
2403
+ kserveModal . findLocationPathInput ( ) . should ( 'have.value' , 'test-path' ) ;
2404
+ kserveModal . findSubmitButton ( ) . should ( 'be.enabled' ) ;
2405
+ kserveModal . findSubmitButton ( ) . click ( ) ;
2406
+ kserveModal . shouldBeOpen ( false ) ;
2407
+
2408
+ // dry run request
2409
+ cy . wait ( '@createServingRuntime' ) . then ( ( interception ) => {
2410
+ expect ( interception . request . url ) . to . include ( '?dryRun=All' ) ;
2411
+ expect ( interception . request . body ) . to . containSubset ( {
2412
+ metadata : {
2413
+ name : 'test-name' ,
2414
+ annotations : {
2415
+ 'openshift.io/display-name' : 'test-name' ,
2416
+ 'opendatahub.io/apiProtocol' : 'REST' ,
2417
+ 'opendatahub.io/template-display-name' : 'Caikit' ,
2418
+ 'opendatahub.io/template-name' : 'template-2' ,
2419
+ } ,
2420
+ namespace : 'test-project' ,
2421
+ } ,
2422
+ spec : {
2423
+ protocolVersions : [ 'grpc-v1' ] ,
2424
+ supportedModelFormats : [
2425
+ { autoSelect : true , name : 'openvino_ir' , version : 'opset1' } ,
2426
+ { autoSelect : true , name : 'onnx' , version : '1' } ,
2427
+ ] ,
2428
+ } ,
2429
+ } ) ;
2430
+ } ) ;
2431
+ // Actual request
2432
+ cy . wait ( '@createServingRuntime' ) . then ( ( interception ) => {
2433
+ expect ( interception . request . url ) . not . to . include ( '?dryRun=All' ) ;
2434
+ } ) ;
2435
+
2436
+ // the serving runtime should have been created
2437
+ cy . get ( '@createServingRuntime.all' ) . then ( ( interceptions ) => {
2438
+ expect ( interceptions ) . to . have . length ( 2 ) ; // 1 dry-run request and 1 actual request
2439
+ } ) ;
2440
+ cy . wait ( '@createInferenceService' ) . then ( ( interception ) => {
2441
+ expect ( interception . request . url ) . to . include ( '?dryRun=All' ) ;
2442
+ expect ( interception . request . body ) . to . containSubset ( {
2443
+ apiVersion : 'serving.kserve.io/v1beta1' ,
2444
+ kind : 'InferenceService' ,
2445
+ metadata : {
2446
+ annotations : {
2447
+ 'openshift.io/display-name' : 'Test Name' ,
2448
+ 'serving.knative.openshift.io/enablePassthrough' : 'true' ,
2449
+ 'serving.kserve.io/deploymentMode' : DeploymentMode . Serverless ,
2450
+ 'sidecar.istio.io/inject' : 'true' ,
2451
+ 'sidecar.istio.io/rewriteAppHTTPProbers' : 'true' ,
2452
+ } ,
2453
+ labels : {
2454
+ 'opendatahub.io/dashboard' : 'true' ,
2455
+ 'networking.knative.dev/visibility' : 'cluster-local' ,
2456
+ } ,
2457
+ name : 'test-name' ,
2458
+ namespace : 'test-project' ,
2459
+ } ,
2460
+ spec : {
2461
+ predictor : {
2462
+ minReplicas : 1 ,
2463
+ maxReplicas : 1 ,
2464
+ model : {
2465
+ modelFormat : { name : 'onnx' , version : '1' } ,
2466
+ resources : {
2467
+ requests : { cpu : '1' , memory : '4Gi' } ,
2468
+ limits : { cpu : '2' , memory : '8Gi' } ,
2469
+ } ,
2470
+ runtime : 'test-name' ,
2471
+ storageUri : 'pvc://test-pvc/test-path' ,
2472
+ } ,
2473
+ } ,
2474
+ } ,
2475
+ } ) ;
2476
+ } ) ;
2477
+ } ) ;
2359
2478
} ) ;
2360
2479
2361
2480
describe ( 'ModelMesh model server' , ( ) => {
0 commit comments