From 390c54bb81681403a66b313e6d9082337e8cdc7e Mon Sep 17 00:00:00 2001 From: Vitaliy Snurnitsin Date: Tue, 28 Dec 2021 02:03:43 +0300 Subject: [PATCH] [ingress-nginx] add pcre_jit on in nginx.tmpl for controller-0.46 and above --- .../controller-0-46/patches/nginx-tpl.patch | 46 +++++++++++-------- .../controller-0-48/patches/nginx-tpl.patch | 46 +++++++++++-------- .../controller-0-49/patches/nginx-tpl.patch | 46 +++++++++++-------- .../controller-1-0/patches/nginx-tpl.patch | 46 +++++++++++-------- 4 files changed, 112 insertions(+), 72 deletions(-) diff --git a/modules/402-ingress-nginx/images/controller-0-46/patches/nginx-tpl.patch b/modules/402-ingress-nginx/images/controller-0-46/patches/nginx-tpl.patch index 36e13c6b25f..45f67a5b5a5 100644 --- a/modules/402-ingress-nginx/images/controller-0-46/patches/nginx-tpl.patch +++ b/modules/402-ingress-nginx/images/controller-0-46/patches/nginx-tpl.patch @@ -1,8 +1,18 @@ --- a/etc/nginx/template/nginx.tmpl +++ b/etc/nginx/template/nginx.tmpl -@@ -95,11 +95,11 @@ +@@ -12,6 +12,9 @@ + # setup custom paths that do not require root access + pid {{ .PID }}; + ++# enables the use of “just-in-time compilation” for the regular expressions known by the time of configuration parsing ++pcre_jit on; ++ + {{ if $cfg.UseGeoIP2 }} + load_module /etc/nginx/modules/ngx_http_geoip2_module.so; + {{ end }} +@@ -95,11 +98,11 @@ end - + {{ if $all.EnableMetrics }} - ok, res = pcall(require, "monitor") + ok, res = pcall(require, "pbmetrics") @@ -13,25 +23,25 @@ + pbmetrics = res end {{ end }} - -@@ -124,11 +124,10 @@ + +@@ -124,11 +127,10 @@ init_worker_by_lua_block { lua_ingress.init_worker() balancer.init_worker() - {{ if $all.EnableMetrics }} - monitor.init_worker({{ $all.MonitorMaxBatchSize }}) - {{ end }} - + plugins.run() + + pbmetrics.init_worker() } - + {{/* Enable the real_ip module only if we use either X-Forwarded headers or Proxy Protocol. */}} -@@ -624,6 +623,24 @@ - +@@ -624,6 +626,24 @@ + {{ end }} - + + server { + listen 8080; + @@ -53,8 +63,8 @@ # backend for when default-backend-service is not configured or it does not have endpoints server { listen {{ $all.ListenPorts.Default }} default_server {{ if $all.Cfg.ReusePort }}reuseport{{ end }} backlog={{ $all.BacklogSize }}; -@@ -852,9 +869,7 @@ - +@@ -852,9 +872,7 @@ + proxy_pass http://upstream_balancer; log_by_lua_block { - {{ if $enableMetrics }} @@ -64,28 +74,28 @@ } } {{ end }} -@@ -1094,6 +1109,10 @@ +@@ -1094,6 +1112,10 @@ set $location_path {{ $ing.Path | escapeLiteralDollar | quote }}; set $global_rate_limit_exceeding n; - + + set $content_kind ""; + set $total_upstream_response_time "0"; + set $upstream_retries "0"; + {{ buildOpentracingForLocation $all.Cfg.EnableOpentracing $location }} - + {{ if $location.Mirror.Source }} -@@ -1124,11 +1143,10 @@ - +@@ -1124,11 +1146,10 @@ + log_by_lua_block { balancer.log() - {{ if $all.EnableMetrics }} - monitor.call() - {{ end }} - + plugins.run() + + pbmetrics.call() } - + {{ if not $location.Logs.Access }} diff --git a/modules/402-ingress-nginx/images/controller-0-48/patches/nginx-tpl.patch b/modules/402-ingress-nginx/images/controller-0-48/patches/nginx-tpl.patch index 36e13c6b25f..45f67a5b5a5 100644 --- a/modules/402-ingress-nginx/images/controller-0-48/patches/nginx-tpl.patch +++ b/modules/402-ingress-nginx/images/controller-0-48/patches/nginx-tpl.patch @@ -1,8 +1,18 @@ --- a/etc/nginx/template/nginx.tmpl +++ b/etc/nginx/template/nginx.tmpl -@@ -95,11 +95,11 @@ +@@ -12,6 +12,9 @@ + # setup custom paths that do not require root access + pid {{ .PID }}; + ++# enables the use of “just-in-time compilation” for the regular expressions known by the time of configuration parsing ++pcre_jit on; ++ + {{ if $cfg.UseGeoIP2 }} + load_module /etc/nginx/modules/ngx_http_geoip2_module.so; + {{ end }} +@@ -95,11 +98,11 @@ end - + {{ if $all.EnableMetrics }} - ok, res = pcall(require, "monitor") + ok, res = pcall(require, "pbmetrics") @@ -13,25 +23,25 @@ + pbmetrics = res end {{ end }} - -@@ -124,11 +124,10 @@ + +@@ -124,11 +127,10 @@ init_worker_by_lua_block { lua_ingress.init_worker() balancer.init_worker() - {{ if $all.EnableMetrics }} - monitor.init_worker({{ $all.MonitorMaxBatchSize }}) - {{ end }} - + plugins.run() + + pbmetrics.init_worker() } - + {{/* Enable the real_ip module only if we use either X-Forwarded headers or Proxy Protocol. */}} -@@ -624,6 +623,24 @@ - +@@ -624,6 +626,24 @@ + {{ end }} - + + server { + listen 8080; + @@ -53,8 +63,8 @@ # backend for when default-backend-service is not configured or it does not have endpoints server { listen {{ $all.ListenPorts.Default }} default_server {{ if $all.Cfg.ReusePort }}reuseport{{ end }} backlog={{ $all.BacklogSize }}; -@@ -852,9 +869,7 @@ - +@@ -852,9 +872,7 @@ + proxy_pass http://upstream_balancer; log_by_lua_block { - {{ if $enableMetrics }} @@ -64,28 +74,28 @@ } } {{ end }} -@@ -1094,6 +1109,10 @@ +@@ -1094,6 +1112,10 @@ set $location_path {{ $ing.Path | escapeLiteralDollar | quote }}; set $global_rate_limit_exceeding n; - + + set $content_kind ""; + set $total_upstream_response_time "0"; + set $upstream_retries "0"; + {{ buildOpentracingForLocation $all.Cfg.EnableOpentracing $location }} - + {{ if $location.Mirror.Source }} -@@ -1124,11 +1143,10 @@ - +@@ -1124,11 +1146,10 @@ + log_by_lua_block { balancer.log() - {{ if $all.EnableMetrics }} - monitor.call() - {{ end }} - + plugins.run() + + pbmetrics.call() } - + {{ if not $location.Logs.Access }} diff --git a/modules/402-ingress-nginx/images/controller-0-49/patches/nginx-tpl.patch b/modules/402-ingress-nginx/images/controller-0-49/patches/nginx-tpl.patch index 36e13c6b25f..45f67a5b5a5 100644 --- a/modules/402-ingress-nginx/images/controller-0-49/patches/nginx-tpl.patch +++ b/modules/402-ingress-nginx/images/controller-0-49/patches/nginx-tpl.patch @@ -1,8 +1,18 @@ --- a/etc/nginx/template/nginx.tmpl +++ b/etc/nginx/template/nginx.tmpl -@@ -95,11 +95,11 @@ +@@ -12,6 +12,9 @@ + # setup custom paths that do not require root access + pid {{ .PID }}; + ++# enables the use of “just-in-time compilation” for the regular expressions known by the time of configuration parsing ++pcre_jit on; ++ + {{ if $cfg.UseGeoIP2 }} + load_module /etc/nginx/modules/ngx_http_geoip2_module.so; + {{ end }} +@@ -95,11 +98,11 @@ end - + {{ if $all.EnableMetrics }} - ok, res = pcall(require, "monitor") + ok, res = pcall(require, "pbmetrics") @@ -13,25 +23,25 @@ + pbmetrics = res end {{ end }} - -@@ -124,11 +124,10 @@ + +@@ -124,11 +127,10 @@ init_worker_by_lua_block { lua_ingress.init_worker() balancer.init_worker() - {{ if $all.EnableMetrics }} - monitor.init_worker({{ $all.MonitorMaxBatchSize }}) - {{ end }} - + plugins.run() + + pbmetrics.init_worker() } - + {{/* Enable the real_ip module only if we use either X-Forwarded headers or Proxy Protocol. */}} -@@ -624,6 +623,24 @@ - +@@ -624,6 +626,24 @@ + {{ end }} - + + server { + listen 8080; + @@ -53,8 +63,8 @@ # backend for when default-backend-service is not configured or it does not have endpoints server { listen {{ $all.ListenPorts.Default }} default_server {{ if $all.Cfg.ReusePort }}reuseport{{ end }} backlog={{ $all.BacklogSize }}; -@@ -852,9 +869,7 @@ - +@@ -852,9 +872,7 @@ + proxy_pass http://upstream_balancer; log_by_lua_block { - {{ if $enableMetrics }} @@ -64,28 +74,28 @@ } } {{ end }} -@@ -1094,6 +1109,10 @@ +@@ -1094,6 +1112,10 @@ set $location_path {{ $ing.Path | escapeLiteralDollar | quote }}; set $global_rate_limit_exceeding n; - + + set $content_kind ""; + set $total_upstream_response_time "0"; + set $upstream_retries "0"; + {{ buildOpentracingForLocation $all.Cfg.EnableOpentracing $location }} - + {{ if $location.Mirror.Source }} -@@ -1124,11 +1143,10 @@ - +@@ -1124,11 +1146,10 @@ + log_by_lua_block { balancer.log() - {{ if $all.EnableMetrics }} - monitor.call() - {{ end }} - + plugins.run() + + pbmetrics.call() } - + {{ if not $location.Logs.Access }} diff --git a/modules/402-ingress-nginx/images/controller-1-0/patches/nginx-tpl.patch b/modules/402-ingress-nginx/images/controller-1-0/patches/nginx-tpl.patch index 36e13c6b25f..45f67a5b5a5 100644 --- a/modules/402-ingress-nginx/images/controller-1-0/patches/nginx-tpl.patch +++ b/modules/402-ingress-nginx/images/controller-1-0/patches/nginx-tpl.patch @@ -1,8 +1,18 @@ --- a/etc/nginx/template/nginx.tmpl +++ b/etc/nginx/template/nginx.tmpl -@@ -95,11 +95,11 @@ +@@ -12,6 +12,9 @@ + # setup custom paths that do not require root access + pid {{ .PID }}; + ++# enables the use of “just-in-time compilation” for the regular expressions known by the time of configuration parsing ++pcre_jit on; ++ + {{ if $cfg.UseGeoIP2 }} + load_module /etc/nginx/modules/ngx_http_geoip2_module.so; + {{ end }} +@@ -95,11 +98,11 @@ end - + {{ if $all.EnableMetrics }} - ok, res = pcall(require, "monitor") + ok, res = pcall(require, "pbmetrics") @@ -13,25 +23,25 @@ + pbmetrics = res end {{ end }} - -@@ -124,11 +124,10 @@ + +@@ -124,11 +127,10 @@ init_worker_by_lua_block { lua_ingress.init_worker() balancer.init_worker() - {{ if $all.EnableMetrics }} - monitor.init_worker({{ $all.MonitorMaxBatchSize }}) - {{ end }} - + plugins.run() + + pbmetrics.init_worker() } - + {{/* Enable the real_ip module only if we use either X-Forwarded headers or Proxy Protocol. */}} -@@ -624,6 +623,24 @@ - +@@ -624,6 +626,24 @@ + {{ end }} - + + server { + listen 8080; + @@ -53,8 +63,8 @@ # backend for when default-backend-service is not configured or it does not have endpoints server { listen {{ $all.ListenPorts.Default }} default_server {{ if $all.Cfg.ReusePort }}reuseport{{ end }} backlog={{ $all.BacklogSize }}; -@@ -852,9 +869,7 @@ - +@@ -852,9 +872,7 @@ + proxy_pass http://upstream_balancer; log_by_lua_block { - {{ if $enableMetrics }} @@ -64,28 +74,28 @@ } } {{ end }} -@@ -1094,6 +1109,10 @@ +@@ -1094,6 +1112,10 @@ set $location_path {{ $ing.Path | escapeLiteralDollar | quote }}; set $global_rate_limit_exceeding n; - + + set $content_kind ""; + set $total_upstream_response_time "0"; + set $upstream_retries "0"; + {{ buildOpentracingForLocation $all.Cfg.EnableOpentracing $location }} - + {{ if $location.Mirror.Source }} -@@ -1124,11 +1143,10 @@ - +@@ -1124,11 +1146,10 @@ + log_by_lua_block { balancer.log() - {{ if $all.EnableMetrics }} - monitor.call() - {{ end }} - + plugins.run() + + pbmetrics.call() } - + {{ if not $location.Logs.Access }}