Repository: envoyproxy/gateway
Pull request #4084 (2024-08-20 03:50:49)

chore: remove tcp options from the UDPRoute IR
Remove `Timeout` and  `BackendConnection` from the UDPRoute IR as they are only meaningful for TCP.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/envoyproxy/gateway/pull/4084?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=envoyproxy) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 67.95%. Comparing base [(`6ab6482`)](https://app.codecov.io/gh/envoyproxy/gateway/commit/6ab6482dd7c807e64d4e87d78dfb06c0a1e16731?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=envoyproxy) to head [(`718dac4`)](https://app.codecov.io/gh/envoyproxy/gateway/commit/718dac451f164cd76f50e68cd475b619bf7e8582?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=envoyproxy).

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #4084      +/-   ##
==========================================
+ Coverage   67.92%   67.95%   +0.03%     
==========================================
  Files         187      187              
  Lines       23030    23024       -6     
==========================================
+ Hits        15642    15645       +3     
+ Misses       6271     6264       -7     
+ Partials     1117     1115       -2     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/envoyproxy/gateway/pull/4084?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=envoyproxy).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=envoyproxy).


Patch:
diff --git a/internal/gatewayapi/backendtrafficpolicy.go b/internal/gatewayapi/backendtrafficpolicy.go
index 466f88916..b2f0ffa6e 100644
--- a/internal/gatewayapi/backendtrafficpolicy.go
+++ b/internal/gatewayapi/backendtrafficpolicy.go
@@ -372,8 +372,6 @@ func (t *Translator) translateBackendTrafficPolicyForRoute(policy *egv1a1.Backen
 
 				if strings.HasPrefix(r.Destination.Name, prefix) {
 					r.LoadBalancer = lb
-					r.Timeout = to
-					r.BackendConnection = bc
 					r.DNS = ds
 				}
 			}
@@ -518,7 +516,6 @@ func (t *Translator) translateBackendTrafficPolicyForGateway(policy *egv1a1.Back
 		// only set attributes which weren't already set by a more
 		// specific policy
 		setIfNil(&route.LoadBalancer, lb)
-		setIfNil(&route.Timeout, ct)
 		setIfNil(&route.DNS, ds)
 	}
 
diff --git a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go
index 14d2a3d83..e7519bb25 100644
--- a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go
+++ b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go
@@ -208,7 +208,6 @@ func (r *ResourceRender) Deployment() (*appsv1.Deployment, error) {
 		},
 		ObjectMeta: metav1.ObjectMeta{
 			Namespace: r.Namespace,
-			Name:      InfraName,
 			Labels:    labels,
 		},
 		Spec: appsv1.DeploymentSpec{
@@ -242,6 +241,13 @@ func (r *ResourceRender) Deployment() (*appsv1.Deployment, error) {
 		},
 	}
 
+	// set name
+	if r.rateLimitDeployment.Name != nil {
+		deployment.ObjectMeta.Name = *r.rateLimitDeployment.Name
+	} else {
+		deployment.ObjectMeta.Name = r.Name()
+	}
+
 	if r.ownerReferenceUID != nil {
 		if uid, ok := r.ownerReferenceUID[ResourceKindDeployment]; ok {
 			deployment.OwnerReferences = []metav1.OwnerReference{
diff --git a/internal/ir/xds.go b/internal/ir/xds.go
index c698bea62..1b5b5971b 100644
--- a/internal/ir/xds.go
+++ b/internal/ir/xds.go
@@ -1556,10 +1556,6 @@ type UDPRoute struct {
 	Destination *RouteDestination `json:"destination,omitempty" yaml:"destination,omitempty"`
 	// load balancer policy to use when routing to the backend endpoints.
 	LoadBalancer *LoadBalancer `json:"loadBalancer,omitempty" yaml:"loadBalancer,omitempty"`
-	// Request and connection timeout settings
-	Timeout *Timeout `json:"timeout,omitempty" yaml:"timeout,omitempty"`
-	// settings of upstream connection
-	BackendConnection *BackendConnection `json:"backendConnection,omitempty" yaml:"backendConnection,omitempty"`
 	// DNS is used to configure how DNS resolution is handled by the Envoy Proxy cluster
 	DNS *DNS `json:"dns,omitempty" yaml:"dns,omitempty"`
 }
diff --git a/internal/ir/zz_generated.deepcopy.go b/internal/ir/zz_generated.deepcopy.go
index 4423f71ba..285077222 100644
--- a/internal/ir/zz_generated.deepcopy.go
+++ b/internal/ir/zz_generated.deepcopy.go
@@ -3104,16 +3104,6 @@ func (in *UDPRoute) DeepCopyInto(out *UDPRoute) {
 		*out = new(LoadBalancer)
 		(*in).DeepCopyInto(*out)
 	}
-	if in.Timeout != nil {
-		in, out := &in.Timeout, &out.Timeout
-		*out = new(Timeout)
-		(*in).DeepCopyInto(*out)
-	}
-	if in.BackendConnection != nil {
-		in, out := &in.BackendConnection, &out.BackendConnection
-		*out = new(BackendConnection)
-		(*in).DeepCopyInto(*out)
-	}
 	if in.DNS != nil {
 		in, out := &in.DNS, &out.DNS
 		*out = new(DNS)
diff --git a/internal/xds/translator/cluster.go b/internal/xds/translator/cluster.go
index 9786ed972..4ac9979f3 100644
--- a/internal/xds/translator/cluster.go
+++ b/internal/xds/translator/cluster.go
@@ -686,15 +686,12 @@ type UDPRouteTranslator struct {
 
 func (route *UDPRouteTranslator) asClusterArgs(extra *ExtraArgs) *xdsClusterArgs {
 	return &xdsClusterArgs{
-		name:              route.Destination.Name,
-		settings:          route.Destination.Settings,
-		loadBalancer:      route.LoadBalancer,
-		timeout:           route.Timeout,
-		tSocket:           nil,
-		endpointType:      buildEndpointType(route.Destination.Settings),
-		metrics:           extra.metrics,
-		backendConnection: route.BackendConnection,
-		dns:               route.DNS,
+		name:         route.Destination.Name,
+		settings:     route.Destination.Settings,
+		loadBalancer: route.LoadBalancer,
+		endpointType: buildEndpointType(route.Destination.Settings),
+		metrics:      extra.metrics,
+		dns:          route.DNS,
 	}
 }
 


Test patch:
diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-gateway.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-gateway.out.yaml
index 660c8d7d8..9fa8e7235 100644
--- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-gateway.out.yaml
+++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-gateway.out.yaml
@@ -309,9 +309,3 @@ xdsIR:
           consistentHash:
             sourceIP: true
         name: udproute/default/udp-app-1
-        timeout:
-          http:
-            connectionIdleTimeout: 16s
-            maxConnectionDuration: 17s
-          tcp:
-            connectTimeout: 15s
diff --git a/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-route.out.yaml b/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-route.out.yaml
index 8f5fcbe4b..5b1707b6f 100644
--- a/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-route.out.yaml
+++ b/internal/gatewayapi/testdata/backendtrafficpolicy-with-tcp-udp-listeners-apply-on-route.out.yaml
@@ -382,9 +382,3 @@ xdsIR:
           consistentHash:
             sourceIP: true
         name: udproute/default/udp-app-1
-        timeout:
-          http:
-            connectionIdleTimeout: 16s
-            maxConnectionDuration: 17s
-          tcp:
-            connectTimeout: 15s
diff --git a/internal/xds/translator/testdata/out/xds-ir/backend-buffer-limit.clusters.yaml b/internal/xds/translator/testdata/out/xds-ir/backend-buffer-limit.clusters.yaml
index 8b9fea622..33c8f6a68 100644
--- a/internal/xds/translator/testdata/out/xds-ir/backend-buffer-limit.clusters.yaml
+++ b/internal/xds/translator/testdata/out/xds-ir/backend-buffer-limit.clusters.yaml
@@ -47,5 +47,5 @@
   lbPolicy: LEAST_REQUEST
   name: udp-route-dest
   outlierDetection: {}
-  perConnectionBufferLimitBytes: 100000000
+  perConnectionBufferLimitBytes: 32768
   type: EDS