envoyproxy / envoy

Cloud-native high-performance edge/middle/service proxy
https://www.envoyproxy.io
Apache License 2.0
24.9k stars 4.79k forks source link

udp_proxy: support deferred cluster selection #36037

Open ohadvano opened 1 month ago

ohadvano commented 1 month ago

I would like to add support for deferring the selection of upstream cluster in UDP proxy flows. The use case I am trying to allow is being able to iterate a UDP session filter chain, where one of the filters in the chain resolves the name of the upstream cluster. Then, by setting some filter state object, we are able to dynamically select the upstream cluster. This is similar behavior to how TCP proxy is able to select upstream cluster based on filter state value (envoy.tcp_proxy.cluster), as described in: https://www.envoyproxy.io/docs/envoy/latest/configuration/advanced/well_known_filter_state

The problem achieving this functionality, is that in current state, udp_proxy is a per-worker instance, and it manages cluster_info objects (which correspond to upstream clusters), and cluster_info manages udp_sessions objects. With this design, it is not possible to first instantiate a UDP session, select the cluster name and then choose the relevant cluster_info.

I would like to refactor the UDP proxy functionality by extracting ownership of UDP sessions from the cluster_info. The UDP proxy will own, separately, the clusters definitions and the sessions, and will do the matching between the UDP session and the cluster, when the data is available (either if known in advance by static configuration or resolved dynamically similar to TCP proxy's capabilities)

cc @mattklein123, @RyanTheOptimist

github-actions[bot] commented 1 week ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

ohadvano commented 1 week ago

not stale