Skip to content

xds translator for udp route#709

Merged
arkodg merged 3 commits intoenvoyproxy:mainfrom
zhaohuabing:udproute-xds-translator
Nov 9, 2022
Merged

xds translator for udp route#709
arkodg merged 3 commits intoenvoyproxy:mainfrom
zhaohuabing:udproute-xds-translator

Conversation

@zhaohuabing
Copy link
Copy Markdown
Member

@zhaohuabing zhaohuabing commented Nov 8, 2022

xds translator for udp route
This PR is a part of #641
Signed-off-by: zhaohuabing zhaohuabing@gmail.com

@zhaohuabing zhaohuabing requested a review from a team as a code owner November 8, 2022 01:38
@zhaohuabing zhaohuabing force-pushed the udproute-xds-translator branch 3 times, most recently from 0a8cd0d to 870a097 Compare November 8, 2022 02:01
@zhaohuabing zhaohuabing changed the title xds translator for udp route(WIP) xds translator for udp route Nov 8, 2022
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.

From the UDP Stats docs:

The UDP proxy filter emits both its own downstream statistics as well as many of the cluster upstream statistics where applicable. The downstream statistics are rooted at udp.<stat_prefix>.

With that said, statPrefix will cause stats to be generated with a prefix of udp.udp. Maybe use service as the value? Thoughts @arkodg @lizan?

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.

good point @danehans , I think we followed a similar pattern for other protocols too, will raise a issue to track and fix for all

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.

Can you create an issue and xref in your 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.

the xds code is complicated as is, prefer if we moved all these validations checks to higher levels such as IR or Gateway - API

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@danehans @arkodg So we agreed that all the validation should be in Gateway translator and assume the configuration passed down to XDS translator is correct?

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.

yeah I prefer that because that layer has the ability to signal back to the user using the Status and it performs a lot of the port conflict checks already today

if len(info.protocols) > 1 {

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.

Is the 1:1 b/c UDPRoute does not support any of the UDP matcher rules, e.g. source IP?

Copy link
Copy Markdown
Member Author

@zhaohuabing zhaohuabing Nov 9, 2022

Choose a reason for hiding this comment

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

@danehans Envoy can route UDP diagrams to different upstream clusters according to their soure IP, but the Gateway API doesn't support that. The same as TCPRoute. So I think the current implementaion is fine, if Gateway API add support to UDP/TCP source IP matching, we can revisit here and support it.

Envoy UDP route: https://www.envoyproxy.io/docs/envoy/latest/configuration/listeners/udp_filters/udp_proxy#routing

Gateway UDPRoute API: https://gateway-api.sigs.k8s.io/v1alpha2/references/spec/#gateway.networking.k8s.io/v1alpha2.UDPRouteSpec

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.

why is the find needed here, is there any case where we want to support udp and another protocol on the same addr:port ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, but we need to throw an error in case there are two listeners on the same UDP ports.

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.

i think this case should be handled in the Gateway API translator itself, which has enough info to detect this as well as signal back to the user using the UDPRoute Status sub resource, prefer if this code is simpler

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

u also enhance this PR with ac

sure

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

i think this case should be handled in the Gateway API translator itself, which has enough info to detect this as well as signal back to the user using the UDPRoute Status sub resource, prefer if this code is simpler

OK, we can remove the check here if Gateway API translator can detect it in the first place.

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Nov 9, 2022

hey @zhaohuabing can you also enhance this PR with access logs for UDP Proxy similar to whats done in #704

Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
@zhaohuabing zhaohuabing force-pushed the udproute-xds-translator branch from 870a097 to 23ebf6f Compare November 9, 2022 11:46
Signed-off-by: zhaohuabing <zhaohuabing@gmail.com>
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

Merging #709 (e7a81a8) into main (9eecce6) will increase coverage by 0.19%.
The diff coverage is 83.87%.

@@            Coverage Diff             @@
##             main     #709      +/-   ##
==========================================
+ Coverage   63.35%   63.54%   +0.19%     
==========================================
  Files          47       47              
  Lines        5834     5920      +86     
==========================================
+ Hits         3696     3762      +66     
- Misses       1907     1921      +14     
- Partials      231      237       +6     
Impacted Files Coverage Δ
internal/xds/translator/translator.go 72.99% <72.72%> (-1.39%) ⬇️
internal/xds/translator/listener.go 81.09% <87.32%> (+1.91%) ⬆️
internal/provider/kubernetes/helpers.go 73.91% <0.00%> (-6.53%) ⬇️
internal/provider/kubernetes/gateway.go 49.68% <0.00%> (-2.56%) ⬇️
internal/provider/kubernetes/gatewayclass.go 71.73% <0.00%> (-0.73%) ⬇️
internal/provider/kubernetes/tlsroute.go 64.31% <0.00%> (+4.84%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Copy Markdown
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

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

LGTM, looks good, thanks !

@arkodg arkodg merged commit 2a3c995 into envoyproxy:main Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants