Skip to content

Commit 4f60293

Browse files
authored
fix(ecs): remove accidental duplication of cloudmap namespaces with service connect (#25891)
This PR should fix #25616, where service connect accidentally creates a duplicate HTTP namespace when a customer sets a service connect default namespace on the cluster. Closes #25616 However, I think that a broader fix for this issue should include deprecation of the `namespace` parameter in `ServiceConnectProps` in favor of a `cloudmapNamespace: INamespace` parameter; that way, we can force resolution by ARN under the hood of the construct and never trigger the namespace duplication behavior. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 7a6758d commit 4f60293

File tree

12 files changed

+2024
-157
lines changed

12 files changed

+2024
-157
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.assets.json

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,28 @@
11
{
2-
"version": "21.0.0",
2+
"version": "32.0.0",
33
"files": {
4-
"21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": {
4+
"36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4": {
5+
"source": {
6+
"path": "asset.36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.bundle",
7+
"packaging": "zip"
8+
},
9+
"destinations": {
10+
"current_account-current_region": {
11+
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12+
"objectKey": "36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.zip",
13+
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
14+
}
15+
}
16+
},
17+
"d1bb9f9c141c0b0bba4f15ebed577c22d74718e011b71b5d9c262b81d5257cc9": {
518
"source": {
619
"path": "ServiceConnectDefaultTestDeployAssert88F6A66F.template.json",
720
"packaging": "file"
821
},
922
"destinations": {
1023
"current_account-current_region": {
1124
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json",
25+
"objectKey": "d1bb9f9c141c0b0bba4f15ebed577c22d74718e011b71b5d9c262b81d5257cc9.json",
1326
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1427
}
1528
}

packages/@aws-cdk-testing/framework-integ/test/aws-ecs/test/fargate/integ.service-connect.js.snapshot/ServiceConnectDefaultTestDeployAssert88F6A66F.template.json

+100
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,104 @@
11
{
2+
"Resources": {
3+
"AwsApiCallServiceDiscoverylistNamespaces": {
4+
"Type": "Custom::DeployAssert@SdkCallServiceDiscoverylistNamespaces",
5+
"Properties": {
6+
"ServiceToken": {
7+
"Fn::GetAtt": [
8+
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F",
9+
"Arn"
10+
]
11+
},
12+
"service": "ServiceDiscovery",
13+
"api": "listNamespaces",
14+
"expected": "{\"$ObjectLike\":{\"Namespaces\":{\"$ArrayWith\":[{\"$ObjectLike\":{\"Name\":\"whistler.com\",\"Type\":\"HTTP\"}}]}}}",
15+
"flattenResponse": "false",
16+
"salt": "1686165472436"
17+
},
18+
"UpdateReplacePolicy": "Delete",
19+
"DeletionPolicy": "Delete"
20+
},
21+
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": {
22+
"Type": "AWS::IAM::Role",
23+
"Properties": {
24+
"AssumeRolePolicyDocument": {
25+
"Version": "2012-10-17",
26+
"Statement": [
27+
{
28+
"Action": "sts:AssumeRole",
29+
"Effect": "Allow",
30+
"Principal": {
31+
"Service": "lambda.amazonaws.com"
32+
}
33+
}
34+
]
35+
},
36+
"ManagedPolicyArns": [
37+
{
38+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
39+
}
40+
],
41+
"Policies": [
42+
{
43+
"PolicyName": "Inline",
44+
"PolicyDocument": {
45+
"Version": "2012-10-17",
46+
"Statement": [
47+
{
48+
"Action": [
49+
"servicediscovery:ListNamespaces"
50+
],
51+
"Effect": "Allow",
52+
"Resource": [
53+
"*"
54+
]
55+
},
56+
{
57+
"Effect": "Allow",
58+
"Action": [
59+
"servicediscovery:ListNamespaces"
60+
],
61+
"Resource": [
62+
"*"
63+
]
64+
}
65+
]
66+
}
67+
}
68+
]
69+
}
70+
},
71+
"SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": {
72+
"Type": "AWS::Lambda::Function",
73+
"Properties": {
74+
"Runtime": "nodejs14.x",
75+
"Code": {
76+
"S3Bucket": {
77+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
78+
},
79+
"S3Key": "36618132bd37b6b15f9987b57ad1fbf613f1ad937aec72381232b163ed9c44c4.zip"
80+
},
81+
"Timeout": 120,
82+
"Handler": "index.handler",
83+
"Role": {
84+
"Fn::GetAtt": [
85+
"SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73",
86+
"Arn"
87+
]
88+
}
89+
}
90+
}
91+
},
92+
"Outputs": {
93+
"AssertionResultsAwsApiCallServiceDiscoverylistNamespaces": {
94+
"Value": {
95+
"Fn::GetAtt": [
96+
"AwsApiCallServiceDiscoverylistNamespaces",
97+
"assertion"
98+
]
99+
}
100+
}
101+
},
2102
"Parameters": {
3103
"BootstrapVersion": {
4104
"Type": "AWS::SSM::Parameter::Value<String>",

0 commit comments

Comments
 (0)