Skip to content

Commit e857583

Browse files
authored
Add default service port for NIM as 8000 (#62)
Signed-off-by: Shiva Krishna, Merla <[email protected]>
1 parent 6034676 commit e857583

File tree

9 files changed

+21
-14
lines changed

9 files changed

+21
-14
lines changed

api/apps/v1alpha1/common_types.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ type Expose struct {
3232
type Service struct {
3333
Type corev1.ServiceType `json:"type,omitempty"`
3434
// override the default service name
35-
Name string `json:"name,omitempty"`
36-
OpenAIPort int32 `json:"openaiPort"`
35+
Name string `json:"name,omitempty"`
36+
// +kubebuilder:default=8000
37+
OpenAIPort int32 `json:"openaiPort"`
3738
}
3839

3940
// Metrics defines attributes to setup metrics collection

api/apps/v1alpha1/nimservice_types.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ func IsProbeEnabled(probe Probe) bool {
285285
// GetLivenessProbe returns liveness probe for the NIMService container
286286
func (n *NIMService) GetLivenessProbe() *corev1.Probe {
287287
if n.Spec.LivenessProbe.Probe == nil {
288-
return GetDefaultLivenessProbe()
288+
return n.GetDefaultLivenessProbe()
289289
}
290290
return n.Spec.LivenessProbe.Probe
291291
}
292292

293293
// GetDefaultLivenessProbe returns the default liveness probe for the NIMService container
294-
func GetDefaultLivenessProbe() *corev1.Probe {
294+
func (n *NIMService) GetDefaultLivenessProbe() *corev1.Probe {
295295
probe := corev1.Probe{
296296
InitialDelaySeconds: 15,
297297
TimeoutSeconds: 1,
@@ -303,7 +303,7 @@ func GetDefaultLivenessProbe() *corev1.Probe {
303303
Path: "/v1/health/live",
304304
Port: intstr.IntOrString{
305305
Type: intstr.Type(0),
306-
IntVal: 8000,
306+
IntVal: n.Spec.Expose.Service.OpenAIPort,
307307
},
308308
},
309309
},
@@ -315,13 +315,13 @@ func GetDefaultLivenessProbe() *corev1.Probe {
315315
// GetReadinessProbe returns readiness probe for the NIMService container
316316
func (n *NIMService) GetReadinessProbe() *corev1.Probe {
317317
if n.Spec.ReadinessProbe.Probe == nil {
318-
return GetDefaultReadinessProbe()
318+
return n.GetDefaultReadinessProbe()
319319
}
320320
return n.Spec.ReadinessProbe.Probe
321321
}
322322

323323
// GetDefaultReadinessProbe returns the default readiness probe for the NIMService container
324-
func GetDefaultReadinessProbe() *corev1.Probe {
324+
func (n *NIMService) GetDefaultReadinessProbe() *corev1.Probe {
325325
probe := corev1.Probe{
326326
InitialDelaySeconds: 15,
327327
TimeoutSeconds: 1,
@@ -333,7 +333,7 @@ func GetDefaultReadinessProbe() *corev1.Probe {
333333
Path: "/v1/health/ready",
334334
Port: intstr.IntOrString{
335335
Type: intstr.Type(0),
336-
IntVal: 8000,
336+
IntVal: n.Spec.Expose.Service.OpenAIPort,
337337
},
338338
},
339339
},
@@ -345,13 +345,13 @@ func GetDefaultReadinessProbe() *corev1.Probe {
345345
// GetStartupProbe returns startup probe for the NIMService container
346346
func (n *NIMService) GetStartupProbe() *corev1.Probe {
347347
if n.Spec.StartupProbe.Probe == nil {
348-
return GetDefaultStartupProbe()
348+
return n.GetDefaultStartupProbe()
349349
}
350350
return n.Spec.StartupProbe.Probe
351351
}
352352

353353
// GetDefaultStartupProbe returns the default startup probe for the NIMService container
354-
func GetDefaultStartupProbe() *corev1.Probe {
354+
func (n *NIMService) GetDefaultStartupProbe() *corev1.Probe {
355355
probe := corev1.Probe{
356356
InitialDelaySeconds: 40,
357357
TimeoutSeconds: 1,
@@ -363,7 +363,7 @@ func GetDefaultStartupProbe() *corev1.Probe {
363363
Path: "/v1/health/ready",
364364
Port: intstr.IntOrString{
365365
Type: intstr.Type(0),
366-
IntVal: 8000,
366+
IntVal: n.Spec.Expose.Service.OpenAIPort,
367367
},
368368
},
369369
},

bundle/manifests/apps.nvidia.com_nimpipelines.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ spec:
488488
description: override the default service name
489489
type: string
490490
openaiPort:
491+
default: 8000
491492
format: int32
492493
type: integer
493494
type:

bundle/manifests/apps.nvidia.com_nimservices.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ spec:
469469
description: override the default service name
470470
type: string
471471
openaiPort:
472+
default: 8000
472473
format: int32
473474
type: integer
474475
type:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ spec:
488488
description: override the default service name
489489
type: string
490490
openaiPort:
491+
default: 8000
491492
format: int32
492493
type: integer
493494
type:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ spec:
469469
description: override the default service name
470470
type: string
471471
openaiPort:
472+
default: 8000
472473
format: int32
473474
type: integer
474475
type:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ spec:
488488
description: override the default service name
489489
type: string
490490
openaiPort:
491+
default: 8000
491492
format: int32
492493
type: integer
493494
type:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ spec:
469469
description: override the default service name
470470
type: string
471471
openaiPort:
472+
default: 8000
472473
format: int32
473474
type: integer
474475
type:

internal/controller/platform/standalone/nimservice_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() {
179179
ProbeHandler: corev1.ProbeHandler{
180180
HTTPGet: &corev1.HTTPGetAction{
181181
Path: "/ready",
182-
Port: intstr.IntOrString{IntVal: 8080},
182+
Port: intstr.IntOrString{IntVal: 8000},
183183
},
184184
},
185185
},
@@ -190,7 +190,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() {
190190
ProbeHandler: corev1.ProbeHandler{
191191
HTTPGet: &corev1.HTTPGetAction{
192192
Path: "/live",
193-
Port: intstr.IntOrString{IntVal: 8080},
193+
Port: intstr.IntOrString{IntVal: 8000},
194194
},
195195
},
196196
},
@@ -201,7 +201,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() {
201201
ProbeHandler: corev1.ProbeHandler{
202202
HTTPGet: &corev1.HTTPGetAction{
203203
Path: "/start",
204-
Port: intstr.IntOrString{IntVal: 8080},
204+
Port: intstr.IntOrString{IntVal: 8000},
205205
},
206206
},
207207
},

0 commit comments

Comments
 (0)