Skip to content

Commit

Permalink
BUG/MINOR: prevents clash on custom routes names to avoid unecessary …
Browse files Browse the repository at this point in the history
…restarts
  • Loading branch information
fabianonunes committed Sep 2, 2023
1 parent 6d18884 commit ecd6505
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pkg/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package ingress

import (
"fmt"
"path/filepath"

"github.com/haproxytech/kubernetes-ingress/pkg/annotations"
Expand Down Expand Up @@ -112,8 +113,9 @@ func (i *Ingress) handlePath(k store.K8s, h haproxy.HAProxy, host string, path *

routeACLAnn := a.String("route-acl", svc.GetResource().Annotations)
if routeACLAnn == "" {
if _, ok := route.CustomRoutes[backendName]; ok {
delete(route.CustomRoutes, backendName)
customRouteID := fmt.Sprintf("%s-%s", host, backendName)
if _, ok := route.CustomRoutes[customRouteID]; ok {
delete(route.CustomRoutes, customRouteID)
logger.Debugf("Custom Route to backend '%s' deleted, reload required", backendName)
routeReload = true
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/route/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ func AddCustomRoute(route Route, routeACLAnn string, api api.HAProxyClient) (rel
return
}
}
if acl := CustomRoutes[route.BackendName]; acl != routeCond {
CustomRoutes[route.BackendName] = routeCond
customRouteID := fmt.Sprintf("%s-%s", route.Host, route.BackendName)
if acl := CustomRoutes[customRouteID]; acl != routeCond {
CustomRoutes[customRouteID] = routeCond
reload = true
logger.Debugf("Custom Route to backend '%s' added, reload required", route.BackendName)
}
Expand Down

0 comments on commit ecd6505

Please sign in to comment.