Skip to content

GEP: Gateway API should support basic rate limiting (aka throttling) per (sub)path. #326

@nielsbasjes

Description

@nielsbasjes

See also: kubernetes/ingress-nginx#6011
What would you like to be added:

I would like to be able to have rate limiting (throttling) as part of the standard way of defining an Ingress.
By having this a part of the api the various backends can start implementing support for it.

Why is this needed:

In general there is a need for limiting the rate at which requests are allowed to avoid overloading the servers.
Having this at this level would make this very easy to use in many places.

Also I found that in many situations the rate limit depends on the exact path.
Some are easy for the server to handle (send static content) and some are hard (like build a complex report).
So in general I want to specifiy the rat limits per sub-path on a specific ingress.

What I have in mind

Right now you can defined per host which (Prefix) paths should go to which service.
My first idea is that having the limits per prefix path of that service is probably enough for most usecases.

My first rough sketch looks like this:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
spec:
  rules:
    - host: something.example.nl
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: something-service
                port:
                  number: 80
            rateLimits:
              - path: /      # I would do this relative to the 'parent path', implicitly this is always "pathType: Prefix"
                byCookie: jsessionid
                #byHeader: customerid
                #byIP
                # If nothing is specified then "global limit"
                maxPerSecond: 5
                allowBurst: 10
                delayBurst: false
              - path: /reporting
                #byCookie: jsessionid
                byHeader: customerid
                #byIP
                # If nothing is specified then "global limit"
                maxPerSecond: 1
                allowBurst: 2
                delayBurst: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.kind/gepPRs related to Gateway Enhancement Proposal(GEP)priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete.

    Type

    No type

    Projects

    Status

    Withdrawn

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions