Skip to content

Commit 76c60fd

Browse files
author
Thomas Eckert
authored
Golden File Tests for TermGW w/ Cluster Peering (#19096)
Add intention to create golden file for terminating gateway peered trust bundle
1 parent c2a0d4f commit 76c60fd

File tree

2 files changed

+30
-5
lines changed

2 files changed

+30
-5
lines changed

agent/xds/listeners_test.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -1093,12 +1093,12 @@ func TestListenersFromSnapshot(t *testing.T) {
10931093
Bundles: []*pbpeering.PeeringTrustBundle{
10941094
{
10951095
TrustDomain: "foo.bar.gov",
1096-
PeerName: "dc1",
1096+
PeerName: "dc2",
10971097
Partition: "default",
10981098
RootPEMs: []string{
10991099
roots.Roots[0].RootCert,
11001100
},
1101-
ExportedPartition: "dc1",
1101+
ExportedPartition: "default",
11021102
CreateIndex: 0,
11031103
ModifyIndex: 0,
11041104
},
@@ -1109,8 +1109,11 @@ func TestListenersFromSnapshot(t *testing.T) {
11091109
CorrelationID: "service-intentions:web",
11101110
Result: structs.SimplifiedIntentions{
11111111
{
1112-
SourceName: "*",
1113-
DestinationName: "web",
1112+
SourceName: "source",
1113+
SourcePeer: "dc2",
1114+
DestinationName: "web",
1115+
DestinationPartition: "default",
1116+
Action: structs.IntentionActionAllow,
11141117
},
11151118
},
11161119
},

agent/xds/testdata/listeners/terminating-gateway-with-peer-trust-bundle.latest.golden

+23-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,29 @@
171171
"name": "envoy.filters.network.rbac",
172172
"typedConfig": {
173173
"@type": "type.googleapis.com/envoy.extensions.filters.network.rbac.v3.RBAC",
174-
"rules": {},
174+
"rules": {
175+
"policies": {
176+
"consul-intentions-layer4": {
177+
"permissions": [
178+
{
179+
"any": true
180+
}
181+
],
182+
"principals": [
183+
{
184+
"authenticated": {
185+
"principalName": {
186+
"safeRegex": {
187+
"googleRe2": {},
188+
"regex": "^spiffe://foo.bar.gov/ns/default/dc/[^/]+/svc/source$"
189+
}
190+
}
191+
}
192+
}
193+
]
194+
}
195+
}
196+
},
175197
"statPrefix": "connect_authz"
176198
}
177199
},

0 commit comments

Comments
 (0)