feat: add admission control to BackendTrafficPolicy#8872
feat: add admission control to BackendTrafficPolicy#8872jukie wants to merge 28 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
- Change SamplingWindow from *metav1.Duration to *gwapiv1.Duration to satisfy kube-api-linter (nodurations rule) - Add parseSamplingWindow converter in gateway API translator to convert gwapiv1.Duration to metav1.Duration for the IR - Fix unused-parameter lint errors in patchRoute and patchResources by renaming unused params to _ - Regenerate deepcopy, CRD manifests, helm test outputs, and API docs Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Fix merge conflicts from rebase onto upstream/main, fix missing imports in admission control tests, and ensure EvaluationCriteria is always set in the admission control config. Signed-off-by: Adam Buran <aburan28@gmail.com>
- Remove Enabled field (presence of admissionControl implies enabled) - Switch SuccessRateThreshold, Aggression, MaxRejectionProbability from float64 to uint32 to avoid floats in the API layer - Register envoy.filters.http.admission_control in the EnvoyFilter enum - Fix example manifest (srThreshold -> successRateThreshold, integer values) - Regenerate CRDs, deepcopy, docs, and xds translator testdata Signed-off-by: Adam Buran <aburan28@gmail.com>
Remove stale lbPolicy field from cluster output after main merge. Signed-off-by: Adam Buran <aburan28@gmail.com>
Regenerates test/helm/gateway-crds-helm/*.out.yaml and site/content/en/latest/api/extension_types.md to match the current admission control API (int32 percentages, enabled field removed) and pick up envoy.filters.http.admission_control in the filter order enum. Signed-off-by: Adam Buran <aburan28@gmail.com>
…-control Signed-off-by: Adam Buran <aburan28@gmail.com>
…igo lint Signed-off-by: Adam Buran <aburan28@gmail.com>
…map, add gatewayapi testdata - Revert the HCM HTTP filter ordering shifts in newOrderedHTTPFilter; the admission_control filter is registered as an upstream cluster filter, so it does not need a slot in the downstream HCM ordering. - Move the gRPC status-code lookup map to a package-level var so it is not rebuilt on every translation cycle. - Add backendtrafficpolicy-admission-control gatewayapi testdata covering both gateway-targeted (gRPC success criteria, all knobs set) and route-targeted (HTTP success criteria, minimal config) policies. Signed-off-by: Adam Buran <adam.buran@gmail.com> Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: Adam Buran <aburan28@gmail.com>
Signed-off-by: jukie <10012479+jukie@users.noreply.github.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Signed-off-by: jukie <10012479+jukie@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d59ae24657
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8872 +/- ##
==========================================
+ Coverage 74.36% 74.39% +0.02%
==========================================
Files 246 247 +1
Lines 39292 39385 +93
==========================================
+ Hits 29221 29300 +79
- Misses 8041 8049 +8
- Partials 2030 2036 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: jukie <10012479+jukie@users.noreply.github.com>
|
Codex Review: Didn't find any major issues. You're on a roll. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
| gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" | ||
| ) | ||
|
|
||
| // AdmissionControl defines the admission control policy to be applied. |
There was a problem hiding this comment.
Non-blocking nit: the comments could be made clearer to make them easier for users to understand.
| // AdmissionControl defines the admission control policy to be applied. | |
| // AdmissionControl configures health-based load shedding for upstream backends. | |
| // | |
| // Envoy tracks recent upstream responses over a sliding sampling window. When the | |
| // observed success rate drops below the configured threshold, Envoy | |
| // probabilistically rejects new requests before forwarding them upstream. This can | |
| // reduce pressure on degraded backends and give them time to recover. | |
| // | |
| // All fields are optional. When omitted, Envoy's admission control defaults are used. | |
| // | ||
| // +optional | ||
| // +kubebuilder:validation:Minimum=0 | ||
| RPSThreshold *uint32 `json:"rpsThreshold,omitempty"` |
There was a problem hiding this comment.
Nit: A more explicit name like minTrafficThreshold is easier to understand for a user-facing API.
| // | ||
| // +optional | ||
| SuccessCriteria *AdmissionControlSuccessCriteria `json:"successCriteria,omitempty"` | ||
| } |
There was a problem hiding this comment.
This API is flat, and some of the field names inherited from the Envoy config aren’t very intuitive, which makes it a bit harder to read. How about(the names are not final, just for discussion):
admissionControl:
samplingWindow: 30s
minRequestRate: 10
successRateThreshold: 90
rejection:
maxRejectionPercent: 80
rampFactor: 2
successCriteria:
http:
statusCodes:
- 200
- 201
- 204
grpc:
statusCodes:
- OK
- UNAVAILABLE
There was a problem hiding this comment.
Do we have any existing fields you feel would be closer to the aggression Envoy description? I didn't see any How about rejectionSensitivity?
This would add a nested layer for just two fields so I'd prefer just keeping flat here but I'm willing to change it.
| // Defaults to 30s if not specified. | ||
| // | ||
| // +optional | ||
| SamplingWindow *gwapiv1.Duration `json:"samplingWindow,omitempty"` |
There was a problem hiding this comment.
Raised by codex: samplingWindow accepts values like 0s and 500ms, and the translator forwards them to Envoy. Envoy truncates the configured window to whole seconds and later divides request count by that second count in admission-control RPS calculation, so these accepted values can produce a zero-second denominator after traffic is recorded. Add validation requiring at least 1s, with CEL coverage for 0s and a sub-second value.
| EnvoyFilterFault EnvoyFilter = "envoy.filters.http.fault" | ||
|
|
||
| // EnvoyFilterAdmissionControl defines the Envoy HTTP admission control filter. | ||
| EnvoyFilterAdmissionControl EnvoyFilter = "envoy.filters.http.admission_control" |
There was a problem hiding this comment.
The AdmissionControl filter should not be exposed here. It's used as an upstream filter, and it can't be reordered like other HCM filters.
What this PR does / why we need it:
This carries forward #7529 from @aburan28
This PR adds support for Envoy's Admission Control filter to Envoy Gateway by exposing it through
BackendTrafficPolicy.Admission control probabilistically rejects requests based on the historical success rate of upstream requests within a configurable sliding time window. This provides client-side load shedding for overloaded or degraded backends and complements circuit breaking and retry policies.
Changes include
AdmissionControlwith configurablesamplingWindow,successRateThreshold,aggression,rpsThreshold,maxRejectionProbability, and success criteria for HTTP and gRPC.admissionControlfield.envoy.filters.http.admission_controlas an upstream HTTP filter on generated clusters.envoy.filters.http.admission_controlas a known Envoy filter.Release Notes: Yes