Skip to content

Commit b07458d

Browse files
authored
Remove zone size for invalid backend ref (#1931)
Problem: The invalid-backend-ref size of 32k is too small for some environments causing an inability of the gateway to program. Solution: Do not specify zone size for invalid-backend-ref so that NGINX does not share upstream state across backends. This is ok for this specific upstream because we will only ever proxy to one backend. Testing: Adjusted unit test to match. Deployed NGF with HTTPRoutes and verified it correctly still generates zone sizes for normal upstreams, an upstream missing its endpoint (service is present but no deployment/pod), and invalid-backend-ref
1 parent 2a1bef5 commit b07458d

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

internal/mode/static/nginx/config/upstreams.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ const (
2121
ossZoneSize = "512k"
2222
// plusZoneSize is the upstream zone size for nginx plus.
2323
plusZoneSize = "1m"
24-
// invalidBackendZoneSize is the upstream zone size for the invalid backend upstream.
25-
invalidBackendZoneSize = "32k"
2624
)
2725

2826
func (g GeneratorImpl) executeUpstreams(conf dataplane.Configuration) []executeResult {
@@ -81,9 +79,9 @@ func (g GeneratorImpl) createUpstream(up dataplane.Upstream) http.Upstream {
8179
}
8280

8381
func createInvalidBackendRefUpstream() http.Upstream {
82+
// ZoneSize is omitted since we will only ever proxy to one destination/backend.
8483
return http.Upstream{
85-
Name: invalidBackendRef,
86-
ZoneSize: invalidBackendZoneSize,
84+
Name: invalidBackendRef,
8785
Servers: []http.UpstreamServer{
8886
{
8987
Address: nginx500Server,

internal/mode/static/nginx/config/upstreams_template.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ const upstreamsTemplateText = `
88
{{ range $u := . }}
99
upstream {{ $u.Name }} {
1010
random two least_conn;
11+
{{ if $u.ZoneSize -}}
1112
zone {{ $u.Name }} {{ $u.ZoneSize }};
13+
{{ end -}}
1214
{{ range $server := $u.Servers }}
1315
server {{ $server.Address }};
1416
{{- end }}

internal/mode/static/nginx/config/upstreams_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ func TestCreateUpstreams(t *testing.T) {
128128
},
129129
},
130130
{
131-
Name: invalidBackendRef,
132-
ZoneSize: invalidBackendZoneSize,
131+
Name: invalidBackendRef,
133132
Servers: []http.UpstreamServer{
134133
{
135134
Address: nginx500Server,

0 commit comments

Comments
 (0)