Skip to content

Commit f678cd6

Browse files
Adding support for subpath for model caching (#38)
* Adding support for subpath for model caching Signed-off-by: Vishesh Tanksale <[email protected]>
1 parent 6a22a05 commit f678cd6

16 files changed

+88
-26
lines changed

api/apps/v1alpha1/nimcache_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ type PersistentVolumeClaim struct {
128128
Size string `json:"size,omitempty"`
129129
// VolumeAccessMode is the volume access mode of the PVC
130130
VolumeAccessMode corev1.PersistentVolumeAccessMode `json:"volumeAccessMode,omitempty"`
131+
SubPath string `json:"subPath,omitempty"`
131132
}
132133

133134
// NIMCacheStatus defines the observed state of NIMCache

api/apps/v1alpha1/nimservice_types.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ func (n *NIMService) GetVolumesMounts() []corev1.Volume {
376376
}
377377

378378
// GetVolumes returns volumes for the NIMService container
379-
func (n *NIMService) GetVolumes(modelPVC string) []corev1.Volume {
379+
func (n *NIMService) GetVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume {
380380
// TODO: Fetch actual PVC name from associated NIMCache obj
381381
volumes := []corev1.Volume{
382382
{
@@ -391,7 +391,7 @@ func (n *NIMService) GetVolumes(modelPVC string) []corev1.Volume {
391391
Name: "model-store",
392392
VolumeSource: corev1.VolumeSource{
393393
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
394-
ClaimName: modelPVC,
394+
ClaimName: *modelPVC.Name,
395395
},
396396
},
397397
},
@@ -401,11 +401,12 @@ func (n *NIMService) GetVolumes(modelPVC string) []corev1.Volume {
401401
}
402402

403403
// GetVolumeMounts returns volumes for the NIMService container
404-
func (n *NIMService) GetVolumeMounts() []corev1.VolumeMount {
404+
func (n *NIMService) GetVolumeMounts(modelPVC PersistentVolumeClaim) []corev1.VolumeMount {
405405
volumeMounts := []corev1.VolumeMount{
406406
{
407407
Name: "model-store",
408408
MountPath: "/model-store",
409+
SubPath: modelPVC.SubPath,
409410
},
410411
{
411412
Name: "dshm",
@@ -432,8 +433,8 @@ func (n *NIMService) GetNIMCacheProfile() string {
432433
}
433434

434435
// GetExternalPVC returns the external PVC name to use for the NIMService deployment
435-
func (n *NIMService) GetExternalPVC() *string {
436-
return n.Spec.Storage.PVC.Name
436+
func (n *NIMService) GetExternalPVC() *PersistentVolumeClaim {
437+
return &n.Spec.Storage.PVC
437438
}
438439

439440
// GetHPASpec returns the HPA spec for the NIMService deployment

bundle/manifests/apps.nvidia.com_nimcaches.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ spec:
216216
description: StorageClass to be used for PVC creation. Leave
217217
it as empty if the PVC is already created.
218218
type: string
219+
subPath:
220+
type: string
219221
volumeAccessMode:
220222
description: VolumeAccessMode is the volume access mode of
221223
the PVC

bundle/manifests/apps.nvidia.com_nimpipelines.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,8 @@ spec:
21382138
description: StorageClass to be used for PVC creation.
21392139
Leave it as empty if the PVC is already created.
21402140
type: string
2141+
subPath:
2142+
type: string
21412143
volumeAccessMode:
21422144
description: VolumeAccessMode is the volume access
21432145
mode of the PVC

bundle/manifests/apps.nvidia.com_nimservices.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,6 +2084,8 @@ spec:
20842084
description: StorageClass to be used for PVC creation. Leave
20852085
it as empty if the PVC is already created.
20862086
type: string
2087+
subPath:
2088+
type: string
20872089
volumeAccessMode:
20882090
description: VolumeAccessMode is the volume access mode of
20892091
the PVC

config/crd/bases/apps.nvidia.com_nimcaches.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ spec:
216216
description: StorageClass to be used for PVC creation. Leave
217217
it as empty if the PVC is already created.
218218
type: string
219+
subPath:
220+
type: string
219221
volumeAccessMode:
220222
description: VolumeAccessMode is the volume access mode of
221223
the PVC

config/crd/bases/apps.nvidia.com_nimpipelines.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,8 @@ spec:
21382138
description: StorageClass to be used for PVC creation.
21392139
Leave it as empty if the PVC is already created.
21402140
type: string
2141+
subPath:
2142+
type: string
21412143
volumeAccessMode:
21422144
description: VolumeAccessMode is the volume access
21432145
mode of the PVC

config/crd/bases/apps.nvidia.com_nimservices.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,6 +2084,8 @@ spec:
20842084
description: StorageClass to be used for PVC creation. Leave
20852085
it as empty if the PVC is already created.
20862086
type: string
2087+
subPath:
2088+
type: string
20872089
volumeAccessMode:
20882090
description: VolumeAccessMode is the volume access mode of
20892091
the PVC

deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimcaches.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ spec:
216216
description: StorageClass to be used for PVC creation. Leave
217217
it as empty if the PVC is already created.
218218
type: string
219+
subPath:
220+
type: string
219221
volumeAccessMode:
220222
description: VolumeAccessMode is the volume access mode of
221223
the PVC

deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,6 +2138,8 @@ spec:
21382138
description: StorageClass to be used for PVC creation.
21392139
Leave it as empty if the PVC is already created.
21402140
type: string
2141+
subPath:
2142+
type: string
21412143
volumeAccessMode:
21422144
description: VolumeAccessMode is the volume access
21432145
mode of the PVC

0 commit comments

Comments
 (0)