Skip to content

Commit 3eaf352

Browse files
committed
fix(gatewayapi): allow custom nginx.conf
There is no easy way to add `proxy_buffer_size` or similar parameters to Nginx via CRD. A feature for the same is being worked on and might be released early November per [nginxinc/nginx-gateway-fabric/#1398](nginx/nginx-gateway-fabric#1398 (comment)). As a workaround, this change includes the default nginx configuration as deployed in the current version of nginx gateway fabric. It will be made available to the nginx pod at `/etc/nginx/nginx.conf` by supplanting the nginx-gateway deployment with a kustomize patch that overrides `nginx.conf` via a mounted configMap volume containing said file. Several additional parameters, `proxy_buffer_size` and `proxy_buffers` are being included at this time, to account for some large header payloads being proxied from Gnocchi.
1 parent 71a748f commit 3eaf352

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
load_module /usr/lib/nginx/modules/ngx_http_js_module.so;
2+
include /etc/nginx/module-includes/*.conf;
3+
4+
worker_processes auto;
5+
6+
pid /var/run/nginx/nginx.pid;
7+
error_log stderr info;
8+
9+
events {
10+
worker_connections 1024;
11+
}
12+
13+
http {
14+
include /etc/nginx/conf.d/*.conf;
15+
include /etc/nginx/mime.types;
16+
js_import /usr/lib/nginx/modules/njs/httpmatches.js;
17+
18+
default_type application/octet-stream;
19+
20+
proxy_headers_hash_bucket_size 512;
21+
proxy_headers_hash_max_size 1024;
22+
proxy_buffer_size 16k;
23+
proxy_buffers 4 16k;
24+
server_names_hash_bucket_size 256;
25+
server_names_hash_max_size 1024;
26+
variables_hash_bucket_size 512;
27+
variables_hash_max_size 1024;
28+
29+
sendfile on;
30+
tcp_nopush on;
31+
32+
server {
33+
listen unix:/var/run/nginx/nginx-status.sock;
34+
access_log off;
35+
36+
location /stub_status {
37+
stub_status;
38+
}
39+
}
40+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
resources:
2+
- all.yaml
3+
patches:
4+
- patch: |
5+
apiVersion: apps/v1
6+
kind: Deployment
7+
metadata:
8+
name: nginx-gateway-fabric
9+
namespace: nginx-gateway
10+
spec:
11+
template:
12+
spec:
13+
containers:
14+
- name: nginx
15+
volumeMounts:
16+
- mountPath: /etc/nginx/nginx.conf
17+
name: nginx-conf-override
18+
subPath: nginx.conf
19+
volumes:
20+
- name: nginx-conf-override
21+
configMap:
22+
name: nginx-conf-override
23+
configMapGenerator:
24+
- name: nginx-conf-override
25+
namespace: nginx-gateway
26+
options:
27+
disableNameSuffixHash: true
28+
files:
29+
- configs/nginx.conf

0 commit comments

Comments
 (0)