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(appmesh): ipv6 support for app mesh #20766

Merged
merged 8 commits into from
Jun 28, 2022
Merged

feat(appmesh): ipv6 support for app mesh #20766

merged 8 commits into from
Jun 28, 2022

Conversation

AKBarcenas
Copy link
Contributor

@AKBarcenas AKBarcenas commented Jun 16, 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:

Adding new Unconventional Dependencies:

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

New Features

  • [Y] Have you added the new feature to an integration test?
    • [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

@gitpod-io
Copy link

gitpod-io bot commented Jun 16, 2022

@aws-cdk-automation aws-cdk-automation requested a review from a team June 16, 2022 16:46
@github-actions github-actions bot added the p2 label Jun 16, 2022
Copy link
Contributor

@comcalvi comcalvi left a comment

Choose a reason for hiding this comment

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

Please update this PR's description to describe the feature you're adding and give a high-level overview of how it works.

Copy link
Contributor

@comcalvi comcalvi 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 a really strong start. Nice work!

/**
* IP preference applied to all Virtual Nodes in the Mesh
*
* @default No IP preference is applied to Virtual Nodes
Copy link
Contributor

Choose a reason for hiding this comment

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

lines 64-67 should be moved here.

Suggested change
* @default No IP preference is applied to Virtual Nodes
* @default - No IP preference is applied to Virtual Nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've gone ahead and consolidated everything. Let me know if there is further feedback on this.

@@ -29,7 +34,7 @@ const virtualService = new appmesh.VirtualService(stack, 'service', {
});

const node = mesh.addVirtualNode('node', {
serviceDiscovery: appmesh.ServiceDiscovery.dns(`node1.${namespace.namespaceName}`),
serviceDiscovery: appmesh.ServiceDiscovery.dns(`node1.${namespace.namespaceName}`, undefined, appmesh.IpPreference.IPV4_ONLY),
Copy link
Contributor

Choose a reason for hiding this comment

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

how does the IP preference of the serviceDiscovery in this node interact with the ip preference of the serviceDiscovery set on lines 21-23? Does one overwrite the other? Is this allowed? This behavior should be documented in the comment block of the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two resource levels we allowing setting this preference as you point out. A Mesh is the top level resource which users will be creating Virtual Nodes within. A Mesh preference will apply to all Virtual Nodes as a default value and each individual Virtual Node can set its own preference to override the Mesh preference. If there is no preference set anywhere then no default preference is applied.

@mergify mergify bot dismissed comcalvi’s stale review June 18, 2022 02:46

Pull request has been modified.

@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. labels Jun 22, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 28, 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: cc3f035
  • 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 b1e6d62 into aws:main Jun 28, 2022
@mergify
Copy link
Contributor

mergify bot commented Jun 28, 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).

daschaa pushed a commit to daschaa/aws-cdk that referenced this pull request 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
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-appmesh: Add IPv6 support
4 participants