Skip to content

Commit dd72cb4

Browse files
committed
add fixmes
1 parent 58912f5 commit dd72cb4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

internal/controller/state/graph/policies.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ func checkForRouteOverlap(route *L7Route, hostPortPaths map[string]string) *cond
457457
for _, parentRef := range route.ParentRefs {
458458
if parentRef.Attachment != nil {
459459
port := parentRef.Attachment.ListenerPort
460+
// FIXME(sarthyparty): https://github.com/nginx/nginx-gateway-fabric/issues/3812
461+
// Need to merge listener hostnames with route hostnames so wildcards are handled correctly
462+
// Also the AcceptedHostnames is a map of slices of strings, so we need to flatten it
460463
for _, hostname := range parentRef.Attachment.AcceptedHostnames {
461464
for _, rule := range route.Spec.Rules {
462465
for _, match := range rule.Matches {

internal/controller/state/graph/route_common.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ type ParentRefAttachmentStatus struct {
4646
// still attach. The backendRef condition would be displayed here.
4747
FailedConditions []conditions.Condition
4848
// ListenerPort is the port on the Listener that the Route is attached to.
49+
// FIXME(sarthyparty): https://github.com/nginx/nginx-gateway-fabric/issues/3813
50+
// Needs to be a map of <gatewayNamespacedName/listenerName> to port number
4951
ListenerPort v1.PortNumber
5052
// Attached indicates if the ParentRef is attached to the Gateway.
5153
Attached bool
@@ -308,7 +310,8 @@ func buildSectionNameRefs(
308310
}
309311

310312
// If there is no section name, handle based on whether port is specified
311-
// FIXME(sarthyparty): this logic seems to be duplicated in findAttachableListeners so we should refactor this,
313+
// FIXME(sarthyparty): https://github.com/nginx/nginx-gateway-fabric/issues/3811
314+
// this logic seems to be duplicated in findAttachableListeners so we should refactor this,
312315
// either here or in findAttachableListeners
313316
if p.SectionName == nil {
314317
// If port is specified, preserve the port-only nature for proper validation
@@ -335,7 +338,6 @@ func buildSectionNameRefs(
335338
Idx: i,
336339
Gateway: CreateParentRefGateway(gw),
337340
SectionName: &l.Source.Name,
338-
Port: nil,
339341
})
340342
}
341343
}
@@ -884,9 +886,11 @@ func findAttachableListeners(ref *ParentRef, listeners []*Listener) ([]*Listener
884886
if l.Attachable && (ref.Port == nil || l.Source.Port == *ref.Port) {
885887
return []*Listener{l}, true
886888
}
889+
// We return false because we didn't find a listener that matches the port
887890
if ref.Port != nil && l.Source.Port != *ref.Port {
888891
return nil, false
889892
}
893+
// Return true because we found a listener that matches the sectionName and port but is not attachable
890894
return nil, true
891895
}
892896
}

0 commit comments

Comments
 (0)