Skip to content

Commit 3f0740d

Browse files
authored
Update default lb-method to: random two least_conn (#391)
* Random two least_conn is now the default lb-method as implemented in 5c7be23
1 parent abff82b commit 3f0740d

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

examples/customization/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ The table below summarizes all of the options. For some of them, there are examp
4242
| N/A | `ingress-template` | Sets the NGINX configuration template for an Ingress resource. | By default the template is read from the file on the container. | [Custom Templates](../custom-templates). |
4343
| `nginx.org/location-snippets` | `location-snippets` | Sets a custom snippet in location context. | N/A | |
4444
| `nginx.org/server-snippets` | `server-snippets` | Sets a custom snippet in server context. | N/A | |
45-
| `nginx.org/lb-method` | `lb-method` | Sets the [load balancing method](https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#choosing-a-load-balancing-method). To use the round-robin method, specify `"round_robin"`. | `"least_conn"` | |
45+
| `nginx.org/lb-method` | `lb-method` | Sets the [load balancing method](https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#choosing-a-load-balancing-method). To use the round-robin method, specify `"round_robin"`. | `"random two least_conn"` | |
4646
| `nginx.org/listen-ports` | N/A | Configures HTTP ports that NGINX will listen on. | `[80]` | |
4747
| `nginx.org/listen-ports-ssl` | N/A | Configures HTTPS ports that NGINX will listen on. | `[443]` | |
4848
| N/A | `worker-processes` | Sets the value of the [worker_processes](http://nginx.org/en/docs/ngx_core_module.html#worker_processes) directive. | `auto` | |

examples/customization/nginx-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ data:
4545
if ($new_uri) {
4646
rewrite ^ $new_uri permanent;
4747
}
48-
lb-method: "round_robin" # default is least_conn. Sets the load balancing method for upstreams. See https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#choosing-a-load-balancing-method
48+
lb-method: "round_robin" # default is random two least_conn. Sets the load balancing method for upstreams. See https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/#choosing-a-load-balancing-method
4949
location-snippets: | # No default. Pipe is used for multiple line snippets. Make sure the snippet is not a default value, in order to avoid duplication.
5050
proxy_temp_path /var/nginx/proxy_temp;
5151
charset koi8-r;

internal/nginx/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func NewDefaultConfig() *Config {
9292
SSLPorts: []int{443},
9393
MaxFails: 1,
9494
FailTimeout: "10s",
95-
LBMethod: "least_conn",
95+
LBMethod: "random two least_conn",
9696
MainErrorLogLevel: "notice",
9797
}
9898
}

internal/nginx/configurator_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ func createCafeIngressEx() IngressEx {
234234
func createExpectedConfigForCafeIngressEx() IngressNginxConfig {
235235
coffeeUpstream := Upstream{
236236
Name: "default-cafe-ingress-cafe.example.com-coffee-svc-80",
237-
LBMethod: "least_conn",
237+
LBMethod: "random two least_conn",
238238
UpstreamServers: []UpstreamServer{
239239
{
240240
Address: "10.0.0.1",
@@ -246,7 +246,7 @@ func createExpectedConfigForCafeIngressEx() IngressNginxConfig {
246246
}
247247
teaUpstream := Upstream{
248248
Name: "default-cafe-ingress-cafe.example.com-tea-svc-80",
249-
LBMethod: "least_conn",
249+
LBMethod: "random two least_conn",
250250
UpstreamServers: []UpstreamServer{
251251
{
252252
Address: "10.0.0.2",
@@ -434,7 +434,7 @@ func createMergeableCafeIngress() *MergeableIngresses {
434434
func createExpectedConfigForMergeableCafeIngress() IngressNginxConfig {
435435
coffeeUpstream := Upstream{
436436
Name: "default-cafe-ingress-coffee-minion-cafe.example.com-coffee-svc-80",
437-
LBMethod: "least_conn",
437+
LBMethod: "random two least_conn",
438438
UpstreamServers: []UpstreamServer{
439439
{
440440
Address: "10.0.0.1",
@@ -446,7 +446,7 @@ func createExpectedConfigForMergeableCafeIngress() IngressNginxConfig {
446446
}
447447
teaUpstream := Upstream{
448448
Name: "default-cafe-ingress-tea-minion-cafe.example.com-tea-svc-80",
449-
LBMethod: "least_conn",
449+
LBMethod: "random two least_conn",
450450
UpstreamServers: []UpstreamServer{
451451
{
452452
Address: "10.0.0.2",

0 commit comments

Comments
 (0)