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

aws-appmesh: Add IPv6 support #20737

Closed
1 of 2 tasks
AKBarcenas opened this issue Jun 14, 2022 · 2 comments · Fixed by #20766
Closed
1 of 2 tasks

aws-appmesh: Add IPv6 support #20737

AKBarcenas opened this issue Jun 14, 2022 · 2 comments · Fixed by #20766
Assignees
Labels
@aws-cdk/aws-appmesh Related to AWS App Mesh effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2

Comments

@AKBarcenas
Copy link
Contributor

AKBarcenas commented Jun 14, 2022

Describe the feature

AWS App Mesh has released support for IPv6 and new fields have been exposed on the APIs as part of this release.

https://aws.amazon.com/about-aws/whats-new/2022/05/aws-app-mesh-supports-ipv6/
aws/aws-app-mesh-roadmap#314

The proposal here is to add support for App Mesh's newly added IPv6 capabilities.

Use Case

Without this feature, CDK users will be unable to configure IPv6 within App Mesh.

Proposed Solution

The primary changes will be to add an IP preference that covers all of the preference types supported in App Mesh and to expose the new fields where this IP preference can be applied within the mesh and virtual node resources.

Mesh

new appmesh.Mesh(stack, 'mesh', {
  meshName: 'mesh',
  meshServiceDiscovery: {
    ipPreference: appmesh.IpPreference.IPV4_PREFERRED
  },
});

Virtual Node

declare const mesh: appmesh.Mesh;

const vpc = new ec2.Vpc(this, 'vpc');
const namespace = new cloudmap.PrivateDnsNamespace(this, 'test-namespace', {
    vpc,
    name: 'domain.local',
});
const service = namespace.createService('service');

/**
 * CloudMap Service Discovery
 */

const cloudNode = mesh.addVirtualNode('virtual-node', {
  serviceDiscovery: appmesh.ServiceDiscovery.cloudMap(service),
  listeners: [appmesh.VirtualNodeListener.http({
    port: 8081,
    healthCheck: appmesh.HealthCheck.http({
      healthyThreshold: 3,
      interval: cdk.Duration.seconds(5),
      path: '/health-check-path',
      timeout: cdk.Duration.seconds(2),
      unhealthyThreshold: 2,
    }),
  })],
  accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
},
appmesh.IpPreference.IPV4_PREFERRED);

/**
 * DNS Service Discovery
 */

const dnsNode = mesh.addVirtualNode('virtual-node', {
  serviceDiscovery: appmesh.ServiceDiscovery.dns(`service`, appmesh.DnsResponseType.ENDPOINTS, appmesh.IpPreference.IPV4_PREFERRED),
  listeners: [appmesh.VirtualNodeListener.http({
    port: 8081,
    healthCheck: appmesh.HealthCheck.http({
      healthyThreshold: 3,
      interval: cdk.Duration.seconds(5),
      path: '/health-check-path',
      timeout: cdk.Duration.seconds(2),
      unhealthyThreshold: 2,
    }),
  })],
  accessLog: appmesh.AccessLog.fromFilePath('/dev/stdout'),
});

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.28.0

Environment details (OS name and version, etc.)

macOS Catalina, Version 10.15.7 (19H1824)

@AKBarcenas AKBarcenas added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jun 14, 2022
@github-actions github-actions bot added the @aws-cdk/aws-appmesh Related to AWS App Mesh label Jun 14, 2022
@peterwoodworth
Copy link
Contributor

Does CloudFormation provide support for this yet @AKBarcenas? I can't find any references to the new feature in the docs or the Cfn changelog.

CDK will need CFN support first before we can implement this

@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. and removed needs-triage This issue or PR still needs to be triaged. labels Jun 16, 2022
@peterwoodworth peterwoodworth added in-progress This issue is being actively worked on. and removed needs-cfn This issue is waiting on changes to CloudFormation before it can be addressed. labels Jun 17, 2022
@mergify mergify bot closed this as completed in #20766 Jun 28, 2022
mergify bot pushed a commit that referenced this issue Jun 28, 2022
App Mesh has released IPv6 support. This has been exposed in the form of IP preferences which have been added to the Mesh and Virtual Node resources. IP preferences are optional for both resources and there is no default IP preference that is applied by App Mesh.

The following are samples of App Mesh resources with IP preferences configured.
```
# Mesh
"spec": {
    "serviceDiscovery": {
        "ipPreference": "IPv6_PREFERRED"
    }
}
```

```
# Virtual Node
"spec": {
    "listeners": [
        {
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 5000,
                "path": "/ping",
                "protocol": "http",
                "timeoutMillis": 2000,
                "unhealthyThreshold": 2
            },
            "portMapping": {
                "port": 9080,
                "protocol": "http"
            }
        }
    ],
    "serviceDiscovery": {
        "dns": {
            "hostname": "colorteller-red.default.svc.cluster.local",
            "ipPreference": "IPv4_ONLY"
        }
    }
}
```

IP preferences on a Mesh apply the preference to all Virtual Nodes contained within that Mesh. IP preferences set on a Virtual Node will only apply to that particular Virtual Node. Additionally, Virtual Node IP preferences will override the Mesh IP preference if there is one present.

There are three areas in which the IP preference impacts how Envoy configuration generation. Firstly, setting any IP preference will change the Envoy's listeners (ingress and egress) to bind to IPv4 and IPv6 allowing the Envoy to serve all traffic from both IP versions. Secondly, the IP version specified in the name of the preference will be the IP version used for sending traffic to the local application for Envoys running as a sidecar to an application. (IPv4_ONLY/PREFERRED - IPv4, IPv6_ONLY/PREFERRED - IPv6) Lastly, it will impact how each service discovery option will be treated. For CloudMap service discovery, ONLY options will only return IPs from CloudMap for the matching version type and PREFERRED options will first used the primary IP version first and fall back to the other IP version for the IPs returned from CloudMap. For DNS service discovery, it will be similar to CloudMap service discovery in terms of only using one IP version or fall back behavior. However, this will come in the form of changing the Envoy's DNS resolver to exhibit this behavior when performing DNS resolution.

This is a summarized version of the feature. For more details, a more thorough write up can be found here: https://github.com/aws/aws-app-mesh-examples/tree/main/walkthroughs/howto-ipv6#ip-preferences-in-meshes-and-virtual-nodes

Closes #20737


### All Submissions:

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

### Adding new Unconventional Dependencies:

* [N] 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

* [Y] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [Y] 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*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

daschaa pushed a commit to daschaa/aws-cdk that referenced this issue Jul 9, 2022
App Mesh has released IPv6 support. This has been exposed in the form of IP preferences which have been added to the Mesh and Virtual Node resources. IP preferences are optional for both resources and there is no default IP preference that is applied by App Mesh.

The following are samples of App Mesh resources with IP preferences configured.
```
# Mesh
"spec": {
    "serviceDiscovery": {
        "ipPreference": "IPv6_PREFERRED"
    }
}
```

```
# Virtual Node
"spec": {
    "listeners": [
        {
            "healthCheck": {
                "healthyThreshold": 2,
                "intervalMillis": 5000,
                "path": "/ping",
                "protocol": "http",
                "timeoutMillis": 2000,
                "unhealthyThreshold": 2
            },
            "portMapping": {
                "port": 9080,
                "protocol": "http"
            }
        }
    ],
    "serviceDiscovery": {
        "dns": {
            "hostname": "colorteller-red.default.svc.cluster.local",
            "ipPreference": "IPv4_ONLY"
        }
    }
}
```

IP preferences on a Mesh apply the preference to all Virtual Nodes contained within that Mesh. IP preferences set on a Virtual Node will only apply to that particular Virtual Node. Additionally, Virtual Node IP preferences will override the Mesh IP preference if there is one present.

There are three areas in which the IP preference impacts how Envoy configuration generation. Firstly, setting any IP preference will change the Envoy's listeners (ingress and egress) to bind to IPv4 and IPv6 allowing the Envoy to serve all traffic from both IP versions. Secondly, the IP version specified in the name of the preference will be the IP version used for sending traffic to the local application for Envoys running as a sidecar to an application. (IPv4_ONLY/PREFERRED - IPv4, IPv6_ONLY/PREFERRED - IPv6) Lastly, it will impact how each service discovery option will be treated. For CloudMap service discovery, ONLY options will only return IPs from CloudMap for the matching version type and PREFERRED options will first used the primary IP version first and fall back to the other IP version for the IPs returned from CloudMap. For DNS service discovery, it will be similar to CloudMap service discovery in terms of only using one IP version or fall back behavior. However, this will come in the form of changing the Envoy's DNS resolver to exhibit this behavior when performing DNS resolution.

This is a summarized version of the feature. For more details, a more thorough write up can be found here: https://github.com/aws/aws-app-mesh-examples/tree/main/walkthroughs/howto-ipv6#ip-preferences-in-meshes-and-virtual-nodes

Closes aws#20737


### All Submissions:

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

### Adding new Unconventional Dependencies:

* [N] 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

* [Y] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [Y] 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
@aws-cdk/aws-appmesh Related to AWS App Mesh effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants