aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

Add support for TCP_UDP to NLB TargetGroups and Listeners (rebase)

Open lyda opened this issue 1 year ago • 5 comments

This is a work in progress - I need to test it.

Issue

https://github.com/kubernetes-sigs/aws-load-balancer-controller/issues/1608#issuecomment-937346660

And based on this PR: https://github.com/kubernetes-sigs/aws-load-balancer-controller/pull/2275

Description

Previously, aws-load-balancer-controller ignored extra overlapping ServicePorts defined in the Kubernetes Service spec if the external port numbers were the same even if the protocols were different (e.g. TCP:53, UDP:53).

This behavior prevented users from exposing services that support TCP and UDP on the same external load balancer port number.

This patch solves the problem by detecting when a user defines multiple ServicePorts for the same external load balancer port number but using TCP and UDP protocols separately. In such situations, a TCP_UDP TargetGroup and Listener are created and SecurityGroup rules are updated accordingly. If more than two ServicePorts are defined, only the first two mergeable ServicePorts are used. Otherwise, the first ServicePort is used.

Checklist

  • [x ] Added tests that cover your change (if possible)
  • [ ] Added/modified documentation as required (such as the README.md, or the docs directory)
  • [ ] Manually tested
  • [x ] Made sure the title of the PR is a good description that can go into the release notes

BONUS POINTS checklist: complete for good vibes and maybe prizes?! :exploding_head:

  • [x ] Backfilled missing tests for code in same general area :tada:
  • [x ] Refactored something and made the world a better place :star2:

lyda avatar Aug 13 '24 14:08 lyda