Repository navigation
controller: expose remote rate-limit limitOverride - #2839
Conversation
There was a problem hiding this comment.
Pull request overview
This PR exposes an optional limitOverride CEL expression on Kubernetes RateLimitDescriptor, validates it as CEL, and forwards it into the existing xDS LimitOverride field during traffic policy translation so descriptor-level dynamic overrides can be used from AgentgatewayPolicy.
Changes:
- Add
limitOverrideto theRateLimitDescriptorAPI type and document its expected evaluated shape. - Extend
processRateLimitDescriptortranslation to validate and maplimitOverrideinto the generated xDS descriptor. - Update translation testdata to cover successful mapping and invalid-CEL status messaging.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| controller/pkg/agentgateway/plugins/traffic_plugin.go | Adds LimitOverride validation/mapping in remote rate-limit descriptor translation. |
| controller/pkg/agentgateway/plugins/testdata/trafficpolicy/global-rl.yaml | Adds a positive golden case showing limitOverride is forwarded into output. |
| controller/pkg/agentgateway/plugins/testdata/trafficpolicy/global-rl-invalid-cel.yaml | Adds invalid CEL coverage for limitOverride and updates expected status message/output. |
| controller/api/v1alpha1/agentgateway/agentgateway_policy_types.go | Adds the limitOverride field to the Kubernetes API type with documentation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if !isCEL(*descriptor.LimitOverride) { | ||
| errs = append(errs, fmt.Errorf("rate limit descriptor limit override is not a valid CEL expression: %s", *descriptor.LimitOverride)) | ||
| } | ||
| limitOverride = new(string(*descriptor.LimitOverride)) |
|
@FenjuFu PTAL and resolve the CI failures and copilot review comment. |
Regenerate the CRD schema and deepcopy for the new limitOverride field (controller-gen was not re-run), and correct the global-rl-invalid-cel golden to the plugin's actual multi-line validation message. Resolves the controller-test failure (unknown field spec.traffic.rateLimit.global .descriptors[].limitOverride). Signed-off-by: FenjuFu <[email protected]>
3e46ee1 to
91d3bf0
Compare
|
@danehans thanks for the nudge — pushed a fix. Summary of what was failing and why: controller-test — The new
DCO — added the Copilot comment on PTAL when you get a chance. |
What changed
limitOverrideon KubernetesRateLimitDescriptor.LimitOverridefield.Why
Standalone configuration, the internal API, and the data plane already support descriptor-level dynamic limit overrides, but
AgentgatewayPolicycurrently rejects or prunes the field and cannot translate it.Validation performed
gofmt.git diff --checkpasses.Draft follow-up
The repository API generator is a Bash pipeline and this Windows environment has no Bash/Make. Generated deepcopy/CRD/client/reference artifacts are therefore not included yet. This draft is intentionally not ready for review until the Linux generator is run and focused tests pass; CI output can also identify the exact generated diff required.
Fixes #2807.