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

fix(elasticloadbalancingv2): cannot create UDP listener for dual-stack NLB #32184

Merged
merged 22 commits into from
Dec 9, 2024

Conversation

badmintoncryer
Copy link
Contributor

@badmintoncryer badmintoncryer commented Nov 19, 2024

Issue # (if applicable)

None

Reason for this change

NetworkListener has the validation that it does not create UDP listeners for dual-stack NLB.

However, dual-stack NLB now supports the creation of UDP listeners, and this validation is no longer required.

https://aws.amazon.com/about-aws/whats-new/2024/10/aws-udp-privatelink-dual-stack-network-load-balancers/?nc1=h_ls

Description of changes

  • Remove this validation from NetworkListener class.
    if (
      props.loadBalancer.ipAddressType === IpAddressType.DUAL_STACK &&
      (props.protocol === Protocol.UDP || props.protocol === Protocol.TCP_UDP)
    ) {
      throw new Error('UDP or TCP_UDP listeners cannot be added to a dualstack network load balancer.');
    }

Description of how you validated changes

Add both unit and integ tests.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team November 19, 2024 13:08
@github-actions github-actions bot added p2 distinguished-contributor [Pilot] contributed 50+ PRs to the CDK labels Nov 19, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@badmintoncryer
Copy link
Contributor Author

Exemption request
This change does not require a snapshot update.

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Nov 19, 2024
@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Nov 19, 2024
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.67%. Comparing base (5ada161) to head (ae3d215).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #32184      +/-   ##
==========================================
+ Coverage   78.66%   78.67%   +0.01%     
==========================================
  Files         107      107              
  Lines        7237     7237              
  Branches     1329     1329              
==========================================
+ Hits         5693     5694       +1     
+ Misses       1358     1357       -1     
  Partials      186      186              
Flag Coverage Δ
suite.unit 78.67% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
packages/aws-cdk 78.67% <ø> (+0.01%) ⬆️

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels Nov 23, 2024
Copy link
Contributor

@GavinZZ GavinZZ left a comment

Choose a reason for hiding this comment

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

Thank you for making the change! Can you add an integration test to test the deployability with UDP as protocol?

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Nov 25, 2024
@badmintoncryer
Copy link
Contributor Author

Memo:I'll try to make EnablePrefixForIpv6SourceNat configurable at L2.

integ test:

import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as integ from '@aws-cdk/integ-tests-alpha';
import * as elbv2 from 'aws-cdk-lib/aws-elasticloadbalancingv2';
import { App, Stack } from 'aws-cdk-lib';

const app = new App();
const stack = new Stack(app, 'DualstackNlbUdpListenerStack');

const vpc = new ec2.Vpc(stack, 'Vpc', {
  restrictDefaultSecurityGroup: false,
  maxAzs: 2,
  ipProtocol: ec2.IpProtocol.DUAL_STACK,
});

const nlb = new elbv2.NetworkLoadBalancer(stack, 'Nlb', {
  vpc,
  ipAddressType: elbv2.IpAddressType.DUAL_STACK,
});

const targetGroup = new elbv2.NetworkTargetGroup(stack, 'TargetGroup', {
  vpc,
  port: 12345,
  protocol: elbv2.Protocol.UDP,
});

const listener = new elbv2.NetworkListener(stack, 'Listener', {
  loadBalancer: nlb,
  port: 12345,
  protocol: elbv2.Protocol.UDP,
});
listener.addTargetGroups('TargetGroups', targetGroup);

new integ.IntegTest(app, 'DualstackNlbUdpListenerInteg', {
  testCases: [stack],
});

Result:

Failed resources:
DualstackNlbUdpListenerStack | 12:58:17 PM | CREATE_FAILED        | AWS::ElasticLoadBalancingV2::Listener     | Listener (Listener828B0E81) Resource handler returned message: "The specified listener protocol 'UDP' is not supported on load balancers using the 'dualstack' IP address type when 'EnablePrefixForIpv6SourceNat' is set to 'off' (Service: ElasticLoadBalancingV2, Status Code: 400, Request ID: 9bde532a-65ee-4d3c-b7f8-dd4226cf00aa)" (RequestToken: f44f72f5-c3f2-c539-ea85-986635ad31eb, HandlerErrorCode: InvalidRequest)

@aws-cdk-automation aws-cdk-automation dismissed their stale review December 3, 2024 12:43

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify mergify bot dismissed GavinZZ’s stale review December 3, 2024 14:17

Pull request has been modified.

@GavinZZ
Copy link
Contributor

GavinZZ commented Dec 5, 2024

Thank you for all the effort! Approved this PR.

Copy link
Contributor

mergify bot commented Dec 5, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 5, 2024
Copy link
Contributor

mergify bot commented Dec 5, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@badmintoncryer
Copy link
Contributor Author

@GavinZZ Thanks always!!

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 6, 2024

update

☑️ Nothing to do

  • queue-position = -1 [📌 update requirement]
  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]

Copy link
Contributor

mergify bot commented Dec 7, 2024

This pull request has been removed from the queue for the following reason: checks failed.

The merge conditions cannot be satisfied due to failing checks:

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.

If you want to requeue this pull request, you need to post a comment with the text: @mergifyio requeue

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 7, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

Copy link
Contributor

mergify bot commented Dec 7, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 7, 2024

update

✅ Branch has been successfully updated

Copy link
Contributor

mergify bot commented Dec 7, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 8, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 9, 2024

update

☑️ Nothing to do

  • #commits-behind > 0 [📌 update requirement]
  • -closed [📌 update requirement]
  • -conflict [📌 update requirement]
  • queue-position = -1 [📌 update requirement]

@badmintoncryer
Copy link
Contributor Author

@mergify update

Copy link
Contributor

mergify bot commented Dec 9, 2024

update

✅ Branch has been successfully updated

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: ae3d215
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Dec 9, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit e9c6e23 into aws:main Dec 9, 2024
17 checks passed
Copy link

github-actions bot commented Dec 9, 2024

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 9, 2024
@badmintoncryer badmintoncryer deleted the nlb-dualstack-listener branch December 9, 2024 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
distinguished-contributor [Pilot] contributed 50+ PRs to the CDK p2 pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants