gateway icon indicating copy to clipboard operation
gateway copied to clipboard

Ratelimit Domain should use Gateway class instead of Listener

Open nezdolik opened this issue 1 year ago • 4 comments

Description: EG currently uses Listener as domain for Ratelimit service config. It should instead use Gateway class not to override RL config for a case when when multiple Envoy deployments with diff gateway classes use same RL instance.

Repro steps:

Include sample requests, environment, etc. All data and inputs required to reproduce the bug.

Note: If there are privacy concerns, sanitize the data prior to sharing.

Environment:

Include the environment like gateway version, envoy version and so on.

Logs:

Include the access logs and the Envoy logs.

nezdolik avatar Jun 26 '24 11:06 nezdolik

cc @ryanhristovski

nezdolik avatar Jun 26 '24 11:06 nezdolik

@nezdolik i'm curious why this is happening, im trying to better understand the collision can you share a snippet of the config dump especially the portion of the RateLimit filter section where the domain is specified.

The IR Listener name has the Gateway name and namespace part of it https://github.com/envoyproxy/gateway/blob/d784c3237765aa258c3526b32765dd9c3abf6415/internal/gatewayapi/helpers.go#L360

and I dont think 1 Gateway can be mapped to multiple GatewayClass parents, so unsure whats happening here

arkodg avatar Jun 26 '24 19:06 arkodg

okay found the problem, the ratelimit runner is treating every subscribed message as SoTW https://github.com/envoyproxy/gateway/blob/d784c3237765aa258c3526b32765dd9c3abf6415/internal/globalratelimit/runner/runner.go#L124

but the publisher / gateway-api runner is sending individual messages per gatewayclass https://github.com/envoyproxy/gateway/blob/d784c3237765aa258c3526b32765dd9c3abf6415/internal/gatewayapi/runner/runner.go#L81

arkodg avatar Jun 26 '24 19:06 arkodg

the ratelimit runner will need to perform some additional accounting similar to what gateway-api runner does https://github.com/envoyproxy/gateway/blob/d784c3237765aa258c3526b32765dd9c3abf6415/internal/gatewayapi/runner/runner.go#L68

arkodg avatar Jun 26 '24 19:06 arkodg

/assign

sanposhiho avatar Jul 07 '24 05:07 sanposhiho

Opened a patch PR: https://github.com/envoyproxy/gateway/pull/3771

sanposhiho avatar Jul 07 '24 06:07 sanposhiho