From 618f8be737308cf7f514db4fcef866768d80129d Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Thu, 15 May 2025 06:58:11 +0000 Subject: [PATCH 1/6] Set accepted condition as true when failed to resolve backends Signed-off-by: Huabing (Robin) Zhao --- internal/gatewayapi/route.go | 10 ---------- ...-with-udproute-with-mismatch-port-protocol.out.yaml | 10 +++++++--- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/internal/gatewayapi/route.go b/internal/gatewayapi/route.go index b98e81a465..75c9fcd07e 100644 --- a/internal/gatewayapi/route.go +++ b/internal/gatewayapi/route.go @@ -1113,16 +1113,6 @@ func (t *Translator) processUDPRouteParentRefs(udpRoute *UDPRouteContext, resour metav1.ConditionFalse, resolveErrs.Reason(), resolveErrs.Error()) - - // TODO: zhaohuabing should we set the accepted condition to false here? - status.SetRouteStatusCondition(routeStatus, - parentRef.routeParentStatusIdx, - udpRoute.GetGeneration(), - gwapiv1.RouteConditionAccepted, - metav1.ConditionFalse, - "Failed to process the settings associated with the UDP route.", - resolveErrs.Error(), - ) } else { status.SetRouteStatusCondition(routeStatus, parentRef.routeParentStatusIdx, diff --git a/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml b/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml index dffc8a4c88..89a3e347d3 100644 --- a/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml @@ -73,9 +73,9 @@ udpRoutes: parents: - conditions: - lastTransitionTime: null - message: UDP Port 8080 not found on Service default/service-1 - reason: Failed to process the settings associated with the UDP route. - status: "False" + message: Route is accepted + reason: Accepted + status: "True" type: Accepted - lastTransitionTime: null message: UDP Port 8080 not found on Service default/service-1 @@ -100,3 +100,7 @@ xdsIR: - address: 0.0.0.0 name: envoy-gateway/gateway-1/udp port: 10162 + route: + destination: + name: udproute/default/udproute-1/rule/-1 + name: udproute/default/udproute-1 From b0a8de86996bb1be848f87f40cc07f413f68f2d5 Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Wed, 4 Jun 2025 06:13:06 +0000 Subject: [PATCH 2/6] address comment Signed-off-by: Huabing (Robin) Zhao --- .../in/xds-ir/udp-route-no-endpoints.yaml | 9 +++++++++ .../udp-route-no-endpoints.clusters.yaml | 17 +++++++++++++++++ .../udp-route-no-endpoints.endpoints.yaml | 1 + .../udp-route-no-endpoints.listeners.yaml | 18 ++++++++++++++++++ .../xds-ir/udp-route-no-endpoints.routes.yaml | 1 + 5 files changed, 46 insertions(+) create mode 100644 internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml create mode 100644 internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml create mode 100644 internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.endpoints.yaml create mode 100644 internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.listeners.yaml create mode 100644 internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.routes.yaml diff --git a/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml b/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml new file mode 100644 index 0000000000..e2dbdaffdd --- /dev/null +++ b/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml @@ -0,0 +1,9 @@ +# UDP route with no endpoints, this will happen when the Gateway API translator failed to resolve the backendRefs +udp: +- name: "udp-route" + address: "0.0.0.0" + port: 10162 + route: + destination: + name: udproute/default/udproute-1/rule/-1 + name: udproute/default/udproute-1 diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml new file mode 100644 index 0000000000..f3cca59e0e --- /dev/null +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml @@ -0,0 +1,17 @@ +- circuitBreakers: + thresholds: + - maxRetries: 1024 + commonLbConfig: + localityWeightedLbConfig: {} + connectTimeout: 10s + dnsLookupFamily: V4_PREFERRED + edsClusterConfig: + edsConfig: + ads: {} + resourceApiVersion: V3 + serviceName: udproute/default/udproute-1/rule/-1 + ignoreHealthOnHostRemoval: true + lbPolicy: LEAST_REQUEST + name: udproute/default/udproute-1/rule/-1 + perConnectionBufferLimitBytes: 32768 + type: EDS diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.endpoints.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.endpoints.yaml new file mode 100644 index 0000000000..3e07819c23 --- /dev/null +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.endpoints.yaml @@ -0,0 +1 @@ +- clusterName: udproute/default/udproute-1/rule/-1 diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.listeners.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.listeners.yaml new file mode 100644 index 0000000000..5edcecc248 --- /dev/null +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.listeners.yaml @@ -0,0 +1,18 @@ +- address: + socketAddress: + address: 0.0.0.0 + portValue: 10162 + protocol: UDP + listenerFilters: + - name: envoy.filters.udp_listener.udp_proxy + typedConfig: + '@type': type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.UdpProxyConfig + matcher: + onNoMatch: + action: + name: route + typedConfig: + '@type': type.googleapis.com/envoy.extensions.filters.udp.udp_proxy.v3.Route + cluster: udproute/default/udproute-1/rule/-1 + statPrefix: service + name: udp-route diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.routes.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.routes.yaml new file mode 100644 index 0000000000..fe51488c70 --- /dev/null +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.routes.yaml @@ -0,0 +1 @@ +[] From ecdf5ba7e555cb842c47f18fd539c85bd360015d Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Wed, 4 Jun 2025 13:07:34 +0000 Subject: [PATCH 3/6] trigger build Signed-off-by: Huabing (Robin) Zhao --- .../testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml index f3cca59e0e..3c403f466a 100644 --- a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml @@ -12,6 +12,7 @@ serviceName: udproute/default/udproute-1/rule/-1 ignoreHealthOnHostRemoval: true lbPolicy: LEAST_REQUEST + name: udproute/default/udproute-1/rule/-1 perConnectionBufferLimitBytes: 32768 type: EDS From 256c23d1071489fc8a89f2d91cf54f1fdc99c5fb Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Wed, 4 Jun 2025 13:08:08 +0000 Subject: [PATCH 4/6] trigger build Signed-off-by: Huabing (Robin) Zhao --- .../testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml index 3c403f466a..f3cca59e0e 100644 --- a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml @@ -12,7 +12,6 @@ serviceName: udproute/default/udproute-1/rule/-1 ignoreHealthOnHostRemoval: true lbPolicy: LEAST_REQUEST - name: udproute/default/udproute-1/rule/-1 perConnectionBufferLimitBytes: 32768 type: EDS From 9ba30fb0a063f304bf48828b68cc74512e297bec Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Wed, 4 Jun 2025 13:19:56 +0000 Subject: [PATCH 5/6] fix gen Signed-off-by: Huabing (Robin) Zhao --- ...istener-with-udproute-with-mismatch-port-protocol.out.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml b/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml index 89a3e347d3..4e34fea026 100644 --- a/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml +++ b/internal/gatewayapi/testdata/gateway-with-listener-with-udproute-with-mismatch-port-protocol.out.yaml @@ -102,5 +102,9 @@ xdsIR: port: 10162 route: destination: + metadata: + kind: UDPRoute + name: udproute-1 + namespace: default name: udproute/default/udproute-1/rule/-1 name: udproute/default/udproute-1 From e702401f4b133243c3d581fe0bbad03d4acb11c5 Mon Sep 17 00:00:00 2001 From: "Huabing (Robin) Zhao" Date: Wed, 4 Jun 2025 13:22:23 +0000 Subject: [PATCH 6/6] fix gen Signed-off-by: Huabing (Robin) Zhao --- .../testdata/in/xds-ir/udp-route-no-endpoints.yaml | 4 ++++ .../out/xds-ir/udp-route-no-endpoints.clusters.yaml | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml b/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml index e2dbdaffdd..c78d4436d6 100644 --- a/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml +++ b/internal/xds/translator/testdata/in/xds-ir/udp-route-no-endpoints.yaml @@ -5,5 +5,9 @@ udp: port: 10162 route: destination: + metadata: + kind: UDPRoute + name: udproute-1 + namespace: default name: udproute/default/udproute-1/rule/-1 name: udproute/default/udproute-1 diff --git a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml index f3cca59e0e..62b5062e7d 100644 --- a/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml +++ b/internal/xds/translator/testdata/out/xds-ir/udp-route-no-endpoints.clusters.yaml @@ -12,6 +12,13 @@ serviceName: udproute/default/udproute-1/rule/-1 ignoreHealthOnHostRemoval: true lbPolicy: LEAST_REQUEST + metadata: + filterMetadata: + envoy-gateway: + resources: + - kind: UDPRoute + name: udproute-1 + namespace: default name: udproute/default/udproute-1/rule/-1 perConnectionBufferLimitBytes: 32768 type: EDS