diff --git a/api/apps/v1alpha1/common_types.go b/api/apps/v1alpha1/common_types.go index 00dea3d3..1b5fc126 100644 --- a/api/apps/v1alpha1/common_types.go +++ b/api/apps/v1alpha1/common_types.go @@ -32,8 +32,9 @@ type Expose struct { type Service struct { Type corev1.ServiceType `json:"type,omitempty"` // override the default service name - Name string `json:"name,omitempty"` - OpenAIPort int32 `json:"openaiPort"` + Name string `json:"name,omitempty"` + // +kubebuilder:default=8000 + OpenAIPort int32 `json:"openaiPort"` } // Metrics defines attributes to setup metrics collection diff --git a/api/apps/v1alpha1/nimservice_types.go b/api/apps/v1alpha1/nimservice_types.go index 9e829465..103d1d45 100644 --- a/api/apps/v1alpha1/nimservice_types.go +++ b/api/apps/v1alpha1/nimservice_types.go @@ -285,13 +285,13 @@ func IsProbeEnabled(probe Probe) bool { // GetLivenessProbe returns liveness probe for the NIMService container func (n *NIMService) GetLivenessProbe() *corev1.Probe { if n.Spec.LivenessProbe.Probe == nil { - return GetDefaultLivenessProbe() + return n.GetDefaultLivenessProbe() } return n.Spec.LivenessProbe.Probe } // GetDefaultLivenessProbe returns the default liveness probe for the NIMService container -func GetDefaultLivenessProbe() *corev1.Probe { +func (n *NIMService) GetDefaultLivenessProbe() *corev1.Probe { probe := corev1.Probe{ InitialDelaySeconds: 15, TimeoutSeconds: 1, @@ -303,7 +303,7 @@ func GetDefaultLivenessProbe() *corev1.Probe { Path: "/v1/health/live", Port: intstr.IntOrString{ Type: intstr.Type(0), - IntVal: 8000, + IntVal: n.Spec.Expose.Service.OpenAIPort, }, }, }, @@ -315,13 +315,13 @@ func GetDefaultLivenessProbe() *corev1.Probe { // GetReadinessProbe returns readiness probe for the NIMService container func (n *NIMService) GetReadinessProbe() *corev1.Probe { if n.Spec.ReadinessProbe.Probe == nil { - return GetDefaultReadinessProbe() + return n.GetDefaultReadinessProbe() } return n.Spec.ReadinessProbe.Probe } // GetDefaultReadinessProbe returns the default readiness probe for the NIMService container -func GetDefaultReadinessProbe() *corev1.Probe { +func (n *NIMService) GetDefaultReadinessProbe() *corev1.Probe { probe := corev1.Probe{ InitialDelaySeconds: 15, TimeoutSeconds: 1, @@ -333,7 +333,7 @@ func GetDefaultReadinessProbe() *corev1.Probe { Path: "/v1/health/ready", Port: intstr.IntOrString{ Type: intstr.Type(0), - IntVal: 8000, + IntVal: n.Spec.Expose.Service.OpenAIPort, }, }, }, @@ -345,13 +345,13 @@ func GetDefaultReadinessProbe() *corev1.Probe { // GetStartupProbe returns startup probe for the NIMService container func (n *NIMService) GetStartupProbe() *corev1.Probe { if n.Spec.StartupProbe.Probe == nil { - return GetDefaultStartupProbe() + return n.GetDefaultStartupProbe() } return n.Spec.StartupProbe.Probe } // GetDefaultStartupProbe returns the default startup probe for the NIMService container -func GetDefaultStartupProbe() *corev1.Probe { +func (n *NIMService) GetDefaultStartupProbe() *corev1.Probe { probe := corev1.Probe{ InitialDelaySeconds: 40, TimeoutSeconds: 1, @@ -363,7 +363,7 @@ func GetDefaultStartupProbe() *corev1.Probe { Path: "/v1/health/ready", Port: intstr.IntOrString{ Type: intstr.Type(0), - IntVal: 8000, + IntVal: n.Spec.Expose.Service.OpenAIPort, }, }, }, diff --git a/bundle/manifests/apps.nvidia.com_nimpipelines.yaml b/bundle/manifests/apps.nvidia.com_nimpipelines.yaml index 6be56d44..1db5111d 100644 --- a/bundle/manifests/apps.nvidia.com_nimpipelines.yaml +++ b/bundle/manifests/apps.nvidia.com_nimpipelines.yaml @@ -488,6 +488,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/bundle/manifests/apps.nvidia.com_nimservices.yaml b/bundle/manifests/apps.nvidia.com_nimservices.yaml index 3d23321f..784786b7 100644 --- a/bundle/manifests/apps.nvidia.com_nimservices.yaml +++ b/bundle/manifests/apps.nvidia.com_nimservices.yaml @@ -469,6 +469,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/config/crd/bases/apps.nvidia.com_nimpipelines.yaml b/config/crd/bases/apps.nvidia.com_nimpipelines.yaml index 6be56d44..1db5111d 100644 --- a/config/crd/bases/apps.nvidia.com_nimpipelines.yaml +++ b/config/crd/bases/apps.nvidia.com_nimpipelines.yaml @@ -488,6 +488,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/config/crd/bases/apps.nvidia.com_nimservices.yaml b/config/crd/bases/apps.nvidia.com_nimservices.yaml index 3d23321f..784786b7 100644 --- a/config/crd/bases/apps.nvidia.com_nimservices.yaml +++ b/config/crd/bases/apps.nvidia.com_nimservices.yaml @@ -469,6 +469,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml index 6be56d44..1db5111d 100644 --- a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml +++ b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimpipelines.yaml @@ -488,6 +488,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml index 3d23321f..784786b7 100644 --- a/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml +++ b/deployments/helm/k8s-nim-operator/crds/apps.nvidia.com_nimservices.yaml @@ -469,6 +469,7 @@ spec: description: override the default service name type: string openaiPort: + default: 8000 format: int32 type: integer type: diff --git a/internal/controller/platform/standalone/nimservice_test.go b/internal/controller/platform/standalone/nimservice_test.go index ce149881..884788ad 100644 --- a/internal/controller/platform/standalone/nimservice_test.go +++ b/internal/controller/platform/standalone/nimservice_test.go @@ -179,7 +179,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/ready", - Port: intstr.IntOrString{IntVal: 8080}, + Port: intstr.IntOrString{IntVal: 8000}, }, }, }, @@ -190,7 +190,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/live", - Port: intstr.IntOrString{IntVal: 8080}, + Port: intstr.IntOrString{IntVal: 8000}, }, }, }, @@ -201,7 +201,7 @@ var _ = Describe("NIMServiceReconciler for a standalone platform", func() { ProbeHandler: corev1.ProbeHandler{ HTTPGet: &corev1.HTTPGetAction{ Path: "/start", - Port: intstr.IntOrString{IntVal: 8080}, + Port: intstr.IntOrString{IntVal: 8000}, }, }, },