-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Ability to Configure Upstream Keepalive #3222
Conversation
/hold |
Need Documentation and Tests. |
45dcfce
to
2d405aa
Compare
Default without any changes:
|
9ad6a01
to
849fe53
Compare
Adding to ConfigMap:
Provides:
|
/hold remove |
/hold cancel |
When providing the following values:
the defaults are retained. |
/assign @ElvinEfendi |
@@ -99,6 +99,8 @@ The following table shows a configuration option's name, type, and the default v | |||
|[variables-hash-bucket-size](#variables-hash-bucket-size)|int|128| | |||
|[variables-hash-max-size](#variables-hash-max-size)|int|2048| | |||
|[upstream-keepalive-connections](#upstream-keepalive-connections)|int|32| | |||
|[upstream-keep-alive](#upstream-keep-alive)|int|60s| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you stick to the existing naming convention of keepalive
rather than keep-alive
? That'll also be consistent with Nginx's naming of respective directives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|int|60s|
I think the default here should be 60
instead of 60s
no? For example keep-alive
setting accepts only integer, and when you provide something like 60s
it logs an error and uses default value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! Forgot to change this part.
UpstreamKeepaliveConnections int `json:"upstream-keepalive-connections,omitempty"` | ||
|
||
// Sets a timeout during which an idle keepalive connection to an upstream server will stay open. | ||
// http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive_timeout | ||
UpstreamKeepAliveTimeOut int `json:"upstream-keepalive-timeout,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use Timeout
instead of TimeOut
, the latter is not consistent with the naming style in the rest of code base
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same goes to KeepAlive
-> Keepalive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense for consistency.
rootfs/etc/nginx/template/nginx.tmpl
Outdated
@@ -417,6 +417,9 @@ http { | |||
{{ if (gt $cfg.UpstreamKeepaliveConnections 0) }} | |||
keepalive {{ $cfg.UpstreamKeepaliveConnections }}; | |||
{{ end }} | |||
|
|||
keepalive_timeout {{ $cfg.UpstreamKeepAliveTimeOut }}s; | |||
keepalive_requests {{ $cfg.UpstreamKeepAliveRequests }}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be inside the if condition above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does make the configuration cleaner!
0d9e38f
to
91a9f2e
Compare
Allows Upstream Keepalive values like keepalive_timeout and keepalive_requests to be configured via ConfigMap. Fixes kubernetes#3099
91a9f2e
to
12955a4
Compare
Removes unneeded ConfigMaps from the Development Environment which are causing ingress-nginx pods to crash Fixes kubernetes#3223
/lgtm side note: it would be great to have an e2e test for configmap where we use all existing settings and assert they are reflected in Nginx config. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: diazjf, ElvinEfendi The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Allows Upstream Keepalive values like keepalive_timeout and keepalive_requests to be configured via ConfigMap.
Fixes #3099