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

Initial VPC Validations for CDK #533

Merged
merged 12 commits into from
Mar 21, 2024

Conversation

lewijacn
Copy link
Collaborator

@lewijacn lewijacn commented Mar 6, 2024

Description

The goal of this change is to add more visibility, and visibility earlier in a deployment, to a user when a provided or created VPC does not meet the current VPC requirements to work with our solution.

Issues Resolved

https://opensearch.atlassian.net/browse/MIGRATIONS-1496

Testing

Jest tests and cloud deployments

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@lewijacn lewijacn marked this pull request as ready for review March 7, 2024 15:55
lewijacn added 2 commits March 7, 2024 11:45
# Conflicts:
#	deployment/cdk/opensearch-service-migration/lib/network-stack.ts
#	deployment/cdk/opensearch-service-migration/lib/stack-composer.ts
Signed-off-by: Tanner Lewis <[email protected]>
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.31%. Comparing base (01b62dc) to head (65997be).
Report is 33 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #533      +/-   ##
============================================
- Coverage     76.54%   76.31%   -0.24%     
- Complexity     1373     1386      +13     
============================================
  Files           154      154              
  Lines          5930     5986      +56     
  Branches        532      537       +5     
============================================
+ Hits           4539     4568      +29     
- Misses         1038     1054      +16     
- Partials        353      364      +11     
Flag Coverage Δ
unittests 76.31% <ø> (-0.24%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lewijacn added 3 commits March 7, 2024 13:02
Signed-off-by: Tanner Lewis <[email protected]>
Signed-off-by: Tanner Lewis <[email protected]>
Signed-off-by: Tanner Lewis <[email protected]>
Copy link
Collaborator

@gregschohn gregschohn left a comment

Choose a reason for hiding this comment

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

Minor changes would be nice. If it's easy to make sure that we're fairly hitting AZs, that would be nice to be a good citizen.

}
let desiredSubnets
if (uniqueAzPrivateSubnets.length >= azCount) {
desiredSubnets = uniqueAzPrivateSubnets.slice(0, azCount)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Will this list be randomized? Would every customer get the same AZs back if they were setup in say the same 5 AZs?

Copy link
Member

Choose a reason for hiding this comment

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

I'm all for making our code deterministic. The AZ mappings (us-east-1a.. etc.) are randomized by aws account.

Copy link
Collaborator Author

@lewijacn lewijacn Mar 20, 2024

Choose a reason for hiding this comment

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

They should get back the same subnets, but from reading this issue, there isn't a firm guarantee. I've added a sort here to give some confidence when the same subnets are used, but if say some subnets are added to the VPC later I believe both cases could potentially cause issues, and maybe this is something we are okay with calling out as a VPC limitation. I'm not aware of a better way to handle this outside of storing state about the subnets ourselves somewhere but that presents other issues.

Copy link
Member

Choose a reason for hiding this comment

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

See comment I made about the sort

}
let desiredSubnets
if (uniqueAzPrivateSubnets.length >= azCount) {
desiredSubnets = uniqueAzPrivateSubnets.slice(0, azCount).sort()
Copy link
Member

Choose a reason for hiding this comment

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

I think we need to sort before slicing here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed, adjusted

Signed-off-by: Tanner Lewis <[email protected]>
@lewijacn lewijacn merged commit 3a3f0ab into opensearch-project:main Mar 21, 2024
7 of 8 checks passed
@lewijacn lewijacn deleted the vpc-validations-cdk branch March 29, 2024 17:15
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.

3 participants