Skip to content

Commit 54bbab4

Browse files
committed
fix bug with route attachment, it should use route namespace NOT gateway namespace
1 parent 139eb9b commit 54bbab4

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package routeutils

pkg/gateway/routeutils/route_attachment_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (rah *routeAttachmentHelperImpl) doesRouteAttachToGateway(gw gwv1.Gateway,
3838
if parentRef.Namespace != nil {
3939
namespaceToCompare = string(*parentRef.Namespace)
4040
} else {
41-
namespaceToCompare = gw.Namespace
41+
namespaceToCompare = route.GetRouteNamespacedName().Namespace
4242
}
4343

4444
nameCheck := string(parentRef.Name) == gw.Name

pkg/gateway/routeutils/route_attachment_helper_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ func Test_doesRouteAttachToGateway(t *testing.T) {
2626
},
2727
},
2828
route: convertHTTPRoute(gwv1.HTTPRoute{
29+
ObjectMeta: metav1.ObjectMeta{
30+
Name: "route",
31+
Namespace: "ns1",
32+
},
2933
Spec: gwv1.HTTPRouteSpec{
3034
CommonRouteSpec: gwv1.CommonRouteSpec{
3135
ParentRefs: []gwv1.ParentReference{
@@ -47,6 +51,10 @@ func Test_doesRouteAttachToGateway(t *testing.T) {
4751
},
4852
},
4953
route: convertHTTPRoute(gwv1.HTTPRoute{
54+
ObjectMeta: metav1.ObjectMeta{
55+
Name: "route",
56+
Namespace: "ns1",
57+
},
5058
Spec: gwv1.HTTPRouteSpec{
5159
CommonRouteSpec: gwv1.CommonRouteSpec{
5260
ParentRefs: []gwv1.ParentReference{

0 commit comments

Comments
 (0)