From f51da35649323b4a3505b77a8722f8ed65d72f72 Mon Sep 17 00:00:00 2001 From: "anisha.kj" Date: Tue, 7 Nov 2023 07:44:29 -0800 Subject: [PATCH] Addressing review comments Signed-off-by: anisha.kj --- controllers/pravega_segmentstore.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/controllers/pravega_segmentstore.go b/controllers/pravega_segmentstore.go index eca75ad4d..11def4268 100644 --- a/controllers/pravega_segmentstore.go +++ b/controllers/pravega_segmentstore.go @@ -594,8 +594,8 @@ func MakeSegmentStoreExternalServices(p *api.PravegaCluster) []*corev1.Service { serviceport, _ := strconv.Atoi(p.Spec.Pravega.Options["pravegaservice.service.listener.port"]) adminPort, _ := strconv.Atoi(p.Spec.Pravega.Options["pravegaservice.admin.listener.port"]) - servicePortIncrement := int32(0) - adminPortIncrement := int32(0) + currentServicePort := int32(serviceport) + currentAdminPort := int32(adminPort) for i := int32(0); i < p.Spec.Pravega.SegmentStoreReplicas; i++ { ssPodName := p.ServiceNameForSegmentStore(i) @@ -644,20 +644,20 @@ func MakeSegmentStoreExternalServices(p *api.PravegaCluster) []*corev1.Service { service.Spec.ExternalTrafficPolicy = corev1.ServiceExternalTrafficPolicyTypeLocal } if p.Spec.Pravega.SegmentStoreLoadBalancerIP != "" { - for util.ContainsElement(p.Spec.ReservedPortList, int32(serviceport)+i+servicePortIncrement) { - servicePortIncrement++ + for util.ContainsElement(p.Spec.ReservedPortList, currentServicePort) { + currentServicePort++ } - - service.Spec.Ports[0].Port = int32(serviceport) + i + servicePortIncrement - - for util.ContainsElement(p.Spec.ReservedPortList, int32(adminPort)+i+adminPortIncrement) { - adminPortIncrement++ + service.Spec.Ports[0].Port = currentServicePort + for util.ContainsElement(p.Spec.ReservedPortList, currentAdminPort) { + currentAdminPort++ } - service.Spec.Ports[1].Port = int32(adminPort) + i + adminPortIncrement - + service.Spec.Ports[1].Port = currentAdminPort service.Spec.LoadBalancerIP = p.Spec.Pravega.SegmentStoreLoadBalancerIP + currentServicePort++ + currentAdminPort++ } services[i] = service + } return services }