johannes-engler-mw commented on code in PR #2703:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/2703#discussion_r2910305077


##########
internal/controller/utils.go:
##########
@@ -1168,6 +1179,23 @@ func isListenerHostnameEffective(listener 
gatewayv1.Listener) bool {
                listener.Protocol == gatewayv1.TLSProtocolType
 }
 
+// appendUniqueListeners appends listeners to the target slice, skipping any
+// listener whose Name already exists in the target. Listener names are unique
+// within a Gateway per the Gateway API specification.
+func appendUniqueListeners(target []gatewayv1.Listener, source 
...gatewayv1.Listener) []gatewayv1.Listener {
+       seen := make(map[gatewayv1.SectionName]struct{}, len(target))
+       for _, l := range target {
+               seen[l.Name] = struct{}{}
+       }
+       for _, l := range source {
+               if _, exists := seen[l.Name]; !exists {
+                       seen[l.Name] = struct{}{}
+                       target = append(target, l)
+               }
+       }
+       return target

Review Comment:
   Implemented



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to