Skip to content

Commit 0247c29

Browse files
committed
Fix tests and add default port value in the CRD
Signed-off-by: Shiva Krishna, Merla <[email protected]>
1 parent 2b368d2 commit 0247c29

23 files changed

+25
-3
lines changed

api/apps/v1alpha1/common_types.go

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type Service struct {
4646
// Port is the main api serving port (default: 8000)
4747
// +kubebuilder:validation:Minimum=1
4848
// +kubebuilder:validation:Maximum=65535
49+
// +kubebuilder:default:=8000
4950
Port *int32 `json:"port,omitempty"`
5051
Annotations map[string]string `json:"annotations,omitempty"`
5152
}

bundle/manifests/apps.nvidia.com_nemocustomizers.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ spec:
535535
description: override the default service name
536536
type: string
537537
port:
538+
default: 8000
538539
description: 'Port is the main api serving port (default:
539540
8000)'
540541
format: int32

bundle/manifests/apps.nvidia.com_nemodatastores.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ spec:
530530
description: override the default service name
531531
type: string
532532
port:
533+
default: 8000
533534
description: 'Port is the main api serving port (default:
534535
8000)'
535536
format: int32

bundle/manifests/apps.nvidia.com_nemoentitystores.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ spec:
532532
description: override the default service name
533533
type: string
534534
port:
535+
default: 8000
535536
description: 'Port is the main api serving port (default:
536537
8000)'
537538
format: int32

bundle/manifests/apps.nvidia.com_nemoevaluators.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ spec:
572572
description: override the default service name
573573
type: string
574574
port:
575+
default: 8000
575576
description: 'Port is the main api serving port (default:
576577
8000)'
577578
format: int32

bundle/manifests/apps.nvidia.com_nemoguardrails.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ spec:
517517
description: override the default service name
518518
type: string
519519
port:
520+
default: 8000
520521
description: 'Port is the main api serving port (default:
521522
8000)'
522523
format: int32

bundle/manifests/apps.nvidia.com_nimpipelines.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ spec:
526526
description: override the default service name
527527
type: string
528528
port:
529+
default: 8000
529530
description: 'Port is the main api serving port
530531
(default: 8000)'
531532
format: int32

bundle/manifests/apps.nvidia.com_nimservices.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ spec:
476476
description: override the default service name
477477
type: string
478478
port:
479+
default: 8000
479480
description: 'Port is the main api serving port (default:
480481
8000)'
481482
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ spec:
535535
description: override the default service name
536536
type: string
537537
port:
538+
default: 8000
538539
description: 'Port is the main api serving port (default:
539540
8000)'
540541
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ spec:
530530
description: override the default service name
531531
type: string
532532
port:
533+
default: 8000
533534
description: 'Port is the main api serving port (default:
534535
8000)'
535536
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ spec:
532532
description: override the default service name
533533
type: string
534534
port:
535+
default: 8000
535536
description: 'Port is the main api serving port (default:
536537
8000)'
537538
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ spec:
572572
description: override the default service name
573573
type: string
574574
port:
575+
default: 8000
575576
description: 'Port is the main api serving port (default:
576577
8000)'
577578
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ spec:
517517
description: override the default service name
518518
type: string
519519
port:
520+
default: 8000
520521
description: 'Port is the main api serving port (default:
521522
8000)'
522523
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ spec:
526526
description: override the default service name
527527
type: string
528528
port:
529+
default: 8000
529530
description: 'Port is the main api serving port
530531
(default: 8000)'
531532
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ spec:
476476
description: override the default service name
477477
type: string
478478
port:
479+
default: 8000
479480
description: 'Port is the main api serving port (default:
480481
8000)'
481482
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ spec:
535535
description: override the default service name
536536
type: string
537537
port:
538+
default: 8000
538539
description: 'Port is the main api serving port (default:
539540
8000)'
540541
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,7 @@ spec:
530530
description: override the default service name
531531
type: string
532532
port:
533+
default: 8000
533534
description: 'Port is the main api serving port (default:
534535
8000)'
535536
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ spec:
532532
description: override the default service name
533533
type: string
534534
port:
535+
default: 8000
535536
description: 'Port is the main api serving port (default:
536537
8000)'
537538
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ spec:
572572
description: override the default service name
573573
type: string
574574
port:
575+
default: 8000
575576
description: 'Port is the main api serving port (default:
576577
8000)'
577578
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ spec:
517517
description: override the default service name
518518
type: string
519519
port:
520+
default: 8000
520521
description: 'Port is the main api serving port (default:
521522
8000)'
522523
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,7 @@ spec:
526526
description: override the default service name
527527
type: string
528528
port:
529+
default: 8000
529530
description: 'Port is the main api serving port
530531
(default: 8000)'
531532
format: int32

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

+1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,7 @@ spec:
476476
description: override the default service name
477477
type: string
478478
port:
479+
default: 8000
479480
description: 'Port is the main api serving port (default:
480481
8000)'
481482
format: int32

internal/controller/nemo_entitystore_controller_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ var _ = Describe("NemoEntitystore Controller", func() {
171171
Expose: appsv1alpha1.Expose{
172172
Service: appsv1alpha1.Service{
173173
Type: corev1.ServiceTypeClusterIP,
174-
Port: 8000,
174+
Port: ptr.To[int32](8000),
175175
Annotations: map[string]string{
176176
"annotation-key-specific": "service",
177177
},
@@ -329,7 +329,7 @@ var _ = Describe("NemoEntitystore Controller", func() {
329329
Expect(ingress.Namespace).To(Equal(nemoEntitystore.GetNamespace()))
330330
Expect(ingress.Annotations["annotation-key"]).To(Equal("annotation-value"))
331331
Expect(ingress.Annotations["annotation-key-specific"]).To(Equal("ingress"))
332-
Expect(service.Spec.Ports[0].Name).To(Equal("service-port"))
332+
Expect(service.Spec.Ports[0].Name).To(Equal("api"))
333333
Expect(service.Spec.Ports[0].Port).To(Equal(int32(8000)))
334334
// HPA should be deployed
335335
hpa := &autoscalingv2.HorizontalPodAutoscaler{}
@@ -349,7 +349,7 @@ var _ = Describe("NemoEntitystore Controller", func() {
349349
Expect(sm.Namespace).To(Equal(nemoEntitystore.GetNamespace()))
350350
Expect(sm.Annotations["annotation-key"]).To(Equal("annotation-value"))
351351
Expect(sm.Annotations["annotation-key-specific"]).To(Equal("service-monitor"))
352-
Expect(sm.Spec.Endpoints[0].Port).To(Equal("service-port"))
352+
Expect(sm.Spec.Endpoints[0].Port).To(Equal("api"))
353353
Expect(sm.Spec.Endpoints[0].ScrapeTimeout).To(Equal(monitoringv1.Duration("30s")))
354354
Expect(sm.Spec.Endpoints[0].Interval).To(Equal(monitoringv1.Duration("1m")))
355355
// Deployment should be created

0 commit comments

Comments
 (0)