Skip to content

allow setting per connection buffer limit on Gateway with annotation - #11505

Merged
puertomontt merged 1 commit into
kgateway-dev:mainfrom
puertomontt:perconnbufflim-gateway
Jun 27, 2025
Merged

allow setting per connection buffer limit on Gateway with annotation#11505
puertomontt merged 1 commit into
kgateway-dev:mainfrom
puertomontt:perconnbufflim-gateway

Conversation

@puertomontt

@puertomontt puertomontt commented Jun 27, 2025

Copy link
Copy Markdown
Contributor

Description

#11387

Allow setting listener-level perConnectionBufferLimitBytes.

Change Type

/kind new_feature

Changelog

Allow setting listener-level perConnectionBufferLimitBytes by setting the `kgateway.dev/per-connection-buffer-limit` annotation on the gateway. 

Additional Notes

We discussed several options for setting perConnectionBufferLimitBytes.

  • Creating new policy for listener options
    • decided against this since it was overkill to create a new policy for one field, and we're unlikely to have other listener level fields even in future
  • adding this option to GatewayParameters
    • while this makes sense, it will require a lot of up front work to refactor it out of deployer and into krt collections

We decided using an annotation on the gateway made sense and was straightforward to implement.

Copilot AI review requested due to automatic review settings June 27, 2025 04:37
@github-actions github-actions Bot added do-not-merge/release-note-invalid Indicates that a PR should not merge because it's missing one of the release note labels. kind/feature Categorizes issue or PR as related to a new feature. labels Jun 27, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces support for a new annotation (kgateway.dev/per-connection-buffer-limit) that sets a per-connection buffer limit on Gateway listeners. Key changes include:

  • Adding PerConnectionBufferLimitBytes fields to IR structs and backend Gateway representation
  • Parsing the annotation into a uint32 in the KRT indexer
  • Propagating the limit into Envoy listener configs via the IR translator
  • Adding an end-to-end translator test for the new feature

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/pluginsdk/ir/gw2.go Added PerConnectionBufferLimitBytes to ListenerIR and GatewayIR
pkg/pluginsdk/ir/backend.go Added PerConnectionBufferLimitBytes to backend Gateway IR
internal/kgateway/translator/irtranslator/gateway.go Populating listener’s PerConnectionBufferLimitBytes in Envoy config
internal/kgateway/translator/gateway_translator.go Mapping limit on translator output
internal/kgateway/krtcollections/policy.go Parsing annotation into uint32 and attaching to Gateway IR
api/annotations/gateway.go Declared annotation constant
internal/kgateway/translator/gateway/gateway_translator_test.go Added translator test case for per-connection buffer limit
Comments suppressed due to low confidence (1)

internal/kgateway/translator/gateway/gateway_translator.go:87

  • The per-connection buffer limit is being applied at the gateway level here, but it should be applied per listener. Remove or relocate this field mapping and ensure it’s set individually on each listener in Translate.
		PerConnectionBufferLimitBytes: gateway.PerConnectionBufferLimitBytes, // wrong place???

Comment thread internal/kgateway/translator/irtranslator/gateway.go
@puertomontt
puertomontt force-pushed the perconnbufflim-gateway branch from 0056d29 to 2ab9bb0 Compare June 27, 2025 04:38
@puertomontt
puertomontt force-pushed the perconnbufflim-gateway branch from 2ab9bb0 to 3c277b6 Compare June 27, 2025 04:46
@github-actions github-actions Bot added release-note and removed do-not-merge/release-note-invalid Indicates that a PR should not merge because it's missing one of the release note labels. labels Jun 27, 2025
@puertomontt
puertomontt added this pull request to the merge queue Jun 27, 2025
Merged via the queue into kgateway-dev:main with commit 86a48c0 Jun 27, 2025
22 of 24 checks passed
@puertomontt
puertomontt deleted the perconnbufflim-gateway branch June 27, 2025 17:11
@lgadban lgadban mentioned this pull request Jul 1, 2025
3 tasks
@lgadban

lgadban commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

design doc: #11515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature Categorizes issue or PR as related to a new feature. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffering Limits

5 participants