Config/Annotations: Remove `proxy-busy-buffers-size` default value. (#13790)

Co-authored-by: Marco Ebert <marco_ebert@icloud.com>
This commit is contained in:
k8s-infra-cherrypick-robot 2025-08-18 07:57:11 -07:00 committed by GitHub
parent 1b7140211f
commit 145ff64b1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7 additions and 12 deletions

View File

@ -729,7 +729,7 @@ To use custom values in an Ingress rule define these annotation:
nginx.ingress.kubernetes.io/proxy-buffering: "on" nginx.ingress.kubernetes.io/proxy-buffering: "on"
``` ```
### Proxy buffers Number ### Proxy buffers number
Sets the number of the buffers in [`proxy_buffers`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers) used for reading the first part of the response received from the proxied server. Sets the number of the buffers in [`proxy_buffers`](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffers) used for reading the first part of the response received from the proxied server.
By default proxy buffers number is set as 4 By default proxy buffers number is set as 4
@ -752,11 +752,9 @@ nginx.ingress.kubernetes.io/proxy-buffer-size: "8k"
### Proxy busy buffers size ### Proxy busy buffers size
[Limits the total size of buffers that can be busy](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size) sending a response to the client while the response is not yet fully read. [Limits the total size of buffers that can be busy](https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size) sending a response to the client while the response is not yet fully read.
By default, size is limited by the size of two buffers set by the `proxy_buffer_size` and `proxy_buffers` directives.
By default proxy busy buffers size is set as "8k".
To configure this setting globally, set `proxy-busy-buffers-size` in the [ConfigMap](./configmap.md#proxy-busy-buffers-size). To use custom values in an Ingress rule, define this annotation: To configure this setting globally, set `proxy-busy-buffers-size` in the [ConfigMap](./configmap.md#proxy-busy-buffers-size). To use custom values in an Ingress rule, define this annotation:
```yaml ```yaml
nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "16k" nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "16k"
``` ```

View File

@ -180,7 +180,7 @@ The following table shows a configuration option's name, type, and the default v
| [proxy-send-timeout](#proxy-send-timeout) | int | 60 | | | [proxy-send-timeout](#proxy-send-timeout) | int | 60 | |
| [proxy-buffers-number](#proxy-buffers-number) | int | 4 | | | [proxy-buffers-number](#proxy-buffers-number) | int | 4 | |
| [proxy-buffer-size](#proxy-buffer-size) | string | "4k" | | | [proxy-buffer-size](#proxy-buffer-size) | string | "4k" | |
| [proxy-busy-buffers-size](#proxy-busy-buffers-size) | string | "8k" | | | [proxy-busy-buffers-size](#proxy-busy-buffers-size) | string | "" | |
| [proxy-cookie-path](#proxy-cookie-path) | string | "off" | | | [proxy-cookie-path](#proxy-cookie-path) | string | "off" | |
| [proxy-cookie-domain](#proxy-cookie-domain) | string | "off" | | | [proxy-cookie-domain](#proxy-cookie-domain) | string | "off" | |
| [proxy-next-upstream](#proxy-next-upstream) | string | "error timeout" | | | [proxy-next-upstream](#proxy-next-upstream) | string | "error timeout" | |

View File

@ -87,7 +87,7 @@ var proxyAnnotations = parser.Annotation{
Validator: parser.ValidateRegex(parser.SizeRegex, true), Validator: parser.ValidateRegex(parser.SizeRegex, true),
Scope: parser.AnnotationScopeLocation, Scope: parser.AnnotationScopeLocation,
Risk: parser.AnnotationRiskLow, Risk: parser.AnnotationRiskLow,
Documentation: `This annotation limits the total size of buffers that can be busy sending a response to the client while the response is not yet fully read. By default proxy busy buffers size is set as "8k".`, Documentation: `This annotation limits the total size of buffers that can be busy sending a response to the client while the response is not yet fully read.`,
}, },
proxyCookiePathAnnotation: { proxyCookiePathAnnotation: {
Validator: parser.ValidateRegex(parser.URLIsValidRegex, true), Validator: parser.ValidateRegex(parser.URLIsValidRegex, true),
@ -301,11 +301,9 @@ func (a proxy) Parse(ing *networking.Ingress) (interface{}, error) {
config.BufferSize = defBackend.ProxyBufferSize config.BufferSize = defBackend.ProxyBufferSize
} }
// Only set BusyBuffersSize if annotation is present, blank is NGINX default
// https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_busy_buffers_size
config.BusyBuffersSize, err = parser.GetStringAnnotation(proxyBusyBuffersSizeAnnotation, ing, a.annotationConfig.Annotations) config.BusyBuffersSize, err = parser.GetStringAnnotation(proxyBusyBuffersSizeAnnotation, ing, a.annotationConfig.Annotations)
if err != nil { if err != nil {
config.BusyBuffersSize = "" config.BusyBuffersSize = defBackend.ProxyBusyBuffersSize
} }
config.CookiePath, err = parser.GetStringAnnotation(proxyCookiePathAnnotation, ing, a.annotationConfig.Annotations) config.CookiePath, err = parser.GetStringAnnotation(proxyCookiePathAnnotation, ing, a.annotationConfig.Annotations)

View File

@ -88,7 +88,7 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend {
ProxyReadTimeout: 20, ProxyReadTimeout: 20,
ProxyBuffersNumber: 4, ProxyBuffersNumber: 4,
ProxyBufferSize: "10k", ProxyBufferSize: "10k",
ProxyBusyBuffersSize: "15k", ProxyBusyBuffersSize: "",
ProxyBodySize: "3k", ProxyBodySize: "3k",
ProxyNextUpstream: "error", ProxyNextUpstream: "error",
ProxyNextUpstreamTimeout: 0, ProxyNextUpstreamTimeout: 0,
@ -299,7 +299,6 @@ func TestProxyWithNoAnnotation(t *testing.T) {
} }
} }
// Add a test for when annotation is set
func TestProxyWithBusyBuffersSizeAnnotation(t *testing.T) { func TestProxyWithBusyBuffersSizeAnnotation(t *testing.T) {
ing := buildIngress() ing := buildIngress()
data := map[string]string{} data := map[string]string{}

View File

@ -860,7 +860,7 @@ func NewDefault() Configuration {
ProxySendTimeout: 60, ProxySendTimeout: 60,
ProxyBuffersNumber: 4, ProxyBuffersNumber: 4,
ProxyBufferSize: "4k", ProxyBufferSize: "4k",
ProxyBusyBuffersSize: "8k", ProxyBusyBuffersSize: "",
ProxyCookieDomain: "off", ProxyCookieDomain: "off",
ProxyCookiePath: "off", ProxyCookiePath: "off",
ProxyNextUpstream: "error timeout", ProxyNextUpstream: "error timeout",