@@ -24,6 +24,7 @@ metadata:
2424{{ include "openwhisk.label_boilerplate" . | indent 4 }}
2525data :
2626 nginx.conf : |
27+ worker_processes {{ .Values.nginx.workerProcesses }};
2728 worker_rlimit_nofile 4096;
2829
2930 events {
4546 proxy_http_version 1.1;
4647 proxy_set_header Connection "";
4748
49+ upstream controllers {
50+ # Mark the controller as unavailable after fail_timeout seconds, to not get any requests during restart.
51+ # Otherwise, nginx would dispatch requests when the container is up, but the backend in the container not.
52+ # From the docs:
53+ # "normally, requests with a non-idempotent method (POST, LOCK, PATCH) are not passed to
54+ # the next server if a request has been sent to an upstream server"
55+ server {{ include "openwhisk.controller_host" . }}:{{ .Values.controller.port }} fail_timeout=60s;
56+
57+ keepalive 512;
58+ }
59+
4860 server {
4961 listen 80;
5062 listen 443 default ssl;
7284
7385 # Hack to convince nginx to dynamically resolve the dns entries.
7486 resolver {{ .Values.k8s.dns }};
75- set $controllers {{ include "openwhisk.controller_host" . }};
7687{{- if or (eq .Values.whisk.ingress.type "NodePort") (eq .Values.whisk.ingress.type "LoadBalancer") }}
7788 set $apigw {{ include "openwhisk.apigw_host" . }};
7889{{ if or .Values.metrics.prometheusEnabled .Values.metrics.userMetricsEnabled }}
@@ -85,12 +96,12 @@ data:
8596 if ($namespace) {
8697 rewrite /(.*) /api/v1/web/${namespace}/$1 break;
8798 }
88- proxy_pass http://$ controllers:{{ .Values.controller.port }} ;
99+ proxy_pass http://controllers;
89100 proxy_read_timeout 75s; # 70+5 additional seconds to allow controller to terminate request
90101 }
91102
92103 location /api/v1 {
93- proxy_pass http://$ controllers:{{ .Values.controller.port }} ;
104+ proxy_pass http://controllers;
94105 proxy_read_timeout 75s; # 70+5 additional seconds to allow controller to terminate request
95106 }
96107
@@ -116,7 +127,7 @@ data:
116127 if ($namespace) {
117128 rewrite /(.*) /api/v1/web/${namespace}/$1 break;
118129 }
119- proxy_pass http://$ controllers:{{ .Values.controller.port }} ;
130+ proxy_pass http://controllers;
120131 proxy_read_timeout 75s; # 70+5 additional seconds to allow controller to terminate request
121132 }
122133
0 commit comments