Always sort upstream list to provide stable iteration order
This commit is contained in:
parent
0b9eb96ec4
commit
f3e9292c04
2 changed files with 4 additions and 15 deletions
|
@ -572,12 +572,6 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
aUpstreams = append(aUpstreams, upstream)
|
||||
}
|
||||
|
||||
if n.cfg.SortBackends {
|
||||
sort.SliceStable(aUpstreams, func(a, b int) bool {
|
||||
return aUpstreams[a].Name < aUpstreams[b].Name
|
||||
})
|
||||
}
|
||||
|
||||
aServers := make([]*ingress.Server, 0, len(servers))
|
||||
for _, value := range servers {
|
||||
sort.SliceStable(value.Locations, func(i, j int) bool {
|
||||
|
@ -586,6 +580,10 @@ func (n *NGINXController) getBackendServers(ingresses []*extensions.Ingress) ([]
|
|||
aServers = append(aServers, value)
|
||||
}
|
||||
|
||||
sort.SliceStable(aUpstreams, func(a, b int) bool {
|
||||
return aUpstreams[a].Name < aUpstreams[b].Name
|
||||
})
|
||||
|
||||
sort.SliceStable(aServers, func(i, j int) bool {
|
||||
return aServers[i].Hostname < aServers[j].Hostname
|
||||
})
|
||||
|
|
|
@ -129,9 +129,6 @@ func (b1 *Backend) Equal(b2 *Backend) bool {
|
|||
if b1.Service.GetName() != b2.Service.GetName() {
|
||||
return false
|
||||
}
|
||||
if b1.Service.GetResourceVersion() != b2.Service.GetResourceVersion() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if b1.Port != b2.Port {
|
||||
|
@ -326,9 +323,6 @@ func (l1 *Location) Equal(l2 *Location) bool {
|
|||
if l1.Service.GetName() != l2.Service.GetName() {
|
||||
return false
|
||||
}
|
||||
if l1.Service.GetResourceVersion() != l2.Service.GetResourceVersion() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
if l1.Port.StrVal != l2.Port.StrVal {
|
||||
|
@ -424,9 +418,6 @@ func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool {
|
|||
if ptb1.Service.GetName() != ptb2.Service.GetName() {
|
||||
return false
|
||||
}
|
||||
if ptb1.Service.GetResourceVersion() != ptb2.Service.GetResourceVersion() {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue