feat: Introduce annotation for setting explicit egress CIDR ranges on Service LB frontend security group #4348
+625
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Description
This PR implements a new annotation (
service.beta.kubernetes.io/aws-load-balancer-outbound-cidrs
) for Service load balancers to enable explicitly specifying a list of CIDR ranges to be added as egress rules to managed frontend security groups.Currently,
aws-load-balancer-controller
doesn't set any explicit egress rules during SG creation, relying instead on AWS to create a default all-protocol0.0.0.0/0
rule when no explicit egress rules are specified during SG creation. This egress rule is necessary for health checks on target groups, etc.However, some organizations may have security scans that trigger on this
0.0.0.0/0
rule, and it would be desirable to be able to scope that down to a specific set of CIDR ranges instead (e.g. the VPC CIDR, for example). There is currently no mechanism inaws-load-balancer-controller
to allow setting this, so that is what this is intended to provide.Note that this only implements this for the Service load balancer (e.g. nlb) workflow. I wanted to keep the PR more narrowly scoped, but it would probably relatively simple to implement for other workflows as well. There is also the
backend
SG where a command flag would need to be introduced, but it's easy enough just to use a statically created SG for the backend SG using the existing mechanisms instead.Checklist
README.md
, or thedocs
directory)BONUS POINTS checklist: complete for good vibes and maybe prizes?! 🤯