Skip to content

Commit

Permalink
fix: remove unnecessary service discovery for gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwright committed May 11, 2023
1 parent d7d19d3 commit 4cb6082
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
1 change: 0 additions & 1 deletion lib/appmesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export class AppMeshApp extends App {

const { mesh, gateway } = new AppMesh(stack, "Mesh", {
cluster,
namespace,
securityGroup,
});

Expand Down
29 changes: 2 additions & 27 deletions lib/appmesh/mesh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ import {
VirtualGateway,
VirtualGatewayListener,
} from "aws-cdk-lib/aws-appmesh";
import {
IConnectable,
ISecurityGroup,
Peer,
Port,
SecurityGroup,
} from "aws-cdk-lib/aws-ec2";
import { ISecurityGroup, Peer, Port } from "aws-cdk-lib/aws-ec2";
import {
Cluster,
ContainerImage,
Expand All @@ -24,16 +18,10 @@ import {
} from "aws-cdk-lib/aws-ecs";
import { NetworkLoadBalancedFargateService } from "aws-cdk-lib/aws-ecs-patterns";
import { Effect, PolicyStatement } from "aws-cdk-lib/aws-iam";
import {
DnsRecordType,
IHttpNamespace,
Service,
} from "aws-cdk-lib/aws-servicediscovery";
import { Construct } from "constructs";

interface Props extends StackProps {
cluster: Cluster;
namespace: IHttpNamespace;
securityGroup: ISecurityGroup;
}

Expand All @@ -43,7 +31,7 @@ export class AppMesh extends Construct {
constructor(scope: Construct, id: string, props: Props) {
super(scope, id);

const { cluster, namespace, securityGroup } = props;
const { cluster, securityGroup } = props;

const mesh = new Mesh(this, "Mesh", {
egressFilter: MeshFilterType.DROP_ALL,
Expand Down Expand Up @@ -127,18 +115,5 @@ export class AppMesh extends Construct {
Peer.ipv4(cluster.vpc.vpcCidrBlock),
Port.allTcp()
);

const cloudMapService = new Service(this, "ServiceDiscovery", {
name: "gateway",
namespace,
dnsRecordType: DnsRecordType.A,
customHealthCheck: {
failureThreshold: 1,
},
});

gatewayService.service.associateCloudMapService({
service: cloudMapService,
});
}
}
1 change: 0 additions & 1 deletion lib/bluegreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class BlueGreenApp extends Construct {

const { mesh, gateway } = new AppMesh(stack, "Mesh", {
cluster,
namespace,
securityGroup,
});

Expand Down

0 comments on commit 4cb6082

Please sign in to comment.