Merge pull request #3478 from Shopify/delete-unused-code
delete unused buildLoadBalancingConfig
This commit is contained in:
commit
0b2c1b3b91
3 changed files with 0 additions and 41 deletions
|
@ -76,9 +76,6 @@ const (
|
||||||
// http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache
|
// http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_session_cache
|
||||||
sslSessionCacheSize = "10m"
|
sslSessionCacheSize = "10m"
|
||||||
|
|
||||||
// Default setting for load balancer algorithm
|
|
||||||
defaultLoadBalancerAlgorithm = ""
|
|
||||||
|
|
||||||
// Parameters for a shared memory zone that will keep states for various keys.
|
// 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
|
// http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_zone
|
||||||
defaultLimitConnZoneVariable = "$binary_remote_addr"
|
defaultLimitConnZoneVariable = "$binary_remote_addr"
|
||||||
|
@ -381,9 +378,6 @@ type Configuration struct {
|
||||||
// http://nginx.org/en/docs/ngx_core_module.html#worker_shutdown_timeout
|
// http://nginx.org/en/docs/ngx_core_module.html#worker_shutdown_timeout
|
||||||
WorkerShutdownTimeout string `json:"worker-shutdown-timeout,omitempty"`
|
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.
|
// Sets the bucket size for the variables hash table.
|
||||||
// http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_bucket_size
|
// http://nginx.org/en/docs/http/ngx_http_map_module.html#variables_hash_bucket_size
|
||||||
VariablesHashBucketSize int `json:"variables-hash-bucket-size,omitempty"`
|
VariablesHashBucketSize int `json:"variables-hash-bucket-size,omitempty"`
|
||||||
|
@ -637,7 +631,6 @@ func NewDefault() Configuration {
|
||||||
UseGeoIP2: false,
|
UseGeoIP2: false,
|
||||||
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
|
WorkerProcesses: strconv.Itoa(runtime.NumCPU()),
|
||||||
WorkerShutdownTimeout: "10s",
|
WorkerShutdownTimeout: "10s",
|
||||||
LoadBalanceAlgorithm: defaultLoadBalancerAlgorithm,
|
|
||||||
VariablesHashBucketSize: 128,
|
VariablesHashBucketSize: 128,
|
||||||
VariablesHashMaxSize: 2048,
|
VariablesHashMaxSize: 2048,
|
||||||
UseHTTP2: true,
|
UseHTTP2: true,
|
||||||
|
|
|
@ -151,11 +151,3 @@ func TestMergeConfigMapToStruct(t *testing.T) {
|
||||||
t.Errorf("unexpected diff: (-got +want)\n%s", diff)
|
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -125,7 +125,6 @@ var (
|
||||||
"buildLocation": buildLocation,
|
"buildLocation": buildLocation,
|
||||||
"buildAuthLocation": buildAuthLocation,
|
"buildAuthLocation": buildAuthLocation,
|
||||||
"buildAuthResponseHeaders": buildAuthResponseHeaders,
|
"buildAuthResponseHeaders": buildAuthResponseHeaders,
|
||||||
"buildLoadBalancingConfig": buildLoadBalancingConfig,
|
|
||||||
"buildProxyPass": buildProxyPass,
|
"buildProxyPass": buildProxyPass,
|
||||||
"filterRateLimits": filterRateLimits,
|
"filterRateLimits": filterRateLimits,
|
||||||
"buildRateLimitZones": buildRateLimitZones,
|
"buildRateLimitZones": buildRateLimitZones,
|
||||||
|
@ -405,31 +404,6 @@ func buildLogFormatUpstream(input interface{}) string {
|
||||||
return cfg.BuildLogFormatUpstream()
|
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
|
// buildProxyPass produces the proxy pass string, if the ingress has redirects
|
||||||
// (specified through the nginx.ingress.kubernetes.io/rewrite-target annotation)
|
// (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
|
// If the annotation nginx.ingress.kubernetes.io/add-base-url:"true" is specified it will
|
||||||
|
|
Loading…
Reference in a new issue