Skip to content

Commit

Permalink
UniqueHost: Fix incorrect identification of conflicting route
Browse files Browse the repository at this point in the history
When a route is rejected due to the host already being claimed, the
incorrect route was being identified as the conflicting one. The
problem was that the first route in the array was always being
returned as the conflicting route, instead of the actual conflicting
one.

This fix addresses the issue by returning the last route in the slice,
which corresponds to the correct conflicting route. This ensures that
the "HostAlreadyClaimed" error properly identifies the correct
conflicting route, taking into account both host and path.

Fixes: https://issues.redhat.com/browse/OCPBUGS-16707
  • Loading branch information
frobware committed Aug 22, 2023
1 parent 80e2d99 commit 3abac27
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/router/controller/unique_host.go
Expand Up @@ -179,7 +179,7 @@ func (p *UniqueHost) HandleRoute(eventType watch.EventType, route *routev1.Route
// we were not added because another route is covering us
var owner *routev1.Route
if old, ok := p.index.RoutesForHost(host); ok && len(old) > 0 {
owner = old[0]
owner = old[len(old)-1]
} else {
owner = &routev1.Route{}
owner.Name = "<unknown>"
Expand Down

0 comments on commit 3abac27

Please sign in to comment.