From 29034a12b12d40b3206ff3b2f7f089f933ebd144 Mon Sep 17 00:00:00 2001 From: Marco Ebert Date: Sat, 16 Aug 2025 16:26:58 +0200 Subject: [PATCH] Config/Annotations: Remove `proxy-busy-buffers-size` default value. --- docs/user-guide/nginx-configuration/annotations.md | 6 ++---- docs/user-guide/nginx-configuration/configmap.md | 2 +- internal/ingress/annotations/proxy/main.go | 6 ++---- internal/ingress/annotations/proxy/main_test.go | 3 +-- internal/ingress/controller/config/config.go | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/docs/user-guide/nginx-configuration/annotations.md b/docs/user-guide/nginx-configuration/annotations.md index 4fafa0454d..7d15cd8210 100755 --- a/docs/user-guide/nginx-configuration/annotations.md +++ b/docs/user-guide/nginx-configuration/annotations.md @@ -729,7 +729,7 @@ To use custom values in an Ingress rule define these annotation: 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. 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 [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 proxy busy buffers size is set as "8k". +By default, size is limited by the size of two buffers set by the `proxy_buffer_size` and `proxy_buffers` directives. 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 nginx.ingress.kubernetes.io/proxy-busy-buffers-size: "16k" ``` diff --git a/docs/user-guide/nginx-configuration/configmap.md b/docs/user-guide/nginx-configuration/configmap.md index 19c8c0287d..1a26d95962 100644 --- a/docs/user-guide/nginx-configuration/configmap.md +++ b/docs/user-guide/nginx-configuration/configmap.md @@ -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-buffers-number](#proxy-buffers-number) | int | 4 | | | [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-domain](#proxy-cookie-domain) | string | "off" | | | [proxy-next-upstream](#proxy-next-upstream) | string | "error timeout" | | diff --git a/internal/ingress/annotations/proxy/main.go b/internal/ingress/annotations/proxy/main.go index 45df90a5c0..d3b496883e 100644 --- a/internal/ingress/annotations/proxy/main.go +++ b/internal/ingress/annotations/proxy/main.go @@ -87,7 +87,7 @@ var proxyAnnotations = parser.Annotation{ Validator: parser.ValidateRegex(parser.SizeRegex, true), Scope: parser.AnnotationScopeLocation, 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: { Validator: parser.ValidateRegex(parser.URLIsValidRegex, true), @@ -301,11 +301,9 @@ func (a proxy) Parse(ing *networking.Ingress) (interface{}, error) { 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) if err != nil { - config.BusyBuffersSize = "" + config.BusyBuffersSize = defBackend.ProxyBusyBuffersSize } config.CookiePath, err = parser.GetStringAnnotation(proxyCookiePathAnnotation, ing, a.annotationConfig.Annotations) diff --git a/internal/ingress/annotations/proxy/main_test.go b/internal/ingress/annotations/proxy/main_test.go index 4728af770a..e2c5c4dacc 100644 --- a/internal/ingress/annotations/proxy/main_test.go +++ b/internal/ingress/annotations/proxy/main_test.go @@ -88,7 +88,7 @@ func (m mockBackend) GetDefaultBackend() defaults.Backend { ProxyReadTimeout: 20, ProxyBuffersNumber: 4, ProxyBufferSize: "10k", - ProxyBusyBuffersSize: "15k", + ProxyBusyBuffersSize: "", ProxyBodySize: "3k", ProxyNextUpstream: "error", ProxyNextUpstreamTimeout: 0, @@ -299,7 +299,6 @@ func TestProxyWithNoAnnotation(t *testing.T) { } } -// Add a test for when annotation is set func TestProxyWithBusyBuffersSizeAnnotation(t *testing.T) { ing := buildIngress() data := map[string]string{} diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index 5f750d404d..bf7025027a 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -860,7 +860,7 @@ func NewDefault() Configuration { ProxySendTimeout: 60, ProxyBuffersNumber: 4, ProxyBufferSize: "4k", - ProxyBusyBuffersSize: "8k", + ProxyBusyBuffersSize: "", ProxyCookieDomain: "off", ProxyCookiePath: "off", ProxyNextUpstream: "error timeout",