From d12245f1aa7379b43f8b8b6cf936a00f5eb954a4 Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Tue, 16 Jan 2024 15:32:09 +0530 Subject: [PATCH 1/3] INFRA-2644 | Abhishek | Ignore secondary port for existing load balancers --- templates/ingress.jsonnet | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/ingress.jsonnet b/templates/ingress.jsonnet index 72fc9e89..b6fb9e85 100644 --- a/templates/ingress.jsonnet +++ b/templates/ingress.jsonnet @@ -126,11 +126,17 @@ local loadbalancerWithAllPorts = [ if port.port != null ]; +local filteredLoadBalancerWithAllPorts = [ + lb + for lb in loadbalancerWithAllPorts + if (lb.groupName == '' && !lb.exposeToLoadBalancer) || (lb.groupName != '') +]; + std.map( //Generate ingress objects based on above filtered configurations function(lbIndex) { config:: { - lbObject: loadbalancerWithAllPorts[lbIndex], + lbObject: filteredLoadBalancerWithAllPorts[lbIndex], subnetScheme: load_balancer_util.subnet_scheme($.config.lbObject.accessPolicies), serviceName: if isflinkJob then (deployment_manifest.name + '-rest') else chart.full_service_name(deployment_manifest.name), servicePort: $.config.lbObject.port, @@ -176,5 +182,5 @@ std.map( }, }, - std.range(0, std.length(loadbalancerWithAllPorts) - 1) + std.range(0, std.length(filteredLoadBalancerWithAllPorts) - 1) ) From 1d1eb13a511ef3d332ee27df05284268a2872b06 Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Tue, 16 Jan 2024 15:46:54 +0530 Subject: [PATCH 2/3] INFRA-2644 | Abhishek | Improve readability --- templates/ingress.jsonnet | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/templates/ingress.jsonnet b/templates/ingress.jsonnet index b6fb9e85..9674a0e9 100644 --- a/templates/ingress.jsonnet +++ b/templates/ingress.jsonnet @@ -126,10 +126,12 @@ local loadbalancerWithAllPorts = [ if port.port != null ]; +local isOldALB(lbObject) = lbObject.groupName == '' ; + local filteredLoadBalancerWithAllPorts = [ - lb - for lb in loadbalancerWithAllPorts - if (lb.groupName == '' && !lb.exposeToLoadBalancer) || (lb.groupName != '') + lbObject + for lbObject in loadbalancerWithAllPorts + if (isOldALB(lbObject) && !lbObject.exposeToLoadBalancer) || !isOldALB(lbObject) ]; std.map( From 683bcbc370c9219b38b9f32a8ccc71a66695be7a Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Tue, 16 Jan 2024 15:57:12 +0530 Subject: [PATCH 3/3] INFRA-2644 | Abhishek | Improve readability --- templates/ingress.jsonnet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/ingress.jsonnet b/templates/ingress.jsonnet index 9674a0e9..c0dbd444 100644 --- a/templates/ingress.jsonnet +++ b/templates/ingress.jsonnet @@ -126,12 +126,13 @@ local loadbalancerWithAllPorts = [ if port.port != null ]; +# this is to ensure only in case of new load balancers,( which will not have groupName as empty string ), exposed ingress is created local isOldALB(lbObject) = lbObject.groupName == '' ; local filteredLoadBalancerWithAllPorts = [ lbObject for lbObject in loadbalancerWithAllPorts - if (isOldALB(lbObject) && !lbObject.exposeToLoadBalancer) || !isOldALB(lbObject) + if !isOldALB(lbObject) || (isOldALB(lbObject) && !lbObject.exposeToLoadBalancer) ]; std.map(