Skip to content

UDPLoadAssignment clone-and-patch carries waypoint metadata and the node-IP address into the udp: cluster, so a waypointed backend is dialled at the wrong host #932

Closed

Description

@bpalermo

UDPLoadAssignment (agent/internal/xds/proxy/egress.go:421-438) rewrites exactly two fields and proto.Clones everything else:

la, _ := proto.Clone(src).(*endpointv3.ClusterLoadAssignment)
la.ClusterName = clusterName
for _, lle := range la.GetEndpoints() {
    for _, lb := range lle.GetLbEndpoints() {
        sa := lb.GetEndpoint().GetAddress().GetSocketAddress()
        if sa == nil { continue }
        sa.Protocol = corev3.SocketAddress_UDP
        sa.PortSpecifier = &corev3.SocketAddress_PortValue{PortValue: port}
    }
}

So Metadata (including the envoy.lb subset keys), Locality, Priority and Endpoint.HealthCheckConfig all survive untouched.

Why that is wrong for the waypoint case

src is the service's shared bare-name load assignment. When a waypoint is in play, ServiceLocalityLbEndpointFromRegistryEndpoint (egress.go:572, address built at :626-637) does not emit the pod's own address — it emits the node IP plus the east-west tunnel port (DefaultEastWestTunnelPort, proxy/edge.go:74), and tags the endpoint with waypoint subset metadata so the HTTP path selects it.

UDPLoadAssignment then rewrites only the port, leaving that node IP in place. The resulting udp: endpoint is <nodeIP>:<appUDPPort> — a host that was never the backend. The datagram goes to the wrong machine, and because the UDP floor has no transport socket and no response path assertion, nothing notices.

The surviving Metadata is inert rather than harmful (the udp: cluster sets no LbSubsetConfig, egress.go:389-411), but a non-zero Priority carried across would also silently partition a single-endpoint cluster.

Why it is not covered

TestUDPLoadAssignment (agent/internal/xds/proxy/egress_test.go:487-546) hand-builds src as a plain single endpoint with no metadata, no priority and no health status, so none of this is exercised. test/envoy_validate's fixture has the same shape — meshInboundLoadAssignment (builders.go:1319-1340) builds one bare endpoint.

Scope

Distinct from #931 and not fixed by it. #931 is about health_status surviving the clone and being wrong; this is about the address surviving in a rewritten-but-still-wrong form. They share a cause — the clone is too permissive about what it carries — so whoever fixes one should look at the other, but they fail differently and need separate tests.

Likely shape of a fix: make UDPLoadAssignment construct the endpoint it wants rather than clone-and-patch, or refuse to rewrite an endpoint whose address is not the backend pod's own.

Untriaged as to whether a waypoint and a UDPRoute can currently coexist on the same service in practice — worth establishing before sizing the fix.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions