Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove flag sort-backends #3655

Merged
merged 1 commit into from
Jan 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions cmd/nginx/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ different namespace than their own. May be used together with watch-namespace.`)
`Update the load-balancer status of Ingress objects when the controller shuts down.
Requires the update-status parameter.`)

sortBackends = flags.Bool("sort-backends", false,
`Sort servers inside NGINX upstreams.`)

useNodeInternalIP = flags.Bool("report-node-internal-ip-address", false,
`Set the load-balancer status of Ingress objects to internal Node addresses instead of external.
Requires the update-status parameter.`)
Expand All @@ -130,7 +127,7 @@ Requires the update-status parameter.`)
annotationsPrefix = flags.String("annotations-prefix", "nginx.ingress.kubernetes.io",
`Prefix of the Ingress annotations specific to the NGINX controller.`)

enableSSLChainCompletion = flags.Bool("enable-ssl-chain-completion", true,
enableSSLChainCompletion = flags.Bool("enable-ssl-chain-completion", false,
`Autocomplete SSL certificate chains with missing intermediate CA certificates.
A valid certificate chain is required to enable OCSP stapling. Certificates
uploaded to Kubernetes must have the "Authority Information Access" X.509 v3
Expand Down Expand Up @@ -163,6 +160,8 @@ Feature backed by OpenResty Lua libraries. Requires that OCSP stapling is not en
`Disable support for catch-all Ingresses`)
)

flags.MarkDeprecated("sort-backends", "Feature removed because of the lua load balancer that removed the need of reloads for change in endpoints")
Copy link
Member

@ElvinEfendi ElvinEfendi Jan 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are already deleting it, why mark it as deprecated now?

deprecated tells me it is still there and working just deprecated i.e will be dropped in next release


flag.Set("logtostderr", "true")

flags.AddGoFlagSet(flag.CommandLine)
Expand Down Expand Up @@ -248,7 +247,6 @@ Feature backed by OpenResty Lua libraries. Requires that OCSP stapling is not en
PublishStatusAddress: *publishStatusAddress,
ForceNamespaceIsolation: *forceIsolation,
UpdateStatusOnShutdown: *updateStatusOnShutdown,
SortBackends: *sortBackends,
UseNodeInternalIP: *useNodeInternalIP,
SyncRateLimit: *syncRateLimit,
DynamicCertificatesEnabled: *dynamicCertificatesEnabled,
Expand Down
22 changes: 0 additions & 22 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package controller

import (
"fmt"
"math/rand"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -79,8 +78,6 @@ type Configuration struct {
ElectionID string
UpdateStatusOnShutdown bool

SortBackends bool

ListenPorts *ngx_config.ListenPorts

EnableSSLPassthrough bool
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

Expand Down