aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

feat(ecs-patterns): support dualstack ALB in both ec2 and fargate

Open wafuwafu13 opened this issue 1 year ago • 5 comments

Issue # (if applicable)

Closes https://github.com/aws/aws-cdk/issues/29039

Reason for this change

Dualstack ALB is not supported in both ApplicationLoadBalancedEc2Service and ApplicationLoadBalancedFargateService.

Description of changes

  • Add ipAddressType field to ApplicationLoadBalancedServiceBaseProps that provides properties for the base ApplicationLoadBalancedEc2Service or ApplicationLoadBalancedFargateService service.
  • User can specify IpAddressType.Ipv4 or IpAddressType.DUAL_STACK.
  • Default is IpAddressType.Ipv4

Description of how you validated changes

  • Pass unit tests
  • Pass integration tests

Checklist


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

wafuwafu13 avatar Feb 20 '24 22:02 wafuwafu13

Build Log

@aws-cdk-testing/framework-integ: Snapshot Results: 
@aws-cdk-testing/framework-integ: Tests:    16 failed, 807 total
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-health-check.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.executionrole.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-elasticloadbalancingv2-targets/test/integ.alb-target.js
@aws-cdk-testing/framework-integ: Error: Some tests failed!
@aws-cdk-testing/framework-integ: To re-run failed tests run: integ-runner --update-on-failed
@aws-cdk-testing/framework-integ:     at main (/codebuild/output/src2783938204/src/github.com/aws/aws-cdk/packages/@aws-cdk/integ-runner/lib/cli.js:191:19)
@aws-cdk-testing/framework-integ: Error: integ-runner exited with error code 1
@aws-cdk-testing/framework-integ: Tests failed. Total time (2m5.7s) | integ-runner (1m48.3s) | /codebuild/output/src2783938204/src/github.com/aws/aws-cdk/node_modules/jest/bin/jest.js (15.6s)
@aws-cdk-testing/framework-integ: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

wafuwafu13 avatar Feb 21 '24 09:02 wafuwafu13

I will fix all.

ex)

$ yarn integ aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js --update-on-failed --parallel-regions eu-west-1
yarn run v1.22.19
$ integ-runner --language javascript aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js --update-on-failed --parallel-regions eu-west-1

Verifying integration test snapshots...

  CHANGED    aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service 0.894s
      Resources
[~] AWS::ElasticLoadBalancingV2::LoadBalancer myServiceLB168895E1 
 └─ [+] IpAddressType
     └─ ipv4



Snapshot Results: 

Tests:    1 failed, 1 total
Failed: /Users/herotaka/Desktop/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js

Running integration tests for failed tests...

Running in parallel across regions: eu-west-1
Running test /Users/herotaka/Desktop/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service.js in eu-west-1

wafuwafu13 avatar Feb 21 '24 12:02 wafuwafu13

✅ aws-ecs-patterns/test/ec2/integ.application-load-balanced-ecs-service

success

❌ -> ✅ aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point

AWS::ECS::Service | CREATE_IN_PROGRESS
$ aws ecs describe-tasks --cluster aws-ecs-integ-alb-ec2-cmd-entrypoint-Ec2ClusterEE43E89D-zBVKZa6JEBrW --tasks xxxxxxxxxxxxxxx | jq '.tasks[].stopCode'
"EssentialContainerExited"

fixed at https://github.com/aws/aws-cdk/pull/29333

❌ -> ✅ aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point

AWS::ECS::Service

CREATE_FAILED | Resource timed out waiting for completion

fixed at https://github.com/aws/aws-cdk/pull/29490

✅ aws-ecs-patterns/test/fargate/integ.alb-fargate-service-health-check

success

❌ aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout

aws-ecs-integ-alb-fg-idletimeout | 25/42 | 9:56:13 AM | CREATE_FAILED        | AWS::CertificateManager::Certificate      | myService/Certificate (myServiceCertificate152F9DDA) DNS Record Set is not available. Certificate is in FAILED status.
 ❌  aws-ecs-integ-alb-fg-idletimeout failed: Error: The stack named aws-ecs-integ-alb-fg-idletimeout failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: DNS Record Set is not available. Certificate is in FAILED status.
    at FullCloudFormationDeployment.monitorDeployment (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deploy-stack.js:252:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:232:32)
    at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:88:21

❌ aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https

aws-ecs-integ-alb-fg-https | 26/42 | 9:57:38 AM | CREATE_FAILED        | AWS::CertificateManager::Certificate      | myService/Certificate (myServiceCertificate152F9DDA) DNS Record Set is not available. Certificate is in FAILED status.
❌  aws-ecs-integ-alb-fg-https failed: Error: The stack named aws-ecs-integ-alb-fg-https failed creation, it may need to be manually deleted from the AWS console: ROLLBACK_COMPLETE: DNS Record Set is not available. Certificate is in FAILED status.
    at FullCloudFormationDeployment.monitorDeployment (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deploy-stack.js:252:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:232:32)
    at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:88:21

❌ aws-ecs-patterns/test/fargate/integ.asset-image

aws-ecs-integ-fargate-image:  start: Building efa824c4bb8d68e82b8855447237ad68cb4c3a702664a01b5ec65368f5204d15:current_account-current_region
aws-ecs-integ-fargate-image:  success: Built efa824c4bb8d68e82b8855447237ad68cb4c3a702664a01b5ec65368f5204d15:current_account-current_region
aws-ecs-integ-fargate-image:  start: Building 0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14:current_account-current_region
aws-ecs-integ-fargate-image:  start: Publishing efa824c4bb8d68e82b8855447237ad68cb4c3a702664a01b5ec65368f5204d15:current_account-current_region
aws-ecs-integ-fargate-image:  success: Published efa824c4bb8d68e82b8855447237ad68cb4c3a702664a01b5ec65368f5204d15:current_account-current_region
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 132B done
#2 DONE 0.0s

#3 [internal] load metadata for public.ecr.aws/lambda/python:3.6
#3 ...

#4 [auth] aws:: lambda/python:pull token for public.ecr.aws
#4 DONE 0.0s

#3 [internal] load metadata for public.ecr.aws/lambda/python:3.6
#3 ERROR: pulling from host public.ecr.aws failed with status code [manifests 3.6]: 403 Forbidden
------
 > [internal] load metadata for public.ecr.aws/lambda/python:3.6:
------
Dockerfile:1
--------------------
   1 | >>> FROM public.ecr.aws/lambda/python:3.6
   2 |     EXPOSE 8000
   3 |     WORKDIR /src
--------------------
ERROR: failed to solve: public.ecr.aws/lambda/python:3.6: pulling from host public.ecr.aws failed with status code [manifests 3.6]: 403 Forbidden
aws-ecs-integ-fargate-image:  fail: docker build --tag cdkasset-0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14 . exited with error code 1: #1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 132B done
#2 DONE 0.0s

#3 [internal] load metadata for public.ecr.aws/lambda/python:3.6
#3 ...

#4 [auth] aws:: lambda/python:pull token for public.ecr.aws
#4 DONE 0.0s

#3 [internal] load metadata for public.ecr.aws/lambda/python:3.6
#3 ERROR: pulling from host public.ecr.aws failed with status code [manifests 3.6]: 403 Forbidden
------
 > [internal] load metadata for public.ecr.aws/lambda/python:3.6:
------
Dockerfile:1
--------------------
   1 | >>> FROM public.ecr.aws/lambda/python:3.6
   2 |     EXPOSE 8000
   3 |     WORKDIR /src
--------------------
ERROR: failed to solve: public.ecr.aws/lambda/python:3.6: pulling from host public.ecr.aws failed with status code [manifests 3.6]: 403 Forbidden

 ❌ Deployment failed: Error: Failed to build asset 0a3355be12051c9984bf2b0b2bba4e6ea535968e5b6e7396449701732fe5ed14:current_account-current_region
    at Deployments.buildSingleAsset (/workspaces/aws-cdk/packages/aws-cdk/lib/api/deployments.js:260:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.buildAsset (/workspaces/aws-cdk/packages/aws-cdk/lib/cdk-toolkit.js:161:13)
    at async /workspaces/aws-cdk/packages/aws-cdk/lib/util/work-graph.js:91:21

✅ aws-ecs-patterns/test/fargate/integ.circuit-breaker-load-balanced-fargate-service.js

success

✅ aws-ecs-patterns/test/fargate/integ.circuit-breaker-no-deployment-controller-fargate-service

success

✅ aws-ecs-patterns/test/fargate/integ.executionrole

success

❌ aws-ecs-patterns/test/fargate/integ.l3-autocreate

AWS::ECS::Service | CREATE_IN_PROGRESS

aws-ec-NLBFa-IGODBAV2FUXB スクリーンショット 2024-02-22 11 07 22

❌ aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies

AWS::ECS::Service | CREATE_IN_PROGRESS

aws-ec-NLBFa-IUW9I9E8UBNC スクリーンショット 2024-02-22 11 09 43

❌ aws-ecs-patterns/test/fargate/integ.l3-vpconly

AWS::ECS::Service | CREATE_IN_PROGRESS

aws-ec-NLBFa-CTLQOQKDUB4M

スクリーンショット 2024-02-22 11 11 19

❌ aws-ecs-patterns/test/fargate/integ.l3

AWS::ECS::Service | CREATE_IN_PROGRESS

aws-ec-NLBFa-IPBRSWSNJ2OX

スクリーンショット 2024-02-22 11 12 43

❌ aws-ecs-patterns/test/fargate/integ.special-listener

AWS::ECS::Service | CREATE_IN_PROGRESS

aws-ec-Farga-PHBFreHHRlZB

スクリーンショット 2024-02-22 11 14 34

✅ aws-elasticloadbalancingv2-targets/test/integ.alb-target

success

wafuwafu13 avatar Feb 22 '24 11:02 wafuwafu13

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 3135a6ff8bb614637380534babed15e878c0bf8d
  • Result: FAILED
  • Build Logs (available for 30 days)

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

aws-cdk-automation avatar Feb 22 '24 17:02 aws-cdk-automation

I will fix in another PR

@aws-cdk-testing/framework-integ: Snapshot Results: 
@aws-cdk-testing/framework-integ: Tests:    10 failed, 813 total
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/ec2/integ.alb-ecs-service-command-entry-point.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-command-entry-point.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https-idle-timeout.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.alb-fargate-service-https.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.asset-image.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-autocreate.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-capacity-provider-strategies.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3-vpconly.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.l3.js
@aws-cdk-testing/framework-integ: Failed: /codebuild/output/src1382708476/src/github.com/aws/aws-cdk/packages/@aws-cdk-testing/framework-integ/test/aws-ecs-patterns/test/fargate/integ.special-listener.js

wafuwafu13 avatar Feb 22 '24 17:02 wafuwafu13

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

aws-cdk-automation avatar Mar 02 '24 00:03 aws-cdk-automation

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

aws-cdk-automation avatar Mar 03 '24 00:03 aws-cdk-automation

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

aws-cdk-automation avatar Mar 04 '24 00:03 aws-cdk-automation

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

aws-cdk-automation avatar Mar 05 '24 00:03 aws-cdk-automation

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

aws-cdk-automation avatar Mar 11 '24 00:03 aws-cdk-automation

Conflicts will occur due to fixing tests in next step so I close this

wafuwafu13 avatar Mar 11 '24 18:03 wafuwafu13