@@ -64,20 +64,26 @@ type NIMServiceSpec struct {
6464 // The name of an existing pull secret containing the NGC_API_KEY
6565 AuthSecret string `json:"authSecret"`
6666 // Storage is the target storage for caching NIM model if NIMCache is not provided
67- Storage NIMServiceStorage `json:"storage,omitempty"`
68- Labels map [string ]string `json:"labels,omitempty"`
69- Annotations map [string ]string `json:"annotations,omitempty"`
70- NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
71- Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
72- PodAffinity * corev1.PodAffinity `json:"podAffinity,omitempty"`
73- Resources * corev1.ResourceRequirements `json:"resources,omitempty"`
74- Expose Expose `json:"expose,omitempty"`
75- LivenessProbe Probe `json:"livenessProbe,omitempty"`
76- ReadinessProbe Probe `json:"readinessProbe,omitempty"`
77- StartupProbe Probe `json:"startupProbe,omitempty"`
78- Scale Autoscaling `json:"scale,omitempty"`
79- SchedulerName string `json:"schedulerName,omitempty"`
80- Metrics Metrics `json:"metrics,omitempty"`
67+ Storage NIMServiceStorage `json:"storage,omitempty"`
68+ Labels map [string ]string `json:"labels,omitempty"`
69+ Annotations map [string ]string `json:"annotations,omitempty"`
70+ NodeSelector map [string ]string `json:"nodeSelector,omitempty"`
71+ Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
72+ PodAffinity * corev1.PodAffinity `json:"podAffinity,omitempty"`
73+ // Resources is the resource requirements for the NIMService deployment.
74+ //
75+ // Note: Only traditional resources like cpu/memory and custom device plugin resources are supported here.
76+ // Any DRA claim references are ignored. Use DRAResources instead for those.
77+ Resources * corev1.ResourceRequirements `json:"resources,omitempty"`
78+ // DRAResources is the list of DRA resource claims to be used for the NIMService deployment.
79+ DRAResources []DRAResource `json:"draResources,omitempty"`
80+ Expose Expose `json:"expose,omitempty"`
81+ LivenessProbe Probe `json:"livenessProbe,omitempty"`
82+ ReadinessProbe Probe `json:"readinessProbe,omitempty"`
83+ StartupProbe Probe `json:"startupProbe,omitempty"`
84+ Scale Autoscaling `json:"scale,omitempty"`
85+ SchedulerName string `json:"schedulerName,omitempty"`
86+ Metrics Metrics `json:"metrics,omitempty"`
8187 // +kubebuilder:validation:Minimum=1
8288 // +kubebuilder:default:=1
8389 Replicas int `json:"replicas,omitempty"`
@@ -99,6 +105,10 @@ type NIMServiceStatus struct {
99105 AvailableReplicas int32 `json:"availableReplicas,omitempty"`
100106 State string `json:"state,omitempty"`
101107 Model * ModelStatus `json:"model,omitempty"`
108+ // DRAResourceStatuses is the status of the DRA resources.
109+ // +listType=map
110+ // +listMapKey=name
111+ DRAResourceStatuses []DRAResourceStatus `json:"draResourceStatuses,omitempty"`
102112}
103113
104114// ModelStatus defines the configuration of the NIMService model.
@@ -108,6 +118,26 @@ type ModelStatus struct {
108118 ExternalEndpoint string `json:"externalEndpoint"`
109119}
110120
121+ // DRAResourceStatus defines the status of the DRAResource.
122+ type DRAResourceStatus struct {
123+ // Name is the generated name of the DRAResource referenced in the NIMService
124+ // pod template as `spec.resourceClaims[].name`.
125+ Name string `json:"name"`
126+ // ResourceClaimTemplateName is the name of the ResourceClaimTemplate that was
127+ // used to generate the ResourceClaim for an instance of NIMService.
128+ ResourceClaimTemplateName * string `json:"resourceClaimTemplateName,omitempty"`
129+ // ResourceClaims is the status of generated resource claims.
130+ //
131+ // This list is empty if ResourceClaimTemplateName is not set.
132+ ResourceClaims []DRAResourceClaimStatus `json:"resourceClaims,omitempty"`
133+ }
134+
135+ // DRAResourceClaimStatus defines the status of the DRAResourceClaim.
136+ type DRAResourceClaimStatus struct {
137+ // Name is the name of the ResourceClaim that was generated for a NIMService pod.
138+ Name string `json:"name"`
139+ }
140+
111141// +genclient
112142// +kubebuilder:object:root=true
113143// +kubebuilder:subresource:status
@@ -364,7 +394,14 @@ func (n *NIMService) GetImagePullPolicy() string {
364394
365395// GetResources returns resources to allocate to the NIMService container.
366396func (n * NIMService ) GetResources () * corev1.ResourceRequirements {
367- return n .Spec .Resources
397+ if n .Spec .Resources == nil {
398+ return nil
399+ }
400+
401+ return & corev1.ResourceRequirements {
402+ Requests : n .Spec .Resources .Requests ,
403+ Limits : n .Spec .Resources .Limits ,
404+ }
368405}
369406
370407// IsProbeEnabled returns true if a given liveness/readiness/startup probe is enabled.
0 commit comments