-
Notifications
You must be signed in to change notification settings - Fork 4.2k
feat(ec2): enabling features for ipv6 and dualstack support with corresponding unit tests #33898
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
Conversation
throw new Error('Enable private DNS to set the private DNS only for inbound endpoints'); | ||
} | ||
|
||
if (!props.ipAddressType && props.dnsRecordIpType !== undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can one of these properties be specified without the other, eg. can someone pass props.idAddressType without passing props.dnsRecordIpType , i think yes, and validation makes sense in that case.
Thinking if we can model it together where if props.idAddressType is always required with optional props.dnsRecordIpType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! I think yes, dnsRecordIpType is only required when privateDnsOptions is enabled, but IpAddressType is always required (Pretty sure it defaults to IPv4 but we didn't want to make those assumptions and let CFN handle it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shikha372 good point. We wanted to stay as close to the original VPCE CFN specification as possible.
The CFN spec allows permutations of different values of dnsRecordIpType
and idAddressType
, so maybe it makes sense to just leave it like that and offload the validation to CFN (and we remove our validation as well)? WDYT?
Regarding your suggestion: One way to avoid a situation where dnsRecordIpType
is set and idAddressType
is not could be something like:
ipAddressTypeOptions?: {
ipAddressType: VpcEndpointIpAddressType,
dnsRecordIpType?: VpcEndpointDnsRecordIpType
privateDnsOnlyForInboundResolverEndpoint?: VpcEndpointPrivateDnsOnlyForInboundResolverEndpoint
}
but that bundles ipAddress
and dnsRecord
values under a new ipAddressTypeOptions
name, which seems a bit off
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AlexanderJangAMZN, i would rather flatten out properties than creating them together if it doesn't make sense, i'm okay with the keeping the properties as it is.
For the validation, would rather to do it in CFN as this can become outdated with any change at handler end.
* Checks to see if dnsRecordIpType and ipAddressType are compatible, throw error if not | ||
* @see https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html#connect-to-endpoint-service | ||
*/ | ||
switch (props.dnsRecordIpType) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove these checks altogether and rely on CFN to validate, or if it is very essential to keep we modify these errors to warning instead, because :
- its hard to keep this information updated at CDK end and a invalid check can become blocker for the customers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this was also something we were discussing, we understand that incorrect checks would introduce breaking changes so we tried to limit the checks as much as possible to just the ones listed in this doc, as these seemed "safe" enough to add and good to check here. However, if you think it is unnecessary here, even the slightest chance of causing blockers doesn't seem worth the risk. What would you recommend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding your comment about ipAddressType and dnsRecordIpType being related, I initially created one interface for them both, but they can take in slightly different values so keeping them separate seemed like safer approach. In our case, ipAddressType allows ipv4 | ipv6 | dualstack | not-specified , while dnsRecordIpType allows ipv4 | dualstack | ipv6 | service-defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @AlexanderJangAMZN , i meant it to model like this, where with enum you'll still have different values for ipAddressType
and dnsRecordIpType
, but if you prefer to flatten out that's okay .
ipAddressTypeOptions?: {
ipAddressType: VpcEndpointIpAddressType,
dnsRecordIpType?: VpcEndpointDnsRecordIpType
privateDnsOnlyForInboundResolverEndpoint?: VpcEndpointPrivateDnsOnlyForInboundResolverEndpoint
}
For validation, i would prefer to remove it altogether and rely on CFN handler for validation, if you think its still necessary to notify users, we can use warnings instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @daniilmc , Thank you for contributing this PR and implement this feature request, from the first review of implementation I feel that the two properties ipaddressType and dnsrecordIptype, are related to each other, and there seems to be an opportunity to model it under same props. let me know if you think otherwise.
``
74e45ae
to
d38592d
Compare
Hello @shikha372, we removed all client-side validation, so now we rely on CFN to validate. Could you please have a look? |
...@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.template.json
Outdated
Show resolved
Hide resolved
...testing/framework-integ/test/aws-route53-targets/test/integ.interface-vpc-endpoint-target.ts
Outdated
Show resolved
Hide resolved
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
@shikha372 okay I think we are finally ready for the final review! |
LGTM.. Thank you @AlexanderJangAMZN |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Enabling features for ipv6 and dualstack support with corresponding unit tests
Original PR: #3873
Issue #33493
Closes #33493
Reason for this change
Currently, AWS Services, i.e., Xray, Wafv2, Workmail, have started to release support for IPv6 or Dualstack for their VPC endpoints. We would like to modify our infrastructure to be able to support. these new IP address types.
Description of changes
Added more detailed descriptions and guidlines for usage in the aws-ec2 README.md as well as very detailed comments above each code change.
Description of how you validated changes
Added unit tests and integ tests to cover all valid and invalid cases. Throws necessary errors according to documentation. Detailed descriptions of each case are outlined in comments.
Checklist