You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(appmesh): Move Client Policy from Virtual Service to backend structure (#12943)
@sshver:
> Client Policies are inherently not related to the Virtual Service. It should be thought of as the client (the VN) telling envoy what connections they want to allow to the server (the Virtual Service). The server shouldn't be the one to define what policies are used to enforce connections with itself.
## Description of changes
I refactored the client policy from Virtual Service to a separate backend structure. This mirrors how our API is designed. Also ran `npm run lint -- --fix` and removed some comments to fix lint warnings.
```ts
/* Old backend defaults */
backendsDefaultClientPolicy: appmesh.ClientPolicy.fileTrust({
certificateChain: 'path-to-certificate',
}),
/* result of this PR */
backendDefaults: {
clientPolicy: appmesh.ClientPolicy.fileTrust({
certificateChain: 'path-to-certificate',
}),
},
```
```ts
/* Old Virtual Service with client policy */
const service1 = new appmesh.VirtualService(stack, 'service-1', {
virtualServiceName: 'service1.domain.local',
virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh),
clientPolicy: appmesh.ClientPolicy.fileTrust({
certificateChain: 'path-to-certificate',
ports: [8080, 8081],
}),
});
/* result of this PR; client policy is defined in the Virtual Node */
const service1 = new appmesh.VirtualService(stack, 'service-1', {
virtualServiceName: 'service1.domain.local',
virtualServiceProvider: appmesh.VirtualServiceProvider.none(mesh),
});
const node = new appmesh.VirtualNode(stack, 'test-node', {
mesh,
serviceDiscovery: appmesh.ServiceDiscovery.dns('test'),
});
node.addBackend({
virtualService: service1,
clientPolicy: appmesh.ClientPolicy.fileTrust({
certificateChain: 'path-to-certificate',
ports: [8080, 8081],
}),
});
```
BREAKING CHANGE: Backend, backend default and Virtual Service client policies structures are being altered
* **appmesh**: you must use the backend default interface to define backend defaults in `VirtualGateway`.
The property name also changed from `backendsDefaultClientPolicy` to `backendDefaults`
* **appmesh**: you must use the backend default interface to define backend defaults in `VirtualNode`,
(the property name also changed from `backendsDefaultClientPolicy` to `backendDefaults`),
and the `Backend` class to define a backend
* **appmesh**: you can no longer attach a client policy to a `VirtualService`
Resolves#11996
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
The `listeners` property can be left blank and added later with the `node.addListener()` method. The `healthcheck` and `timeout` properties are optional but if specifying a listener, the `port` must be added.
237
239
238
240
The `backends` property can be added with `node.addBackend()`. We define a virtual service and add it to the virtual node to allow egress traffic to other node.
239
241
240
-
The `backendsDefaultClientPolicy` property are added to the node while creating the virtual node. These are virtual node's service backends client policy defaults.
242
+
The `backendDefaults` property are added to the node while creating the virtual node. These are virtual node's default settings for all backends.
The listeners field can be omitted which will default to an HTTP Listener on port 8080.
465
469
A gateway route can be added using the `gateway.addGatewayRoute()` method.
466
470
467
-
The `backendsDefaultClientPolicy` property are added to the node while creating the virtual gateway. These are virtual gateway's service backends client policy defaults.
471
+
The `backendDefaults` property is added to the node while creating the virtual gateway. These are virtual gateway's default settings for all backends.
0 commit comments