Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate PublishNotReadyAddresses flag to GN internal service #3219

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pkg/globalnet/controllers/global_ingressip_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,11 @@ func (c *globalIngressIPController) createOrUpdateInternalService(from *corev1.S
Finalizers: []string{InternalServiceFinalizer},
},
Spec: corev1.ServiceSpec{
Ports: from.Spec.Ports,
Selector: from.Spec.Selector,
ExternalIPs: []string{extIP},
IPFamilyPolicy: ptr.To(corev1.IPFamilyPolicySingleStack),
Ports: from.Spec.Ports,
Selector: from.Spec.Selector,
ExternalIPs: []string{extIP},
IPFamilyPolicy: ptr.To(corev1.IPFamilyPolicySingleStack),
PublishNotReadyAddresses: from.Spec.PublishNotReadyAddresses,
},
}

Expand Down
17 changes: 16 additions & 1 deletion pkg/globalnet/controllers/global_ingressip_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ var _ = Describe("GlobalIngressIP controller", func() {
func testGlobalIngressIPCreatedClusterIPSvc(t *globalIngressIPControllerTestDriver, ingressIP *submarinerv1.GlobalIngressIP) {
var service *corev1.Service

JustBeforeEach(func() {
BeforeEach(func() {
service = newClusterIPService()
})

JustBeforeEach(func() {
t.createService(service)
t.createGlobalIngressIP(ingressIP)
})
Expand All @@ -150,11 +153,23 @@ func testGlobalIngressIPCreatedClusterIPSvc(t *globalIngressIPControllerTestDriv
Expect(intSvc.Spec.Ports).To(Equal(service.Spec.Ports))
Expect(intSvc.Spec.IPFamilyPolicy).ToNot(BeNil())
Expect(*intSvc.Spec.IPFamilyPolicy).To(Equal(corev1.IPFamilyPolicySingleStack))
Expect(intSvc.Spec.PublishNotReadyAddresses).To(BeFalse())

finalizer := intSvc.GetFinalizers()[0]
Expect(finalizer).To(Equal(controllers.InternalServiceFinalizer))
})

Context("and the service has PublishNotReadyAddresses set to true", func() {
BeforeEach(func() {
service.Spec.PublishNotReadyAddresses = true
})

It("should set PublishNotReadyAddresses to true on the internal submariner service", func() {
intSvc := t.awaitService(controllers.GetInternalSvcName(serviceName))
Expect(intSvc.Spec.PublishNotReadyAddresses).To(BeTrue())
})
})

Context("with the IP pool exhausted", func() {
BeforeEach(func() {
_, err := t.pool.Allocate(t.pool.Size())
Expand Down
Loading