@@ -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