Merge pull request #3478 from Shopify/delete-unused-code

delete unused buildLoadBalancingConfig
This commit is contained in:
k8s-ci-robot 2018-11-28 04:01:55 -08:00 committed by GitHub
commit 0b2c1b3b91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 41 deletions

View file

@ -76,9 +76,6 @@ const (
// http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache
sslSessionCacheSize = "10m"
// Default setting for load balancer algorithm
defaultLoadBalancerAlgorithm = ""
// Parameters for a shared memory zone that will keep states for various keys.
// http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_zone
defaultLimitConnZoneVariable = "$binary_remote_addr"
@ -381,9 +378,6 @@ type Configuration struct {
// http://nginx.org/en/docs/ngx_core_module.html#worker_shutdown_timeout
WorkerShutdownTimeout string `json:"worker-shutdown-timeout,omitempty"`
// Defines the load balancing algorithm to use. The deault is round-robin
LoadBalanceAlgorithm string `json:"load-balance,omitempty"`
// Sets the bucket size for the variables hash table.
// http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_bucket_size
VariablesHashBucketSize int `json:"variables-hash-bucket-size,omitempty"`
@ -637,7 +631,6 @@ func NewDefault() Configuration {
UseGeoIP2: false,
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
WorkerShutdownTimeout: "10s",
LoadBalanceAlgorithm: defaultLoadBalancerAlgorithm,
VariablesHashBucketSize: 128,
VariablesHashMaxSize: 2048,
UseHTTP2: true,

View file

@ -151,11 +151,3 @@ func TestMergeConfigMapToStruct(t *testing.T) {
t.Errorf("unexpected diff: (-got +want)\n%s", diff)
}
}
func TestDefaultLoadBalance(t *testing.T) {
conf := map[string]string{}
to := ReadConfig(conf)
if to.LoadBalanceAlgorithm != "" {
t.Errorf("default load balance algorithm wrong")
}
}

View file

@ -125,7 +125,6 @@ var (
"buildLocation": buildLocation,
"buildAuthLocation": buildAuthLocation,
"buildAuthResponseHeaders": buildAuthResponseHeaders,
"buildLoadBalancingConfig": buildLoadBalancingConfig,
"buildProxyPass": buildProxyPass,
"filterRateLimits": filterRateLimits,
"buildRateLimitZones": buildRateLimitZones,
@ -405,31 +404,6 @@ func buildLogFormatUpstream(input interface{}) string {
return cfg.BuildLogFormatUpstream()
}
func buildLoadBalancingConfig(b interface{}, fallbackLoadBalancing string) string {
backend, ok := b.(*ingress.Backend)
if !ok {
glog.Errorf("expected an '*ingress.Backend' type but %T was returned", b)
return ""
}
if backend.UpstreamHashBy != "" {
return fmt.Sprintf("hash %s consistent;", backend.UpstreamHashBy)
}
if backend.LoadBalancing != "" {
if backend.LoadBalancing == "round_robin" {
return ""
}
return fmt.Sprintf("%s;", backend.LoadBalancing)
}
if fallbackLoadBalancing == "round_robin" || fallbackLoadBalancing == "" {
return ""
}
return fmt.Sprintf("%s;", fallbackLoadBalancing)
}
// buildProxyPass produces the proxy pass string, if the ingress has redirects
// (specified through the nginx.ingress.kubernetes.io/rewrite-target annotation)
// If the annotation nginx.ingress.kubernetes.io/add-base-url:"true" is specified it will