Skip to content

Commit 8cbfd1c

Browse files
Merge branch 'main' into grpcRoutes
2 parents 599b83e + 99ed385 commit 8cbfd1c

21 files changed

+230
-34
lines changed

api/apps/v1alpha1/nimcache_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type NIMCacheSpec struct {
4848
GroupID *int64 `json:"groupID,omitempty"`
4949
// CertConfig is the name of the ConfigMap containing the custom certificates.
5050
// for secure communication.
51+
//
5152
// Deprecated: use `Proxy` instead to configure custom certificates for using proxy.
5253
// +optional
5354
CertConfig *CertConfig `json:"certConfig,omitempty"`

api/apps/v1alpha1/nimservice_types.go

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ type NIMServiceStorage struct {
227227
HostPath *string `json:"hostPath,omitempty"`
228228
// ReadOnly mode indicates if the volume should be mounted as read-only
229229
ReadOnly *bool `json:"readOnly,omitempty"`
230+
// EmptyDir is the empty dir volume used for caching NIM
231+
EmptyDir *EmptyDirSpec `json:"emptyDir,omitempty"`
232+
}
233+
234+
type EmptyDirSpec struct {
235+
// SizeLimit is the size limit of the empty dir volume
236+
SizeLimit *resource.Quantity `json:"sizeLimit,omitempty"`
230237
}
231238

232239
// GetLWSName returns the name to be used for the LeaderWorkerSet based on the custom spec.
@@ -688,7 +695,7 @@ func (n *NIMService) GetVolumesMounts() []corev1.Volume {
688695
}
689696

690697
// GetVolumes returns volumes for the NIMService container.
691-
func (n *NIMService) GetVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume {
698+
func (n *NIMService) GetVolumes(modelPVC *PersistentVolumeClaim) []corev1.Volume {
692699
// TODO: Fetch actual PVC name from associated NIMCache obj
693700
volumes := []corev1.Volume{
694701
{
@@ -700,15 +707,26 @@ func (n *NIMService) GetVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume
700707
},
701708
},
702709
},
703-
{
710+
}
711+
if modelPVC != nil {
712+
volumes = append(volumes, corev1.Volume{
704713
Name: "model-store",
705714
VolumeSource: corev1.VolumeSource{
706715
PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{
707716
ClaimName: modelPVC.Name,
708717
ReadOnly: n.GetStorageReadOnly(),
709718
},
710719
},
711-
},
720+
})
721+
} else if n.Spec.Storage.EmptyDir != nil {
722+
volumes = append(volumes, corev1.Volume{
723+
Name: "model-store",
724+
VolumeSource: corev1.VolumeSource{
725+
EmptyDir: &corev1.EmptyDirVolumeSource{
726+
SizeLimit: n.Spec.Storage.EmptyDir.SizeLimit,
727+
},
728+
},
729+
})
712730
}
713731

714732
if n.GetProxySpec() != nil {
@@ -717,7 +735,7 @@ func (n *NIMService) GetVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume
717735
return volumes
718736
}
719737

720-
func (n *NIMService) GetLeaderVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume {
738+
func (n *NIMService) GetLeaderVolumes(modelPVC *PersistentVolumeClaim) []corev1.Volume {
721739
volumes := n.GetVolumes(modelPVC)
722740

723741
volumes = append(volumes,
@@ -762,7 +780,7 @@ func (n *NIMService) GetLeaderVolumes(modelPVC PersistentVolumeClaim) []corev1.V
762780
return volumes
763781
}
764782

765-
func (n *NIMService) GetWorkerVolumes(modelPVC PersistentVolumeClaim) []corev1.Volume {
783+
func (n *NIMService) GetWorkerVolumes(modelPVC *PersistentVolumeClaim) []corev1.Volume {
766784
volumes := n.GetVolumes(modelPVC)
767785
volumes = append(volumes,
768786
corev1.Volume{
@@ -802,12 +820,16 @@ func (n *NIMService) GetWorkerVolumes(modelPVC PersistentVolumeClaim) []corev1.V
802820
}
803821

804822
// GetVolumeMounts returns volumes for the NIMService container.
805-
func (n *NIMService) GetVolumeMounts(modelPVC PersistentVolumeClaim) []corev1.VolumeMount {
823+
func (n *NIMService) GetVolumeMounts(modelPVC *PersistentVolumeClaim) []corev1.VolumeMount {
824+
subPath := ""
825+
if modelPVC != nil {
826+
subPath = modelPVC.SubPath
827+
}
806828
volumeMounts := []corev1.VolumeMount{
807829
{
808830
Name: "model-store",
809831
MountPath: "/model-store",
810-
SubPath: modelPVC.SubPath,
832+
SubPath: subPath,
811833
},
812834
{
813835
Name: "dshm",
@@ -821,7 +843,7 @@ func (n *NIMService) GetVolumeMounts(modelPVC PersistentVolumeClaim) []corev1.Vo
821843
return volumeMounts
822844
}
823845

824-
func (n *NIMService) GetWorkerVolumeMounts(modelPVC PersistentVolumeClaim) []corev1.VolumeMount {
846+
func (n *NIMService) GetWorkerVolumeMounts(modelPVC *PersistentVolumeClaim) []corev1.VolumeMount {
825847
volumeMounts := n.GetVolumeMounts(modelPVC)
826848

827849
volumeMounts = append(volumeMounts,
@@ -846,7 +868,7 @@ func (n *NIMService) GetWorkerVolumeMounts(modelPVC PersistentVolumeClaim) []cor
846868
return volumeMounts
847869
}
848870

849-
func (n *NIMService) GetLeaderVolumeMounts(modelPVC PersistentVolumeClaim) []corev1.VolumeMount {
871+
func (n *NIMService) GetLeaderVolumeMounts(modelPVC *PersistentVolumeClaim) []corev1.VolumeMount {
850872
volumeMounts := n.GetVolumeMounts(modelPVC)
851873
volumeMounts = append(volumeMounts,
852874
corev1.VolumeMount{

api/apps/v1alpha1/nimservice_types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func TestGetVolumes(t *testing.T) {
110110

111111
for _, tt := range tests {
112112
t.Run(tt.name, func(t *testing.T) {
113-
vols := tt.nimService.GetVolumes(tt.modelPVC)
113+
vols := tt.nimService.GetVolumes(&tt.modelPVC)
114114
if !reflect.DeepEqual(vols, tt.desired) {
115115
t.Errorf("GetVolumes() = %v, want %v", vols, tt.desired)
116116
}

api/apps/v1alpha1/zz_generated.deepcopy.go

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/apps.nvidia.com_nimcaches.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ spec:
5454
description: |-
5555
CertConfig is the name of the ConfigMap containing the custom certificates.
5656
for secure communication.
57+
5758
Deprecated: use `Proxy` instead to configure custom certificates for using proxy.
5859
properties:
5960
mountPath:

bundle/manifests/apps.nvidia.com_nimpipelines.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,6 +3488,19 @@ spec:
34883488
description: Storage is the target storage for caching NIM
34893489
model if NIMCache is not provided
34903490
properties:
3491+
emptyDir:
3492+
description: EmptyDir is the empty dir volume used for
3493+
caching NIM
3494+
properties:
3495+
sizeLimit:
3496+
anyOf:
3497+
- type: integer
3498+
- type: string
3499+
description: SizeLimit is the size limit of the
3500+
empty dir volume
3501+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
3502+
x-kubernetes-int-or-string: true
3503+
type: object
34913504
hostPath:
34923505
description: HostPath is the host path volume for caching
34933506
NIM

bundle/manifests/apps.nvidia.com_nimservices.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,6 +3377,19 @@ spec:
33773377
description: Storage is the target storage for caching NIM model if
33783378
NIMCache is not provided
33793379
properties:
3380+
emptyDir:
3381+
description: EmptyDir is the empty dir volume used for caching
3382+
NIM
3383+
properties:
3384+
sizeLimit:
3385+
anyOf:
3386+
- type: integer
3387+
- type: string
3388+
description: SizeLimit is the size limit of the empty dir
3389+
volume
3390+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
3391+
x-kubernetes-int-or-string: true
3392+
type: object
33803393
hostPath:
33813394
description: HostPath is the host path volume for caching NIM
33823395
type: string

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ spec:
5454
description: |-
5555
CertConfig is the name of the ConfigMap containing the custom certificates.
5656
for secure communication.
57+
5758
Deprecated: use `Proxy` instead to configure custom certificates for using proxy.
5859
properties:
5960
mountPath:

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,6 +3488,19 @@ spec:
34883488
description: Storage is the target storage for caching NIM
34893489
model if NIMCache is not provided
34903490
properties:
3491+
emptyDir:
3492+
description: EmptyDir is the empty dir volume used for
3493+
caching NIM
3494+
properties:
3495+
sizeLimit:
3496+
anyOf:
3497+
- type: integer
3498+
- type: string
3499+
description: SizeLimit is the size limit of the
3500+
empty dir volume
3501+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
3502+
x-kubernetes-int-or-string: true
3503+
type: object
34913504
hostPath:
34923505
description: HostPath is the host path volume for caching
34933506
NIM

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3377,6 +3377,19 @@ spec:
33773377
description: Storage is the target storage for caching NIM model if
33783378
NIMCache is not provided
33793379
properties:
3380+
emptyDir:
3381+
description: EmptyDir is the empty dir volume used for caching
3382+
NIM
3383+
properties:
3384+
sizeLimit:
3385+
anyOf:
3386+
- type: integer
3387+
- type: string
3388+
description: SizeLimit is the size limit of the empty dir
3389+
volume
3390+
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
3391+
x-kubernetes-int-or-string: true
3392+
type: object
33803393
hostPath:
33813394
description: HostPath is the host path volume for caching NIM
33823395
type: string

0 commit comments

Comments
 (0)