Skip to content

Document the TokenRateLimitPolicy #1344

@david-martin

Description

@david-martin
  • Reference pages

  • Tutorial &/or Guide for either/both

  • Include how to use it and an an AuthPolicy
    See the RFC example API

      ```yaml
      apiVersion: kuadrant.io/v1
      kind: AuthPolicy
      metadata:
        name: free-users-auth
      spec:
        targetRef:
          group: gateway.networking.k8s.io
          kind: Gateway
          name: my-llm-gateway
        rules:
          authorization:
            "free-users":
              opa:
                rego: |
                  groups := split(object.get(input.auth.identity.metadata.annotations, "kuadrant.io/groups", ""), ",")
                  allow { groups[_] == "free" }
      ---
      apiVersion: v1
      kind: Secret
      metadata:
        name: api-key-free-user-1
          app: my-llm
        annotations:
          kuadrant.io/groups: free
          secret.kuadrant.io/user-id: user-1
      stringData:
        api_key: iamafreeuser
      type: Opaque
      ---
      apiVersion: kuadrant.io/v1alpha1
      kind: TokenRateLimitPolicy
      metadata:
        name: token-limit-free
      spec:
        targetRef:
          group: gateway.networking.k8s.io
          kind: Gateway
          name: my-llm-gateway
        limit:
          rate:
            limit: 20000
            window: 1d
          predicate: 'request.auth.claims["kuadrant.io/groups"].split(",").exists(g, g == "free")' 
          counter: auth.identity.userid
      ```
    
  • Also consider a blog post to announce

Pull Requests:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions