Repository navigation
test(conformance): Add UDPRoute conformance tests for GEP-2645 - #4861
Conversation
|
@zac-nixon: The label(s) DetailsIn response to this:
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. |
2f9a658 to
83c6f3d
Compare
|
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 | |||
There was a problem hiding this comment.
I will ignore this for now as this is split (correctly) on #4871
| port: 9300 | ||
| allowedRoutes: | ||
| kinds: | ||
| - kind: TCPRoute |
There was a problem hiding this comment.
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
|
|
||
| // 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) { |
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
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
| spec: | ||
| containers: | ||
| - name: udp-backend | ||
| image: registry.k8s.io/gateway-api/echo-basic:v1.5.1 |
There was a problem hiding this comment.
for now this wont work until we promote the UDP server image
83eeb61 to
55551ab
Compare
| 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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
this was removed on upstream already, probably should be removed from this branch as well
|
Ok, so some final review:
@zac-nixon Once the bad rebase on udpechoserver is fixed, we can merge and iterate on next PRs. Thanks |
55551ab to
80e5473
Compare
1b85491 to
67670b7
Compare
67670b7 to
dfd04da
Compare
c8ca42d to
754b852
Compare
754b852 to
a58fde8
Compare
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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:
GATEWAY-UDPconformance profile mirroringGATEWAY-TLS.Conformance tests added
udproute-invalid-backendref-nonexistentUDPRouteInvalidBackendRefNonexistentResolvedRefs=Falsewith reasonBackendNotFoundwhen itsbackendRefpoints to a Service that does not exist.udproute-invalid-cross-namespace-backend-refUDPRouteInvalidCrossNamespaceBackendRefgateway-conformance-infranamespace should setResolvedRefs=Falsewith reasonRefNotPermittedwhen itsbackendRefpoints to a Service in thegateway-conformance-app-backendnamespace and noReferenceGrantgrants permission to that Service.udproute-parentref-attach-all-listenersUDPRouteParentRefAttachAllListenersparentRefsets neitherportnorsectionNameattaches to every UDP listener on the Gateway, and traffic to each listener reaches the configured backend.udproute-parentref-port-and-section-nameUDPRouteParentRefPortAndSectionNameport, bysectionName, or by both, and traffic to each listener is routed to the backend Service configured by the corresponding UDPRoute.udproute-reference-grantUDPRouteReferenceGrantgateway-conformance-infranamespace, with abackendRefin thegateway-conformance-app-backendnamespace, attaches to the Gateway and forwards UDP traffic to the backend while aReferenceGrantpermits the cross-namespace reference; deleting theReferenceGrantflipsResolvedRefstoFalsewith reasonRefNotPermitted.udproute-weighted-routingUDPRouteWeightedRoutingThe existing
UDPRoutesimple-routing test continues to pass and is retained.Supporting infrastructure
GATEWAY-UDPconformance profileconformance/utils/suite/profiles.go. Mirrors the shape ofGATEWAY-TLS:Gateway,UDPRouteGatewayExtendedFeatures,UDPRouteExtendedFeaturesRun with:
SupportTCPRoutefeatureAdds
pkg/features/tcproute.gowithSupportTCPRoute,TCPRouteCoreFeatures, andTCPRouteExtendedFeatures(empty for now). Wired intoAllFeatures.UDP/TCP echo server in
echo-basicconformance/echo-basic/udpechoserver/. Gated byUDP_ECHO_SERVER, listens on UDP and TCP on the configured port (default8080, override viaUDP_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:
geps/gep-2645/index.md)Does this PR introduce a user-facing change?
This PR was tested against https://github.com/kubernetes-sigs/aws-load-balancer-controller