Skip to content

Commit 5e300ec

Browse files
author
speruri
committed
Add default values for NLB target group attributes
- Add DefaultNLBProxyProtocolV2Enabled constant (false) - Add DefaultNLBPreserveClientIPEnabled constant (true, since preserve_client_ip is enabled by default) - Initialize test adapter with these default values - Update test data files to include proxy_protocol_v2 and preserve_client_ip attributes This ensures NLB target groups always have these attributes explicitly set in CloudFormation with their default values, matching the actual behavior. Signed-off-by: speruri <surya.srikar.peruri@zalando.de>
1 parent 464d836 commit 5e300ec

File tree

9 files changed

+64
-4
lines changed
  • aws
  • testdata
    • ingress_nlb_dualstack_annotation_ipv6_tg/output/templates
    • ingress_nlb_dualstack_annotation/output/templates
    • ingress_nlb_dualstack_ipv6_tg/output/templates
    • ingress_nlb_dualstack/output/templates
    • ingress_nlb_ipv6_tg/output/templates
    • ingress_nlb/output/templates
    • rg_nlb/output/templates

9 files changed

+64
-4
lines changed

aws/adapter.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ const (
137137
// DefaultNLBCrossZone specifies the default configuration for cross
138138
// zone load balancing: https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#load-balancer-attributes
139139
// It it is safe to change as per https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattribute.html#aws-properties-elasticloadbalancingv2-loadbalancer-loadbalancerattribute-properties
140-
DefaultNLBCrossZone = false
141-
DefaultNLBHTTPEnabled = false
142-
DefaultTargetGroupProtocolVersion = "HTTP1"
140+
DefaultNLBCrossZone = false
141+
DefaultNLBHTTPEnabled = false
142+
DefaultTargetGroupProtocolVersion = "HTTP1"
143+
DefaultNLBProxyProtocolV2Enabled = false
144+
DefaultNLBPreserveClientIPEnabled = true
143145

144146
nameTag = "Name"
145147
LoadBalancerTypeApplication = "application"

testdata/ingress_nlb/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/ingress_nlb_dualstack/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/ingress_nlb_dualstack_annotation/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/ingress_nlb_dualstack_annotation_ipv6_tg/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/ingress_nlb_dualstack_ipv6_tg/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/ingress_nlb_ipv6_tg/output/templates/ing.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

testdata/rg_nlb/output/templates/rg.cf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@
174174
{
175175
"Key": "deregistration_delay.timeout_seconds",
176176
"Value": "0"
177+
},
178+
{
179+
"Key": "proxy_protocol_v2.enabled",
180+
"Value": "false"
181+
},
182+
{
183+
"Key": "preserve_client_ip.enabled",
184+
"Value": "true"
177185
}
178186
],
179187
"UnhealthyThresholdCount": 0,

worker_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,9 @@ func TestResourceConversionOneToOne(tt *testing.T) {
882882
WithCustomCloudFormationClient(clientCF).
883883
WithIpAddressType(scenario.ipAddressType).
884884
WithTargetGroupIPAddressType(scenario.targetGroupIPAddressType).
885-
WithNLBZoneAffinity(aws.DefaultZoneAffinity)
885+
WithNLBZoneAffinity(aws.DefaultZoneAffinity).
886+
WithNLBProxyProtocolV2(aws.DefaultNLBProxyProtocolV2Enabled).
887+
WithNLBPreserveClientIP(aws.DefaultNLBPreserveClientIPEnabled)
886888

887889
a, err = a.UpdateManifest(ctx, clusterID, vpcID)
888890
if err != nil {

0 commit comments

Comments
 (0)