Skip to content

Update default lb-method to be random two least_conn #391

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

Merged
merged 1 commit into from
Oct 11, 2018
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
2 changes: 1 addition & 1 deletion examples/customization/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The table below summarizes all of the options. For some of them, there are examp
| 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). |
| `nginx.org/location-snippets` | `location-snippets` | Sets a custom snippet in location context. | N/A | |
| `nginx.org/server-snippets` | `server-snippets` | Sets a custom snippet in server context. | N/A | |
| `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"` | |
| `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"` | |
| `nginx.org/listen-ports` | N/A | Configures HTTP ports that NGINX will listen on. | `[80]` | |
| `nginx.org/listen-ports-ssl` | N/A | Configures HTTPS ports that NGINX will listen on. | `[443]` | |
| N/A | `worker-processes` | Sets the value of the [worker_processes](http://nginx.org/en/docs/ngx_core_module.html#worker_processes) directive. | `auto` | |
Expand Down
2 changes: 1 addition & 1 deletion examples/customization/nginx-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ data:
if ($new_uri) {
rewrite ^ $new_uri permanent;
}
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
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
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.
proxy_temp_path /var/nginx/proxy_temp;
charset koi8-r;
Expand Down
2 changes: 1 addition & 1 deletion internal/nginx/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func NewDefaultConfig() *Config {
SSLPorts: []int{443},
MaxFails: 1,
FailTimeout: "10s",
LBMethod: "least_conn",
LBMethod: "random two least_conn",
MainErrorLogLevel: "notice",
}
}
Expand Down
8 changes: 4 additions & 4 deletions internal/nginx/configurator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func createCafeIngressEx() IngressEx {
func createExpectedConfigForCafeIngressEx() IngressNginxConfig {
coffeeUpstream := Upstream{
Name: "default-cafe-ingress-cafe.example.com-coffee-svc-80",
LBMethod: "least_conn",
LBMethod: "random two least_conn",
UpstreamServers: []UpstreamServer{
{
Address: "10.0.0.1",
Expand All @@ -246,7 +246,7 @@ func createExpectedConfigForCafeIngressEx() IngressNginxConfig {
}
teaUpstream := Upstream{
Name: "default-cafe-ingress-cafe.example.com-tea-svc-80",
LBMethod: "least_conn",
LBMethod: "random two least_conn",
UpstreamServers: []UpstreamServer{
{
Address: "10.0.0.2",
Expand Down Expand Up @@ -434,7 +434,7 @@ func createMergeableCafeIngress() *MergeableIngresses {
func createExpectedConfigForMergeableCafeIngress() IngressNginxConfig {
coffeeUpstream := Upstream{
Name: "default-cafe-ingress-coffee-minion-cafe.example.com-coffee-svc-80",
LBMethod: "least_conn",
LBMethod: "random two least_conn",
UpstreamServers: []UpstreamServer{
{
Address: "10.0.0.1",
Expand All @@ -446,7 +446,7 @@ func createExpectedConfigForMergeableCafeIngress() IngressNginxConfig {
}
teaUpstream := Upstream{
Name: "default-cafe-ingress-tea-minion-cafe.example.com-tea-svc-80",
LBMethod: "least_conn",
LBMethod: "random two least_conn",
UpstreamServers: []UpstreamServer{
{
Address: "10.0.0.2",
Expand Down