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

Feature: nlb zone affinity via r53 #694

Merged
merged 3 commits into from
Apr 30, 2024
Merged

Conversation

szuecs
Copy link
Member

@szuecs szuecs commented Apr 30, 2024

feature: set nlb zone affinity for clients
log: log default cross zone and zone affinity config

This enables you to set dns_record.client_routing_policy configuration, such that you can decide for NLB via R53 feature that clients running in the same zone will hit also the same zone of your NLB. This is interesting for cross cluster traffic or traffic that stays in the same cluster but passes the NLB. Valid configurations are:

  • availability_zone_affinity
  • partial_availability_zone_affinity
  • any_availability_zone (default)

see also https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html\#load-balancer-attributes and https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html\#zonal-dns-affinity

This enables you to set dns_record.client_routing_policy configuration, such that you can decide for NLB via R53 feature that clients running in the same zone will hit also the same zone of your NLB. This is interesting for cross cluster traffic or traffic that stays in the same cluster but passes the NLB. Valid configurations are:
- availability_zone_affinity
- partial_availability_zone_affinity
- any_availability_zone (default)

see also https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html\#load-balancer-attributes and https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html\#zonal-dns-affinity

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@szuecs
Copy link
Member Author

szuecs commented Apr 30, 2024

I want to test in a dev cluster before merge

@@ -124,6 +125,10 @@ const (
DefaultAlbS3LogsPrefix = ""

DefaultCustomFilter = ""

// DefaultZoneAffinity specifies dns_record.client_routing_policy, see also https://docs.aws.amazon.com/elasticloadbalancing/latest/network/network-load-balancers.html#load-balancer-attributes
DefaultZoneAffinity = "any_availability_zone"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// availability_zone_affinity 100%
// partial_availability_zone_affinity 85%
// any_availability_zone 0%
Value: cloudformation.String(spec.nlbZoneAffinity),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we assume it has a valid value. Do we need to check if it is not empty?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is always set. In cf_template we should never check the values, only if we need to delete the attribute we need to check.

@AlexanderYastrebov
Copy link
Member

LGTM modulo minor comments.

@AlexanderYastrebov
Copy link
Member

👍

Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
@AlexanderYastrebov
Copy link
Member

👍

1 similar comment
@szuecs
Copy link
Member Author

szuecs commented Apr 30, 2024

👍

@szuecs
Copy link
Member Author

szuecs commented Apr 30, 2024

Default:
image

With zone affinity set:
image

@szuecs szuecs merged commit d93850d into master Apr 30, 2024
8 of 10 checks passed
@szuecs szuecs deleted the feature/nlb-zone-affinity-via-r53 branch April 30, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants