-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support rate-limiting for ingress-resources #4603
Comments
Hi @dbaumgarten thanks for reporting! Be sure to check out the docs and the Contributing Guidelines while you wait for a human to take a look at this 🙂 Cheers! |
Thanks @dbaumgarten Your second statement about global rate limiting is actually something that we have been looking at. |
Re-using the existing policies is an interesting idea. Being able to use policies with ingress-objects would bring a lot of interesting features. (For example currently you also need to use snippets fo IP-based white/black-listing. Currently we simply have fixed rate-limits in place via snippets. A http-snippet in the configmap for creating the zone and location-snippets in the ingresses to apply the zone to them. However in a recent incident we noticed that the rate-limiting becomes less effective the more ingress-replicas are running. The "simplest" way would be to create a seperate controller that automatically modifies the configmap accordingly. Rate-limiting is quite essential for reliably running a service. So supporting this properly would probably help quite a few people. |
Hi @dbaumgarten Thank you for opening this issue! I'm going to pass this issue by the team for discussion before we suggest opening an PR. |
If we can keep this simple and scoped to only the rate limit annotation and corresponding template changes, that would be great. |
Is there any hint on how far down the roadmap global rate-limiting is? |
I totally understand. My concern about a controller that does math is that there are edges that will need to tune or disable the calculation behavior. This is mainly why I prefer the proxy give the project the tools and I will be checking with them again around that. We also like to keep PRs small and constrained and would like to see the annotation as a separate PR from the controller doing calculations. |
Doing this as separate PRs is absolutely the way to go here. First the basic annotations and then everything else. I understand that there are potential issues with the auto-scaling-calculations in advanced setups. My suggestion would be to start with a PR that adds the basic annotations. Once that is done and accepted I follow up with a proposal for the calculation-approach. |
So, here is my first draft: #4660 There are a few things that I am a bit unsure about:
|
Any feeback/suggestions on my open questions? |
Hi @dbaumgarten we'll be taking a look at the PR, thanks for your patience! |
Is your feature request related to a problem? Please describe.
To properly secure our applications running behind nginx-ingress we need to implement rate-limiting on source-IP basis. Nginx does already support this. However the ingress-controller has no direct support for this. You need to use snippets (in the configmap AND in the ingress-resources).
Additionally rate-limits implemented with snippets do not work well with pod-autoscaling. The rate-limits are per-pod, and if autoscaling adds more pods, it will accidentally also increase the total rate-limit.
Describe the solution you'd like
It would be great to have the rate-limiting feature available via the usual annotations. Something like:
Additionally it would be great if the ingress controller would (optionally) scale this value by the amount of currently running ingress-pods.
Describe alternatives you've considered
Implement rate-limiting via snippets and implement a custom controller that dynamically modifies the nginx-configmap according to the current amount of running nginx-pods.
Additional context
I would like to implement this feature myself and open a PR.
But I though it would be good to first ask if you would accept such a PR at all.
The text was updated successfully, but these errors were encountered: