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(batch): ComputeEnvironment implements IConnectable #21458

Merged
merged 10 commits into from
Aug 5, 2022
Merged

feat(batch): ComputeEnvironment implements IConnectable #21458

merged 10 commits into from
Aug 5, 2022

Conversation

tcutts
Copy link
Contributor

@tcutts tcutts commented Aug 4, 2022

closes #20983

ComputeEnvironments have embedded security groups in them. These are currently difficult to reach and modify in CDK stacks, which forces users into undesirable practices when integrating batch queues with other services such as as EFS filesystems or RDS instances. Ideally, it should be possible to use compute environments as a target:

something.connections.allowDefaultPortFrom(computeEnvironment);

but this isn't currently possible, so the user may try to work around it by allowing from any IPv4, or by having to use an escape hatch, which is not simple.

This pull request adds ec2.IConnectable to batch.ComputeEnvironment. It still seems to pass all the existing tests and integration tests, so I don't think it's a breaking change, but I suspect it could be done in a better way than I've done it, to make things even simpler for the user.


All Submissions:

Adding new Unconventional Dependencies:

  • [no] This PR adds new unconventional dependencies following the process described here

New Features

  • [yes] Have you added the new feature to an integration test?
    • [yes] Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

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 Aug 4, 2022

@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Aug 4, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team August 4, 2022 07:51
@tcutts tcutts changed the title feat(aws-batch): ComputeEnvironment implement IConnectable feat(aws-batch): ComputeEnvironment implements IConnectable Aug 4, 2022
@mrgrain mrgrain changed the title feat(aws-batch): ComputeEnvironment implements IConnectable feat(batch): ComputeEnvironment implements IConnectable Aug 4, 2022
@mrgrain
Copy link
Contributor

mrgrain commented Aug 4, 2022

Hi @tcutts and thanks for the contribution! This looks exciting and I think you've found the right approach to implement this. Before I go ahead with a more thorough review, can you please make sure the build passes and with this kind of logic change, we will definitely need unit tests in addition to the integration test you've already added.

@tcutts
Copy link
Contributor Author

tcutts commented Aug 4, 2022

There you go @mrgrain - builds properly now. My example in the README needed fixing... Thanks for the encouraging words.

Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

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

Looks like we still need unit tests on this change.

mrgrain
mrgrain previously requested changes Aug 4, 2022
Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

A few minor changes and since we are changing the logical, I'd like to see a unit test.

packages/@aws-cdk/aws-batch/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-batch/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-batch/README.md Outdated Show resolved Hide resolved
packages/@aws-cdk/aws-batch/lib/compute-environment.ts Outdated Show resolved Hide resolved
@mergify mergify bot dismissed stale reviews from TheRealAmazonKendra and mrgrain August 4, 2022 19:48

Pull request has been modified.

@tcutts
Copy link
Contributor Author

tcutts commented Aug 4, 2022

I've added a couple of unit tests, but it's not a particular area of expertise for me (not being an SDE!); I've borrowed some of the connections test logic from aws-ec2, and re-purposed it here to check that the right ingress rules are created, for both fargate and EC2 managed compute environments. Is that sufficient?

Copy link
Contributor

@mrgrain mrgrain left a comment

Choose a reason for hiding this comment

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

Yes, these look great! Thank you for your work here. :shipit:

@mergify
Copy link
Contributor

mergify bot commented Aug 5, 2022

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
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 4bc9651 into aws:main Aug 5, 2022
@mergify
Copy link
Contributor

mergify bot commented Aug 5, 2022

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).

@tcutts tcutts deleted the connectableComputeEnvironment branch August 5, 2022 20:48
@mrgrain mrgrain added the effort/small Small work item – less than a day of effort label Aug 17, 2022
josephedward pushed a commit to josephedward/aws-cdk that referenced this pull request Aug 30, 2022
closes aws#20983

ComputeEnvironments have embedded security groups in them.  These are currently difficult to reach and modify in CDK stacks, which forces users into undesirable practices when integrating batch queues with other services such as as EFS filesystems or RDS instances.  Ideally, it should be possible to use compute environments as a target:

```ts
something.connections.allowDefaultPortFrom(computeEnvironment);
```

but this isn't currently possible, so the user may try to work around it by allowing from any IPv4, or by having to use an escape hatch, which is not simple.

This pull request adds ec2.IConnectable to batch.ComputeEnvironment.  It still seems to pass all the existing tests and integration tests, so I don't think it's a breaking change, but I suspect it could be done in a better way than I've done it, to make things even simpler for the user.

----

### All Submissions:

* [yes] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [no] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [yes] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [yes] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-batch): ComputeEnvironment should implement IConnectable
4 participants