[2.3] added max_headers_count setting to ListenerPolicy (#14188)#14207
Merged
andy-fong merged 5 commits intoJun 9, 2026
Merged
Conversation
…#14188) Signed-off-by: Andy Fong <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Backport of #14188 to the 2.3 branch adding a maxHeadersCount knob to ListenerPolicy/HTTPSettings, translating it into Envoy HCM commonHttpProtocolOptions.max_headers_count, and covering it with translator golden tests plus an e2e enforcement check.
Changes:
- Add
maxHeadersCountto the CRD + API types (with validation) and generated deepcopy. - Plumb/merge the setting through listenerpolicy IR and apply it onto Envoy’s
HttpConnectionManager. - Add translator fixtures + tests, and a new e2e test + manifest validating runtime behavior.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/features/listener_policy/types.go | Adds manifest path constant for the new e2e scenario. |
| test/e2e/features/listener_policy/testdata/listener-policy-max-headers-count.yaml | New ListenerPolicy manifest setting maxHeadersCount. |
| test/e2e/features/listener_policy/suite.go | Registers and implements TestListenerPolicyMaxHeadersCount e2e test. |
| pkg/kgateway/translator/gateway/testutils/outputs/listener-policy-http/max-headers-count.yaml | New expected translated output verifying maxHeadersCount on HCM. |
| pkg/kgateway/translator/gateway/testutils/outputs/listener-policy-http/max-headers-count-with-max-requests.yaml | New expected output verifying maxHeadersCount coexists with maxRequestsPerConnection. |
| pkg/kgateway/translator/gateway/testutils/outputs/listener-policy-http/max-headers-count-merge-conflict.yaml | New expected output verifying merge/override behavior for maxHeadersCount. |
| pkg/kgateway/translator/gateway/testutils/inputs/listener-policy-http/max-headers-count.yaml | New translator input fixture for maxHeadersCount. |
| pkg/kgateway/translator/gateway/testutils/inputs/listener-policy-http/max-headers-count-with-max-requests.yaml | New input fixture combining maxHeadersCount + maxRequestsPerConnection. |
| pkg/kgateway/translator/gateway/testutils/inputs/listener-policy-http/max-headers-count-merge-conflict.yaml | New input fixture to exercise merge conflict behavior. |
| pkg/kgateway/translator/gateway/gateway_translator_test.go | Adds new translator test cases for the fixtures (currently contains a compile-breaking field name issue). |
| pkg/kgateway/extensions2/plugins/listenerpolicy/merge_http.go | Adds merge function to combine maxHeadersCount across policies. |
| pkg/kgateway/extensions2/plugins/listenerpolicy/listener_plugin.go | Applies maxHeadersCount onto Envoy HCM common HTTP protocol options. |
| pkg/kgateway/extensions2/plugins/listenerpolicy/http.go | Extends IR + equality + policy translation to carry maxHeadersCount. |
| install/helm/kgateway-crds/templates/gateway.kgateway.dev_listenerpolicies.yaml | CRD schema update adding maxHeadersCount. |
| install/helm/kgateway-crds/templates/gateway.kgateway.dev_httplistenerpolicies.yaml | CRD schema update adding maxHeadersCount. |
| api/v1alpha1/kgateway/zz_generated.deepcopy.go | Deepcopy update for HTTPSettings.MaxHeadersCount. |
| api/v1alpha1/kgateway/listener_policy_types.go | API type update adding MaxHeadersCount with validation/docs. |
Files not reviewed (1)
- api/v1alpha1/kgateway/zz_generated.deepcopy.go: Language not supported
Signed-off-by: Andy Fong <[email protected]>
Signed-off-by: Andy Fong <[email protected]>
Signed-off-by: Andy Fong <[email protected]>
Signed-off-by: Andy Fong <[email protected]>
jenshu
approved these changes
Jun 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
backport of #14188
Change Type
/kind fix
Changelog