Remove flag sort-backends
This commit is contained in:
parent
61bca89d13
commit
3483eb375e
2 changed files with 3 additions and 27 deletions
|
|
@ -18,7 +18,6 @@ package controller
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -79,8 +78,6 @@ type Configuration struct {
|
|||
ElectionID string
|
||||
UpdateStatusOnShutdown bool
|
||||
|
||||
SortBackends bool
|
||||
|
||||
ListenPorts *ngx_config.ListenPorts
|
||||
|
||||
EnableSSLPassthrough bool
|
||||
|
|
@ -845,17 +842,6 @@ func (n *NGINXController) serviceEndpoints(svcKey, backendPort string) ([]ingres
|
|||
klog.Warningf("Service %q does not have any active Endpoint.", svcKey)
|
||||
}
|
||||
|
||||
if n.cfg.SortBackends {
|
||||
sort.SliceStable(endps, func(i, j int) bool {
|
||||
iName := endps[i].Address
|
||||
jName := endps[j].Address
|
||||
if iName != jName {
|
||||
return iName < jName
|
||||
}
|
||||
|
||||
return endps[i].Port < endps[j].Port
|
||||
})
|
||||
}
|
||||
upstreams = append(upstreams, endps...)
|
||||
break
|
||||
}
|
||||
|
|
@ -884,14 +870,6 @@ func (n *NGINXController) serviceEndpoints(svcKey, backendPort string) ([]ingres
|
|||
return upstreams, nil
|
||||
}
|
||||
|
||||
if !n.cfg.SortBackends {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
for i := range upstreams {
|
||||
j := rand.Intn(i + 1)
|
||||
upstreams[i], upstreams[j] = upstreams[j], upstreams[i]
|
||||
}
|
||||
}
|
||||
|
||||
return upstreams, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue