Skip to content

Commit 1f4ad60

Browse files
Add proxy_send_timeout to configmap and annot
1 parent f87aacb commit 1f4ad60

10 files changed

+24
-2
lines changed

docs/configmap-and-annotations.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ spec:
8585
| ---------- | -------------- | ----------- | ------- | ------- |
8686
| `nginx.org/proxy-connect-timeout` | `proxy-connect-timeout` | Sets the value of the [proxy_connect_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout) and [grpc_connect_timeout](http://nginx.org/en/docs/http/ngx_http_grpc_module.html#grpc_connect_timeout) directive. | `60s` | |
8787
| `nginx.org/proxy-read-timeout` | `proxy-read-timeout` | Sets the value of the [proxy_read_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout) and [grpc_read_timeout](http://nginx.org/en/docs/http/ngx_http_grpc_module.html#grpc_read_timeout) directive. | `60s` | |
88+
| `nginx.org/proxy-send-timeout` | `proxy-send-timeout` | Sets the value of the [proxy_send_timeout](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout) and [grpc_send_timeout](http://nginx.org/en/docs/http/ngx_http_grpc_module.html#grpc_send_timeout) directive. | `60s` | |
8889
| `nginx.org/client-max-body-size` | `client-max-body-size` | Sets the value of the [client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size) directive. | `1m` | |
8990
| `nginx.org/proxy-buffering` | `proxy-buffering` | Enables or disables [buffering of responses](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering) from the proxied server. | `True` | |
9091
| `nginx.org/proxy-buffers` | `proxy-buffers` | Sets the value of the [proxy_buffers](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers) directive. | Depends on the platform. | |

docs/virtualserver-and-virtualserverroute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ send-timeout: 30s
194194
| `max-fails` | The number of unsuccessful attempts to communicate with an upstream server that should happen in the duration set by the `fail-timeout` to consider the server unavailable. See the [max_fails](https://nginx.org/en/docs/http/ngx_http_upstream_module.html#max_fails) parameter of the server directive. The default is set in the `max-fails` ConfgMap key. | `int` | No |
195195
`connect-timeout` | The timeout for establishing a connection with an upstream server. See the [proxy_connect_timeout](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout) directive. The default is specified in the `proxy-connect-timeout` ConfigMap key. | `string` | No
196196
`read-timeout` | The timeout for reading a response from an upstream server. See the [proxy_read_timeout](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout) directive. The default is specified in the `proxy-read-timeout` ConfigMap key. | `string` | No
197-
`send-timeout` | The timeout for transmitting a request to an upstream server. See the [proxy_send_timeout](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout) directive. The default is `60s`. | `string` | No
197+
`send-timeout` | The timeout for transmitting a request to an upstream server. See the [proxy_send_timeout](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_send_timeout) directive. The default is specified in the `proxy-send-timeout` ConfigMap key. | `string` | No
198198

199199
### Split
200200

internal/configs/annotations.go

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var minionBlacklist = map[string]bool{
3939
var minionInheritanceList = map[string]bool{
4040
"nginx.org/proxy-connect-timeout": true,
4141
"nginx.org/proxy-read-timeout": true,
42+
"nginx.org/proxy-send-timeout": true,
4243
"nginx.org/client-max-body-size": true,
4344
"nginx.org/proxy-buffering": true,
4445
"nginx.org/proxy-buffers": true,
@@ -151,6 +152,10 @@ func parseAnnotations(ingEx *IngressEx, baseCfgParams *ConfigParams, isPlus bool
151152
cfgParams.ProxyReadTimeout = proxyReadTimeout
152153
}
153154

155+
if proxySendTimeout, exists := ingEx.Ingress.Annotations["nginx.org/proxy-send-timeout"]; exists {
156+
cfgParams.ProxySendTimeout = proxySendTimeout
157+
}
158+
154159
if proxyHideHeaders, exists, err := GetMapKeyAsStringSlice(ingEx.Ingress.Annotations, "nginx.org/proxy-hide-headers", ingEx.Ingress, ","); exists {
155160
if err != nil {
156161
glog.Error(err)

internal/configs/configmaps.go

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ func ParseConfigMap(cfgm *v1.ConfigMap, nginxPlus bool) *ConfigParams {
5151
cfgParams.ProxyReadTimeout = proxyReadTimeout
5252
}
5353

54+
if proxySendTimeout, exists := cfgm.Data["proxy-send-timeout"]; exists {
55+
cfgParams.ProxySendTimeout = proxySendTimeout
56+
}
57+
5458
if proxyHideHeaders, exists, err := GetMapKeyAsStringSlice(cfgm.Data, "proxy-hide-headers", cfgm, ","); exists {
5559
if err != nil {
5660
glog.Error(err)

internal/configs/ingress.go

+1
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func createLocation(path string, upstream version1.Upstream, cfg *ConfigParams,
235235
Upstream: upstream,
236236
ProxyConnectTimeout: cfg.ProxyConnectTimeout,
237237
ProxyReadTimeout: cfg.ProxyReadTimeout,
238+
ProxySendTimeout: cfg.ProxySendTimeout,
238239
ClientMaxBodySize: cfg.ClientMaxBodySize,
239240
Websocket: websocket,
240241
Rewrite: rewrite,

internal/configs/ingress_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66

77
"github.com/nginxinc/kubernetes-ingress/internal/configs/version1"
8-
"k8s.io/api/core/v1"
8+
v1 "k8s.io/api/core/v1"
99
"k8s.io/api/extensions/v1beta1"
1010
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111
"k8s.io/apimachinery/pkg/util/intstr"
@@ -161,6 +161,7 @@ func createExpectedConfigForCafeIngressEx() version1.IngressNginxConfig {
161161
Upstream: coffeeUpstream,
162162
ProxyConnectTimeout: "60s",
163163
ProxyReadTimeout: "60s",
164+
ProxySendTimeout: "60s",
164165
ClientMaxBodySize: "1m",
165166
ProxyBuffering: true,
166167
},
@@ -169,6 +170,7 @@ func createExpectedConfigForCafeIngressEx() version1.IngressNginxConfig {
169170
Upstream: teaUpstream,
170171
ProxyConnectTimeout: "60s",
171172
ProxyReadTimeout: "60s",
173+
ProxySendTimeout: "60s",
172174
ClientMaxBodySize: "1m",
173175
ProxyBuffering: true,
174176
},
@@ -510,6 +512,7 @@ func createExpectedConfigForMergeableCafeIngress() version1.IngressNginxConfig {
510512
Upstream: coffeeUpstream,
511513
ProxyConnectTimeout: "60s",
512514
ProxyReadTimeout: "60s",
515+
ProxySendTimeout: "60s",
513516
ClientMaxBodySize: "1m",
514517
ProxyBuffering: true,
515518
MinionIngress: &version1.Ingress{
@@ -526,6 +529,7 @@ func createExpectedConfigForMergeableCafeIngress() version1.IngressNginxConfig {
526529
Upstream: teaUpstream,
527530
ProxyConnectTimeout: "60s",
528531
ProxyReadTimeout: "60s",
532+
ProxySendTimeout: "60s",
529533
ClientMaxBodySize: "1m",
530534
ProxyBuffering: true,
531535
MinionIngress: &version1.Ingress{

internal/configs/version1/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ type Location struct {
106106
Upstream Upstream
107107
ProxyConnectTimeout string
108108
ProxyReadTimeout string
109+
ProxySendTimeout string
109110
ClientMaxBodySize string
110111
Websocket bool
111112
Rewrite string

internal/configs/version1/nginx-plus.ingress.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ server {
152152

153153
grpc_connect_timeout {{$location.ProxyConnectTimeout}};
154154
grpc_read_timeout {{$location.ProxyReadTimeout}};
155+
grpc_send_timeout {{$location.ProxySendTimeout}};
155156
grpc_set_header Host $host;
156157
grpc_set_header X-Real-IP $remote_addr;
157158
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -192,6 +193,7 @@ server {
192193

193194
proxy_connect_timeout {{$location.ProxyConnectTimeout}};
194195
proxy_read_timeout {{$location.ProxyReadTimeout}};
196+
proxy_send_timeout {{$location.ProxySendTimeout}};
195197
client_max_body_size {{$location.ClientMaxBodySize}};
196198
proxy_set_header Host $host;
197199
proxy_set_header X-Real-IP $remote_addr;

internal/configs/version1/nginx.ingress.tmpl

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# configuration for {{.Ingress.Namespace}}/{{.Ingress.Name}}
2+
23
{{range $upstream := .Upstreams}}
34
upstream {{$upstream.Name}} {
45
{{if $upstream.LBMethod }}{{$upstream.LBMethod}};{{end}}
@@ -102,6 +103,7 @@ server {
102103

103104
grpc_connect_timeout {{$location.ProxyConnectTimeout}};
104105
grpc_read_timeout {{$location.ProxyReadTimeout}};
106+
grpc_send_timeout {{$location.ProxySendTimeout}};
105107
grpc_set_header Host $host;
106108
grpc_set_header X-Real-IP $remote_addr;
107109
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -134,6 +136,7 @@ server {
134136

135137
proxy_connect_timeout {{$location.ProxyConnectTimeout}};
136138
proxy_read_timeout {{$location.ProxyReadTimeout}};
139+
proxy_send_timeout {{$location.ProxySendTimeout}};
137140
client_max_body_size {{$location.ClientMaxBodySize}};
138141
proxy_set_header Host $host;
139142
proxy_set_header X-Real-IP $remote_addr;

internal/configs/version1/templates_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ var ingCfg = IngressNginxConfig{
5959
Upstream: testUps,
6060
ProxyConnectTimeout: "10s",
6161
ProxyReadTimeout: "10s",
62+
ProxySendTimeout: "10s",
6263
ClientMaxBodySize: "2m",
6364
JWTAuth: &JWTAuth{
6465
Key: "/etc/nginx/secrets/location-key.jwk",

0 commit comments

Comments
 (0)