Rate Limiting
NGINX’s limit-rps, limit-rpm, and limit-burst-multiplier annotations are projected by the agentgateway emitter into an AgentgatewayPolicy with spec.traffic.rateLimit.local (requests, unit, and optional burst).
Before: Ingress with rate limits
cat <<'EOF' > ratelimit-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ratelimit-demo
annotations:
nginx.ingress.kubernetes.io/limit-rps: "10"
nginx.ingress.kubernetes.io/limit-burst-multiplier: "2"
spec:
ingressClassName: agentgateway
rules:
- host: api.example.com
http:
paths:
- backend:
service:
name: api-service
port:
number: 8080
path: /
pathType: Prefix
EOFConvert
ingress2gateway print --providers=ingress-nginx --emitter=agentgateway \
--input-file ratelimit-ingress.yaml > ratelimit-agentgateway.yamlAfter: AgentgatewayPolicy with local rate limit
cat ratelimit-agentgateway.yamlThe generated AgentgatewayPolicy uses agentgateway’s LocalRateLimit model. With 10 RPS and a 2x burst multiplier, you get requests: 10, unit: Seconds, and burst: 20:
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayPolicy
metadata:
name: ratelimit-demo
namespace: default
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: ratelimit-demo-api-example-com
traffic:
rateLimit:
local:
- requests: 10
unit: Seconds
burst: 20Apply
kubectl apply -f ratelimit-agentgateway.yaml