Skip to content

Commit

Permalink
Propagate PublishNotReadyAddresses flag to GN internal service
Browse files Browse the repository at this point in the history
Fixes #3216

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis committed Nov 18, 2024
1 parent 8130da6 commit a718511
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
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

0 comments on commit a718511

Please sign in to comment.