linkerd / linkerd2

Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.
https://linkerd.io
Apache License 2.0
10.57k stars 1.27k forks source link

Throttling Service/Rate Limit #6323

Open dmeytin opened 3 years ago

dmeytin commented 3 years ago

Feature Request

What problem are you trying to solve?

It's unrare that services are requested to be protected by throttling mechanism that could be defined by the following settings:

Client Types:

How should the problem be solved?

The best option is to integrate this feature with Server-side policy. Once the rate limit policy is defined, the proxy will enforce the policy's rules

Any alternatives you've considered?

Integration with an external service, similarly Envoy's implementation

How would users interact with this feature?


apiVersion: v1
kind: ServerSidePolicyRateLimit
metadata:
  name: my-service
  namespace: prod
spec:
  rules: 
    - name: globalthreshold 
       type: global-open-connections
       value: 5000
    - name: requests-per-minute-service
       type: requests-limit
       period: 60s
       value: 1000
       type: service
       selector: other-service
    - name: requests-per-minute-user
       type: requests-limit
       period: 60s
       value: 100
       type: user
       selector: JWT::appid
marcosdotps commented 2 years ago

This has been labelled as design on June 2021, is there any work in progress for this awesome feature? 🤟🏽

olix0r commented 2 years ago

While work on this specific feature hasn't moved forward, we do have some work in flight that will be foundational to implementing a feature like this. The new policy CRDs use the policy attachment pattern to configure server-side policy. Rate limiting resources will fit this same pattern, binding onto Server or route resources. We're currently focused on shipping updated access policies that can be attached to an HTTP route instead of just a Server; but I'd expect other types of policy--e.g., RequestRateLimitPolicy--to follow AuthorizationPolicy

topikachu commented 2 months ago

Any progress here? It's 2024 now.

kflynn commented 2 months ago

Lots of moving parts over the last couple of years, but we're hoping to be able to address this before it stops being 2024. 🤞