Skip to content

test(conformance): Add UDPRoute conformance tests for GEP-2645 - #4861

Merged
k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
zac-nixon:znixon/udp-std-conformance
May 19, 2026
Merged

k8s-ci-robot merged 5 commits into
kubernetes-sigs:mainfrom
zac-nixon:znixon/udp-std-conformance

Conversation

@zac-nixon

@zac-nixon zac-nixon commented May 15, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature
/area conformance

What this PR does / why we need it

Adds the conformance tests required by GEP-2645 (UDPRoute), exercising listener attachment, status conditions, and weighted backend distribution for UDPRoute.

It also lands the supporting infrastructure those tests depend on:

  • A GATEWAY-UDP conformance profile mirroring GATEWAY-TLS.

Conformance tests added

Test ShortName Description
udproute-invalid-backendref-nonexistent UDPRouteInvalidBackendRefNonexistent A UDPRoute should set ResolvedRefs=False with reason BackendNotFound when its backendRef points to a Service that does not exist.
udproute-invalid-cross-namespace-backend-ref UDPRouteInvalidCrossNamespaceBackendRef A UDPRoute in the gateway-conformance-infra namespace should set ResolvedRefs=False with reason RefNotPermitted when its backendRef points to a Service in the gateway-conformance-app-backend namespace and no ReferenceGrant grants permission to that Service.
udproute-parentref-attach-all-listeners UDPRouteParentRefAttachAllListeners A UDPRoute whose parentRef sets neither port nor sectionName attaches to every UDP listener on the Gateway, and traffic to each listener reaches the configured backend.
udproute-parentref-port-and-section-name UDPRouteParentRefPortAndSectionName A UDPRoute attaches to a UDP listener selected by port, by sectionName, or by both, and traffic to each listener is routed to the backend Service configured by the corresponding UDPRoute.
udproute-reference-grant UDPRouteReferenceGrant A UDPRoute in the gateway-conformance-infra namespace, with a backendRef in the gateway-conformance-app-backend namespace, attaches to the Gateway and forwards UDP traffic to the backend while a ReferenceGrant permits the cross-namespace reference; deleting the ReferenceGrant flips ResolvedRefs to False with reason RefNotPermitted.
udproute-weighted-routing UDPRouteWeightedRouting A UDPRoute with multiple weighted backends should distribute UDP traffic across the backends in proportion to the configured weights.

The existing UDPRoute simple-routing test continues to pass and is retained.

Supporting infrastructure

GATEWAY-UDP conformance profile

conformance/utils/suite/profiles.go. Mirrors the shape of GATEWAY-TLS:

  • Core: Gateway, UDPRoute
  • Extended: GatewayExtendedFeatures, UDPRouteExtendedFeatures

Run with:

go test ./conformance/... -args -gateway-class=<class> -conformance-profiles=GATEWAY-UDP

SupportTCPRoute feature

Adds pkg/features/tcproute.go with SupportTCPRoute, TCPRouteCoreFeatures, and TCPRouteExtendedFeatures (empty for now). Wired into AllFeatures.

UDP/TCP echo server in echo-basic

conformance/echo-basic/udpechoserver/. Gated by UDP_ECHO_SERVER, listens on UDP and TCP on the configured port (default 8080, override via UDP_PORT). For each datagram or first line of TCP input, replies with:

{
  "request": "<original request body>",
  "namespace": "<NAMESPACE>",
  "ingress": "<INGRESS_NAME>",
  "service": "<SERVICE_NAME>",
  "pod": "<POD_NAME>"
}

Pod context fields mirror the existing HTTP echo handler so tests can identify the responding replica.

Which issue(s) this PR fixes

Implements the conformance work specified in:

  • GEP-2645: UDPRoute (geps/gep-2645/index.md)

Does this PR introduce a user-facing change?

Added conformance tests for UDPRoute (GEP-2645), a new GATEWAY-UDP
conformance profile, a SupportTCPRoute feature, and a UDP/TCP echo
server in echo-basic gated on UDP_ECHO_SERVER.

This PR was tested against https://github.com/kubernetes-sigs/aws-load-balancer-controller

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 15, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

@zac-nixon: The label(s) area/conformance cannot be applied, because the repository doesn't have them.

Details

In response to this:

What type of PR is this?

/kind feature
/area conformance

What this PR does / why we need it

Adds the conformance tests required by GEP-2645 (UDPRoute), exercising listener attachment, status conditions, mixed UDP/TCP listener behavior, and weighted backend distribution for UDPRoute.

It also lands the supporting infrastructure those tests depend on:

  • A GATEWAY-UDP conformance profile mirroring GATEWAY-TLS.
  • A SupportTCPRoute feature constant + matching feature sets, used by the merged-listener test.
  • A UDP/TCP echo server packaged into echo-basic (gated on UDP_ECHO_SERVER) that returns a JSON envelope containing the responding pod's context, so weighted-routing tests can distinguish replicas.

Conformance tests added

ShortName Features What it validates
UDPRouteParentRefPortAndSectionName Gateway, UDPRoute A UDPRoute attaches to a UDP listener via port only, via sectionName + port, or via neither (in which case it attaches to every UDP listener on the Gateway). UDP echo round-trip succeeds through each attached listener.
UDPRouteInvalidNonUDPListener Gateway, UDPRoute A UDPRoute targeting a TCP listener via sectionName is rejected with Accepted=False / NotAllowedByListeners. The Gateway reports zero attached routes.
UDPRouteInvalidBackendRefNonexistent Gateway, UDPRoute A UDPRoute referencing a Service that does not exist gets ResolvedRefs=False / BackendNotFound.
UDPRouteValidInvalidListeners Gateway, UDPRoute A Gateway with one UDP and one TCP listener on different ports accepts the UDPRoute on the UDP listener, forwards UDP traffic, and reports the TCP listener with AttachedRoutes=0.
UDPTCPListenerMerge Gateway, TCPRoute, UDPRoute A Gateway with a UDP and a TCP listener on the same port accepts both a UDPRoute and a TCPRoute. UDP traffic is routed via the UDPRoute, TCP traffic via the TCPRoute.
UDPRouteWeightedRouting Gateway, UDPRoute A single UDPRoute with two weighted backendRefs (70/30) splits UDP traffic across two distinct backend Deployments within ±3% of the configured weights.

The existing UDPRoute simple-routing test continues to pass and is retained.

Supporting infrastructure

GATEWAY-UDP conformance profile

conformance/utils/suite/profiles.go. Mirrors the shape of GATEWAY-TLS:

  • Core: Gateway, UDPRoute
  • Extended: GatewayExtendedFeatures, UDPRouteExtendedFeatures

Run with:

go test ./conformance/... -args -gateway-class=<class> -conformance-profiles=GATEWAY-UDP

SupportTCPRoute feature

Adds pkg/features/tcproute.go with SupportTCPRoute, TCPRouteCoreFeatures, and TCPRouteExtendedFeatures (empty for now). Wired into AllFeatures.

UDP/TCP echo server in echo-basic

conformance/echo-basic/udpechoserver/. Gated by UDP_ECHO_SERVER, listens on UDP and TCP on the configured port (default 8080, override via UDP_PORT). For each datagram or first line of TCP input, replies with:

{
 "request": "<original request body>",
 "namespace": "<NAMESPACE>",
 "ingress": "<INGRESS_NAME>",
 "service": "<SERVICE_NAME>",
 "pod": "<POD_NAME>"
}

Pod context fields mirror the existing HTTP echo handler so tests can identify the responding replica.

Which issue(s) this PR fixes

Implements the conformance work specified in:

  • GEP-2645: UDPRoute (geps/gep-2645/index.md)

Does this PR introduce a user-facing change?

Added conformance tests for UDPRoute (GEP-2645), a new GATEWAY-UDP
conformance profile, a SupportTCPRoute feature, and a UDP/TCP echo
server in echo-basic gated on UDP_ECHO_SERVER.

This PR was tested against https://github.com/kubernetes-sigs/aws-load-balancer-controller

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 15, 2026
@k8s-ci-robot
k8s-ci-robot requested review from kflynn and rikatz May 15, 2026 01:37
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 15, 2026
@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch 3 times, most recently from 2f9a658 to 83c6f3d Compare May 15, 2026 05:49
@zac-nixon

Copy link
Copy Markdown
Contributor Author

Moved echoserver implementation here: #4871

Will rebase this PR once 4871 is merged.

@@ -0,0 +1,80 @@
## Intro

This package provides a basic echo server used by Gateway API conformance

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I will ignore this for now as this is split (correctly) on #4871

port: 9300
allowedRoutes:
kinds:
- kind: TCPRoute

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment on the TCPRoute review, I would say that expecting a TCP listener is accepted means your Gateway supports it, which may not be true.

We are on a "weird" situation here, as someone willing to implement a L4 Gateway API implementation that supports just TCPRoute may reject the listener of any type that is not TCP, and vice versa (tho I think it would be very hard to have a UDP implementation only, who knows...)

I would probably keep this test out for now, and make it as a followup once implementations start to report

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed


// expectUDPEchoResponse polls until a UDP echo round-trip against the given
// gateway address succeeds, or the timeout is exceeded.
func expectUDPEchoResponse(t *testing.T, timeout time.Duration, gwAddr string) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this should belong to test utils


var UDPRouteValidInvalidListeners = confsuite.ConformanceTest{
ShortName: "UDPRouteValidInvalidListeners",
Description: "A UDPRoute should attach to the UDP listener on a Gateway that also has a TCP listener on a different port. The TCP listener must remain unattached and not routable.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

same comment as above, we must support both UDPRoute and TCPRoute on a Gateway for this kind of test, so you must declare it on Features below. We must have both conformance merged first before moving to the "mixed" case IMO, so probably this test should be skipped for now

Comment thread conformance/utils/suite/profiles.go Resolved
spec:
containers:
- name: udp-backend
image: registry.k8s.io/gateway-api/echo-basic:v1.5.1

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for now this wont work until we promote the UDP server image

@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch from 83eeb61 to 55551ab Compare May 19, 2026 00:39
The server listens on UDP **and** TCP on the configured port (default `8080`,
override via `UDP_PORT`). For each datagram (UDP) or first line of input
(TCP), it replies with a JSON envelope:
>>>>>>> 83c6f3d9 (test(conformance): Add UDPRoute conformance tests for GEP-2645)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is now broken due to the rebase


// serveTCP listens on the given TCP port and replies to each connection's
// first line of input with a JSON-encoded EchoResponse.
func serveTCP(port string, podContext Context) error {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this was removed on upstream already, probably should be removed from this branch as well

@rikatz

rikatz commented May 19, 2026

Copy link
Copy Markdown
Member

Ok, so some final review:

  • Missing conformance tests that will be addressed as a followup:

    • UDPRoute fails attachment to a non-UDP listener when port or sectionName is specified - Should have Accepted=False with Reason NotAllowedByListeners (hard to test on an UDP only Gateway)
    • Two listeners of type UDP on the same port must have Accepted = True, but also Conflicted=True with reason ProtocolConflict and no traffic must be routed (more on a Gateway test than on a route test)
    • Multiple UDPRoutes attaching to the same listener results in only the oldest receiving traffic (conflict testing following the same behavior as other routes)
  • Other followups to be addressed

    • Move the deployments to the base manifests
    • Make TCP server and UDP server a unique service
    • Fix UDP Route simple to stop using CoreDNS
    • Use utils for weighted tests
    • Missing SupportReferenceGrant on Gateway profile for conformance

@zac-nixon Once the bad rebase on udpechoserver is fixed, we can merge and iterate on next PRs. Thanks

@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch from 55551ab to 80e5473 Compare May 19, 2026 17:07
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 19, 2026
@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch 2 times, most recently from 1b85491 to 67670b7 Compare May 19, 2026 17:39
@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch from 67670b7 to dfd04da Compare May 19, 2026 17:40
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 19, 2026
@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch 2 times, most recently from c8ca42d to 754b852 Compare May 19, 2026 18:19
Comment thread conformance/utils/suite/profiles.go Resolved
@zac-nixon
zac-nixon force-pushed the znixon/udp-std-conformance branch from 754b852 to a58fde8 Compare May 19, 2026 18:41
@rikatz

rikatz commented May 19, 2026

Copy link
Copy Markdown
Member

/lgtm
/approve
thanks @zac-nixon ! way to go!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rikatz, zac-nixon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 19, 2026
@k8s-ci-robot
k8s-ci-robot merged commit 38b0998 into kubernetes-sigs:main May 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants