diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index 9fbe38d71..8374531eb 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -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, diff --git a/internal/ingress/controller/template/configmap_test.go b/internal/ingress/controller/template/configmap_test.go index f37b8d1b9..e9c8a0ba4 100644 --- a/internal/ingress/controller/template/configmap_test.go +++ b/internal/ingress/controller/template/configmap_test.go @@ -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") - } -} diff --git a/internal/ingress/controller/template/template.go b/internal/ingress/controller/template/template.go index ca36c355e..6aaf43e2e 100644 --- a/internal/ingress/controller/template/template.go +++ b/internal/ingress/controller/template/template.go @@ -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