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

feat(ecs): add port mappings to containers with props #13262

Merged
merged 6 commits into from
Feb 26, 2021

Conversation

misterjoshua
Copy link
Contributor

@misterjoshua misterjoshua commented Feb 24, 2021

This PR adds an optional portMappings property to ContainerDefinitionOptions so that users can add port mappings when they add a container to a TaskDefinition.

Closes #13261


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

@gitpod-io
Copy link

gitpod-io bot commented Feb 24, 2021

@nathanpeck
Copy link
Member

+1 This one looks good to me. I'll get a second opinion from @SoManyHs or @piradeepk just to be on the safe side though

@piradeepk
Copy link
Contributor

Looks good to me too. @misterjoshua do you mind updating one of the existing integ tests to define container port mappings in the constructor, rather than after construction?

Comment on lines 240 to 250
```ts
taskDefinition.addContainer("WebContainer", {
image: ecs.ContainerImage.fromRegistry("amazon/amazon-ecs-sample"),
memoryLimitMiB: 1024,
portMappings: [{ containerPort: 3000 }]
})
```

```ts
container.addPortMappings({
containerPort: 3000
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment above both to explain that there are 2 ways of defining the port mapping?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh sure. Just saw this. Let me get right on that.

@misterjoshua
Copy link
Contributor Author

misterjoshua commented Feb 25, 2021

Looks good to me too. @misterjoshua do you mind updating one of the existing integ tests to define container port mappings in the constructor, rather than after construction?

@piradeepk Done! :)

@piradeepk piradeepk self-assigned this Feb 25, 2021
@piradeepk
Copy link
Contributor

@misterjoshua thanks for the patience. I was wondering if you could add one more unit test case in which you add a port mapping to the constructor and also call addPortMapping with a different port mapping (to verify that both mappings are included, and that one does not overwrite the other).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 4f05bb3
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

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

@misterjoshua
Copy link
Contributor Author

@misterjoshua thanks for the patience. I was wondering if you could add one more unit test case in which you add a port mapping to the constructor and also call addPortMapping with a different port mapping (to verify that both mappings are included, and that one does not overwrite the other).

@piradeepk This is done. Please let me know if you need any more changes.

Copy link
Contributor

@piradeepk piradeepk left a comment

Choose a reason for hiding this comment

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

This is awesome! Thanks for contributing and for addressing all of the feedback @misterjoshua!!! Ship it! 💯

@mergify
Copy link
Contributor

mergify bot commented Feb 26, 2021

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

This was referenced Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(ecs): add a portMappings prop to ContainerDefinition
4 participants