Conversation
8f8a034 to
22d1677
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7824 +/- ##
==========================================
+ Coverage 73.70% 73.73% +0.02%
==========================================
Files 237 237
Lines 35703 35747 +44
==========================================
+ Hits 26316 26359 +43
+ Misses 7529 7528 -1
- Partials 1858 1860 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
22d1677 to
7734d4f
Compare
7734d4f to
f625688
Compare
|
cc @guydc is there any prior art for policy related metadata |
|
Hi,
|
| SectionName string `json:"sectionName,omitempty" yaml:"sectionName,omitempty"` | ||
|
|
||
| // TrafficPolicy is the NamespacedName of the TrafficPolicy resource associated with this resource | ||
| // If merged with parent policy, users need to check the status to find more details. |
we can resuse the |
|
hey we discussed this in the community meeting this week, this is a great feature but hoping you can give more clarity on the use case
|
|
Generally, the user case is to find out the policy(we can add Security Policy) applied to the route when client received a non 200 resposne. |
|
For that specific case, shouldnt the metadata be on the RBAC filter ? |
RBAC is for 4xx, and 429 for ratelimit. this'a a general solution for any xPolicy, either from Envoy Gateway Extensions or Gateway API BTW, can you elaborate a little more about set metadata to the RBAC filter? |
|
Now, the Envoy have supported a filter state to record the filter name that return the local response ( Anyway, for now, there is no general way to attach additional metadata for single Although part of our filters support metadata in their configuration, but it's implementation detail of the filter and Envoy's core will not aware it. Or in the future, we can try the envoyproxy/envoy#42912, which could provide the actual per route filter, then, the plugin name could be used to map the policy name directly. |
|
|
AFAIU, this provides a generic way of listing what policies have taken place for a given request, to help users troubleshoot and understand where errors may be coming from. The current impl is the starting point (starting with BTP) and the idea is to be able to expand to other types when needed, as the approach is meant to be generic. |
f625688 to
d74c104
Compare
✅ Deploy Preview for cerulean-figolla-1f9435 canceled.
|
internal/ir/xds.go
Outdated
|
|
||
| // TrafficPolicy is the NamespacedName of the TrafficPolicy resource associated with this resource | ||
| // If merged with parent policy, users need to check the status to find more details. | ||
| TrafficPolicy *types.NamespacedName `json:"trafficPolicy,omitempty" yaml:"trafficPolicy,omitempty"` |
There was a problem hiding this comment.
can we make this generic like []Policies and also include Kind ?
There was a problem hiding this comment.
we dont seem to use it for other resources so its fine to not include for now imo
internal/xds/translator/testdata/in/xds-ir/http-route-with-trafficpolicy-metadta.yaml
Show resolved
Hide resolved
188284d to
5f9f8bb
Compare
33fa670 to
c7dc2b8
Compare
internal/xds/translator/metadata.go
Outdated
| policyList := &structpb.ListValue{} | ||
|
|
||
| for _, policy := range metadata.Policies { | ||
| policyList.Values = append(policyList.Values, buildTrafficPolicyMetadata(policy)) |
There was a problem hiding this comment.
| policyList.Values = append(policyList.Values, buildTrafficPolicyMetadata(policy)) | |
| policyList.Values = append(policyList.Values, buildpolicyMetadata(policy)) |
|
hey @zirain this is looking good, the question I have is how is |
c7dc2b8 to
573ddd6
Compare
resources is what always be there, policies is optional. |
|
thanks, this LGTM, wdyt @guydc |
f8c9012 to
2649d65
Compare
Signed-off-by: zirain <zirain2009@gmail.com>
2649d65 to
8e7d18a
Compare
* feat: xds policy metadata Signed-off-by: zirain <zirain2009@gmail.com> * fix gen Signed-off-by: zirain <zirain2009@gmail.com> * fix lint Signed-off-by: zirain <zirain2009@gmail.com> * use slice Signed-off-by: zirain <zirain2009@gmail.com> * add test Signed-off-by: zirain <zirain2009@gmail.com> * name Signed-off-by: zirain <zirain2009@gmail.com> --------- Signed-off-by: zirain <zirain2009@gmail.com> Signed-off-by: Sadmi Bouhafs <sadmibouhafs@gmail.com>
This's an alternative for #6801, users should be able to dump the policies applied to the route with command
%METADATA(ROUTE:envoy-gateway:policies)%.This will help users to find which policy cause 429 response.
Sample output as following:
{ ":authority": "172.18.255.201", "authorization": null, "bytes_received": 0, "bytes_sent": 0, "downstream_local_address": "10.244.2.26:10080", "downstream_remote_address": "172.18.0.1:55720", "duration": 2, "method": "GET", "policies": [ { "kind": "BackendTrafficPolicy", "name": "policy-httproute", "namespace": "default" } ], "protocol": "HTTP/1.1", "ratelimit": { "descriptors": [ { "entries": [ "httproute/default/http-ratelimit/rule/0/match/0/*=httproute/default/http-ratelimit/rule/0/match/0/*", "rule-0-match-0=rule-0-match-0" ] } ], "domain": "default/eg/http" }, "request_headers_bytes": 224, "requested_server_name": null, "response_code": 429, "response_code_details": "request_rate_limited", "response_flags": "RL", "route_name": "httproute/default/http-ratelimit/rule/0/match/0/*", "start_time": "2025-12-30T03:23:15.726Z", "upstream_cluster": "httproute/default/http-ratelimit/rule/0", "upstream_duration": null, "upstream_host": null, "upstream_local_address": null, "upstream_transport_failure_reason": null, "user-agent": "curl/8.7.1", "x-envoy-origin-path": "/echo", "x-envoy-upstream-service-time": null, "x-forwarded-for": "172.18.0.1", "x-request-id": "551f54cd-e7f3-49f8-a574-fcda06bceab0" }