Skip to content

Commit b4ee102

Browse files
committed
updates based on reviews
1 parent bb64a68 commit b4ee102

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

internal/mode/static/state/graph/route_common.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,12 @@ func isolateHostnamesForParentRefs(parentRef []ParentRef, listenerHostnameMap ma
420420
continue
421421
}
422422

423-
// for L4Routes, we only compare the hostname and listener name combination
424-
// because we do not allow l4Routes to attach to the same listener
425-
// if they share the same port and hostname.
423+
// for L7Routes, we compare the hostname, port and listener name combination
424+
// to identify if hostname needs to be isolated.
426425
if h == lHostPort.hostname && listenerName != lName {
426+
// for L4Routes, we only compare the hostname and listener name combination
427+
// because we do not allow l4Routes to attach to the same listener
428+
// if they share the same port and hostname.
427429
if isL4Route || lHostPort.port == ref.Attachment.ListenerPort {
428430
hostnamesToRemoves[h] = struct{}{}
429431
}

internal/mode/static/state/graph/route_common_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,35 +2301,35 @@ func TestIsolateL4Listeners(t *testing.T) {
23012301
routesHostnameIntersection := []*L4Route{
23022302
createL4RoutewithAcceptedHostnames(
23032303
tr1, acceptedHostnamesEmptyHostname,
2304-
[]gatewayv1.Hostname{"bar.com"},
2304+
routeHostnames,
23052305
helpers.GetPointer[gatewayv1.SectionName]("empty-hostname"),
23062306
80,
23072307
),
23082308
createL4RoutewithAcceptedHostnames(
23092309
tr2,
23102310
acceptedHostnamesWildcardExample,
2311-
[]gatewayv1.Hostname{"*.example.com"},
2311+
routeHostnames,
23122312
helpers.GetPointer[gatewayv1.SectionName]("wildcard-example-com"),
23132313
80,
23142314
),
23152315
createL4RoutewithAcceptedHostnames(
23162316
tr3,
23172317
acceptedHostnamesFooWildcardExample,
2318-
[]gatewayv1.Hostname{"*.foo.example.com"},
2318+
routeHostnames,
23192319
helpers.GetPointer[gatewayv1.SectionName]("foo-wildcard-example-com"),
23202320
80,
23212321
),
23222322
createL4RoutewithAcceptedHostnames(
23232323
tr4,
23242324
acceptedHostnamesAbcCom,
2325-
[]gatewayv1.Hostname{"abc.foo.example.com"},
2325+
routeHostnames,
23262326
helpers.GetPointer[gatewayv1.SectionName]("abc-com"),
23272327
80,
23282328
),
23292329
createL4RoutewithAcceptedHostnames(
23302330
tr5,
23312331
acceptedHostnamesNoMatch,
2332-
[]gatewayv1.Hostname{"cafe.example.com"},
2332+
routeHostnames,
23332333
helpers.GetPointer[gatewayv1.SectionName]("no-match"),
23342334
80,
23352335
),
@@ -2462,21 +2462,21 @@ func TestIsolateL4Listeners(t *testing.T) {
24622462
createL4RoutewithAcceptedHostnames(
24632463
tlsCoffeeRoute,
24642464
acceptedHostnamesNoSectionName,
2465-
[]gatewayv1.Hostname{"coffee.example.com"},
2465+
routeHostnameNoSectionName,
24662466
nil, // no section name
24672467
443,
24682468
),
24692469
createL4RoutewithAcceptedHostnames(
24702470
tlsTeaRoute,
24712471
acceptedHostnamesNoSectionName,
2472-
[]gatewayv1.Hostname{"tea.example.com"},
2472+
routeHostnameNoSectionName,
24732473
nil, // no section name
24742474
443,
24752475
),
24762476
createL4RoutewithAcceptedHostnames(
24772477
tlsFlavorRoute,
24782478
acceptedHostnamesNoSectionName,
2479-
[]gatewayv1.Hostname{"flavor.example.com"},
2479+
routeHostnameNoSectionName,
24802480
nil, // no section name
24812481
443,
24822482
),
@@ -2677,35 +2677,35 @@ func TestIsolateL7Listeners(t *testing.T) {
26772677
createL7RoutewithAcceptedHostnames(
26782678
hr1,
26792679
acceptedHostnamesEmptyHostname,
2680-
[]gatewayv1.Hostname{""},
2680+
routeHostnames,
26812681
helpers.GetPointer[gatewayv1.SectionName]("empty-hostname"),
26822682
80,
26832683
),
26842684
createL7RoutewithAcceptedHostnames(
26852685
hr2,
26862686
acceptedHostnamesWildcardExample,
2687-
[]gatewayv1.Hostname{"*.example.com"},
2687+
routeHostnames,
26882688
helpers.GetPointer[gatewayv1.SectionName]("wildcard-example-com"),
26892689
80,
26902690
),
26912691
createL7RoutewithAcceptedHostnames(
26922692
hr3,
26932693
acceptedHostnamesFooWildcardExample,
2694-
[]gatewayv1.Hostname{"*.foo.example.com"},
2694+
routeHostnames,
26952695
helpers.GetPointer[gatewayv1.SectionName]("foo-wildcard-example-com"),
26962696
80,
26972697
),
26982698
createL7RoutewithAcceptedHostnames(
26992699
hr4,
27002700
acceptedHostnamesAbcCom,
2701-
[]gatewayv1.Hostname{"abc.foo.example.com"},
2701+
routeHostnames,
27022702
helpers.GetPointer[gatewayv1.SectionName]("abc-com"),
27032703
80,
27042704
),
27052705
createL7RoutewithAcceptedHostnames(
27062706
hr5,
27072707
acceptedHostnamesNoMatch,
2708-
[]gatewayv1.Hostname{"cafe.example.com"},
2708+
routeHostnames,
27092709
helpers.GetPointer[gatewayv1.SectionName]("no-match"),
27102710
80,
27112711
),
@@ -2884,21 +2884,21 @@ func TestIsolateL7Listeners(t *testing.T) {
28842884
createL7RoutewithAcceptedHostnames(
28852885
hrCoffeeRoute,
28862886
acceptedHostnamesNoSectionName,
2887-
[]gatewayv1.Hostname{"coffee.example.com"},
2887+
routeHostnameNoSectionName,
28882888
nil, // no section name
28892889
80,
28902890
),
28912891
createL7RoutewithAcceptedHostnames(
28922892
hrTeaRoute,
28932893
acceptedHostnamesNoSectionName,
2894-
[]gatewayv1.Hostname{"tea.example.com"},
2894+
routeHostnameNoSectionName,
28952895
nil, // no section name
28962896
80,
28972897
),
28982898
createL7RoutewithAcceptedHostnames(
28992899
hrFlavorRoute,
29002900
acceptedHostnamesNoSectionName,
2901-
[]gatewayv1.Hostname{"flavor.example.com"},
2901+
routeHostnameNoSectionName,
29022902
nil, // no section name
29032903
80,
29042904
),

0 commit comments

Comments
 (0)