-
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
feat: Add grpc timeouts annotations #11258
Conversation
Welcome @Anddd7! |
Hi @Anddd7. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
✅ Deploy Preview for kubernetes-ingress-nginx ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@Anddd7 TODO add docs for annoations and configmap |
@Anddd7 thanks for this contribution. It helps. I am not a developer. So can you help me locate where you are creating the pod that runs the grpc server for test backend |
2297425
to
f1aed2b
Compare
@longwuyuan to avoid bringing big changes, i set the grpc timeouts with existing proxy timeouts when backend protocol is 'grpc/grpcs'. so we can simply reuse I add 2 more e2e test in |
@@ -700,6 +700,14 @@ In some scenarios is required to have different values. To allow this we provide | |||
- `nginx.ingress.kubernetes.io/proxy-next-upstream-tries` | |||
- `nginx.ingress.kubernetes.io/proxy-request-buffering` | |||
|
|||
If you indicate [Backend Protocol](#backend-protocol) as `GRPC` or `GRPCS`, the following values will be applied to gRPC connection as well: |
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.
can you define the defaults or point to the docs of them please :) users may not know what {{ proxy_connect_timeout }} means. Thanks!!!
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.
Or maybe just point to nginx docs to the defaults and say they can be configured somewhere else
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.
Yeah, please point to the docs.nginx. thanks https://nginx.org/en/docs/http/ngx_http_grpc_module.html#grpc_send_timeout
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.
sure, i added the default values (same as proxy_*_timout) and nginx docs
/ok-to-test So far looks good to me. I am wondering if we want different annotations for gRPC, but it does make sense to follow the same proxy-timeout from backend. @longwuyuan I will leave the lgtm to you, after fixing the docs |
@@ -1481,6 +1481,13 @@ stream { | |||
proxy_next_upstream_timeout {{ $location.Proxy.NextUpstreamTimeout }}; | |||
proxy_next_upstream_tries {{ $location.Proxy.NextUpstreamTries }}; | |||
|
|||
{{ if or (eq $location.BackendProtocol "GRPC") (eq $location.BackendProtocol "GRPCS") }} | |||
# Grpc settings |
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.
question: what happens if the user does not set the proxy configuration timeout? I can't remember if there are defaults for connecttimeout, sendtimeout, etc.
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.
The proxy default timeouts (5s,60s,60s) is configured in defuault backend in
/approve cancel @Anddd7 just one question on defaults, maybe we just want to set the values if they are defined on annotations, otherwise leave as is. This would avoid breaking changes (I'm not sure if the default proxy_timeout and others defaults are the same for gRPC, if you can just double check it I appreciate it) |
all tests passed after rebase, feel free to review and comment |
Thank you 🙏 I have added this to my list, will finish review this week. |
grpc_connect_timeout {{ $location.Proxy.ConnectTimeout }}s; | ||
grpc_send_timeout {{ $location.Proxy.SendTimeout }}s; | ||
grpc_read_timeout {{ $location.Proxy.ReadTimeout }}s; |
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 would be interesting to change the data type from Int
to time.Duration
, allowing the configuration to be done in milliseconds instead only of in seconds.
Even more interesting would be to have explicit configurations for gRPC backends instead of reusing the global proxy settings. Only use the global ones if the specific ones are not set.
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.
Like as comment in issue
...
annotations:
nginx.ingress.kubernetes.io/grpc_read_timeout: 3600
nginx.ingress.kubernetes.io/grpc_send_timeout: 3600
...
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.
Changing the default unit may not be something that should be included in this PR. Because modifying the time unit will break many existing configurations.
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.
@msfidelis Would you want to create an issue for tracking this?
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.
Thank you for your contributions!
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Anddd7, tao12345666333, YannickZ 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 |
Hi @tao12345666333, I wrote here: #11250 (comment) that this is possible breaking change and should be noted in release notes. |
For streaming calls we also need to increase |
@Anddd7 can you submit a new PR just to add |
@Anddd7 And it seems it works in all three contexts ( http, server, location) https://nginx.org/en/docs/http/ngx_http_core_module.html#client_header_timeout |
See related issue #12177 |
sure, i'll take a look. i saw #12212 , that would be a better way to manage those |
What this PR does / why we need it:
This PR adds support for grpc timeout settings via annotations. To avoid introducing security issues with
server-snippets
, we need a more direct way to configure the nginx grpc module.Types of changes
Which issue/s this PR fixes
fixes #11250
How Has This Been Tested?
with unit tests and e2e tests
Checklist: