Co-authored-by: Kirill Trofimenkov <cgorbit@joom.com>
This commit is contained in:
parent
12a2a6d0e0
commit
0e606ddcb2
1 changed files with 2 additions and 8 deletions
|
@ -20,10 +20,8 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/mitchellh/copystructure"
|
|
||||||
networking "k8s.io/api/networking/v1beta1"
|
networking "k8s.io/api/networking/v1beta1"
|
||||||
"k8s.io/ingress-nginx/internal/ingress"
|
"k8s.io/ingress-nginx/internal/ingress"
|
||||||
"k8s.io/klog/v2"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -73,18 +71,14 @@ func updateServerLocations(locations []*ingress.Location) []*ingress.Location {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy location before any change
|
var el ingress.Location = *location
|
||||||
el, err := copystructure.Copy(location)
|
|
||||||
if err != nil {
|
|
||||||
klog.ErrorS(err, "copying location")
|
|
||||||
}
|
|
||||||
|
|
||||||
// normalize path. Must end in /
|
// normalize path. Must end in /
|
||||||
location.Path = normalizePrefixPath(location.Path)
|
location.Path = normalizePrefixPath(location.Path)
|
||||||
newLocations = append(newLocations, location)
|
newLocations = append(newLocations, location)
|
||||||
|
|
||||||
// add exact location
|
// add exact location
|
||||||
exactLocation := el.(*ingress.Location)
|
exactLocation := &el
|
||||||
exactLocation.PathType = &pathTypeExact
|
exactLocation.PathType = &pathTypeExact
|
||||||
|
|
||||||
newLocations = append(newLocations, exactLocation)
|
newLocations = append(newLocations, exactLocation)
|
||||||
|
|
Loading…
Reference in a new issue