Skip to content

Commit bffdcb0

Browse files
committed
feat: set tcp proxy cluster buffer
Signed-off-by: bitliu <[email protected]>
1 parent ef98e16 commit bffdcb0

File tree

39 files changed

+81
-3
lines changed

39 files changed

+81
-3
lines changed

internal/cmd/egctl/config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func TestExtractAllConfigDump(t *testing.T) {
9494
}
9595

9696
for _, tc := range cases {
97-
t.Run(tc.output, func(t *testing.T) {
97+
t.Run(tc.expected, func(t *testing.T) {
9898
configDump, err := extractConfigDump(fw, true)
9999
assert.NoError(t, err)
100100
got, err := marshalEnvoyProxyConfig(configDump, tc.output)
@@ -175,7 +175,7 @@ func TestExtractSubResourcesConfigDump(t *testing.T) {
175175
}
176176

177177
for _, tc := range cases {
178-
t.Run(tc.output, func(t *testing.T) {
178+
t.Run(tc.expected, func(t *testing.T) {
179179
configDump, err := extractConfigDump(fw, false)
180180
assert.NoError(t, err)
181181
resource, err := findXDSResourceFromConfigDump(tc.resourceType, configDump)

internal/cmd/egctl/testdata/translate/out/default-resources.all.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ xds:
262262
resourceApiVersion: V3
263263
name: default-backend-rule-0-match-0-www.example.com
264264
outlierDetection: {}
265+
perConnectionBufferLimitBytes: 32768
265266
type: EDS
266267
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump
267268
dynamicListeners:

internal/cmd/egctl/testdata/translate/out/echo-gateway-api.cluster.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,5 @@ xds:
9696
resourceApiVersion: V3
9797
name: envoy-gateway-system-backend-rule-0-match-0-www.example.com
9898
outlierDetection: {}
99+
perConnectionBufferLimitBytes: 32768
99100
type: EDS

internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@
227227
},
228228
"name": "default-backend-rule-0-match-0-www.example.com",
229229
"outlierDetection": {},
230+
"perConnectionBufferLimitBytes": 32768,
230231
"type": "EDS"
231232
}
232233
}, {
@@ -245,6 +246,7 @@
245246
},
246247
"name": "default-backend-rule-0-match-0-www.grpc-example.com",
247248
"outlierDetection": {},
249+
"perConnectionBufferLimitBytes": 32768,
248250
"type": "EDS",
249251
"typedExtensionProtocolOptions": {
250252
"envoy.extensions.upstreams.http.v3.HttpProtocolOptions": {
@@ -271,6 +273,7 @@
271273
},
272274
"name": "default-eg-tls-passthrough-backend",
273275
"outlierDetection": {},
276+
"perConnectionBufferLimitBytes": 32768,
274277
"type": "EDS"
275278
}
276279
}, {
@@ -289,6 +292,7 @@
289292
},
290293
"name": "default-eg-tcp-backend",
291294
"outlierDetection": {},
295+
"perConnectionBufferLimitBytes": 32768,
292296
"type": "EDS"
293297
}
294298
}, {
@@ -307,6 +311,7 @@
307311
},
308312
"name": "default-eg-udp-backend",
309313
"outlierDetection": {},
314+
"perConnectionBufferLimitBytes": 32768,
310315
"type": "EDS"
311316
}
312317
}]

internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.all.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ xds:
149149
resourceApiVersion: V3
150150
name: default-backend-rule-0-match-0-www.example.com
151151
outlierDetection: {}
152+
perConnectionBufferLimitBytes: 32768
152153
type: EDS
153154
- cluster:
154155
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -162,6 +163,7 @@ xds:
162163
resourceApiVersion: V3
163164
name: default-backend-rule-0-match-0-www.grpc-example.com
164165
outlierDetection: {}
166+
perConnectionBufferLimitBytes: 32768
165167
type: EDS
166168
typedExtensionProtocolOptions:
167169
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
@@ -180,6 +182,7 @@ xds:
180182
resourceApiVersion: V3
181183
name: default-eg-tls-passthrough-backend
182184
outlierDetection: {}
185+
perConnectionBufferLimitBytes: 32768
183186
type: EDS
184187
- cluster:
185188
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -193,6 +196,7 @@ xds:
193196
resourceApiVersion: V3
194197
name: default-eg-tcp-backend
195198
outlierDetection: {}
199+
perConnectionBufferLimitBytes: 32768
196200
type: EDS
197201
- cluster:
198202
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -206,6 +210,7 @@ xds:
206210
resourceApiVersion: V3
207211
name: default-eg-udp-backend
208212
outlierDetection: {}
213+
perConnectionBufferLimitBytes: 32768
209214
type: EDS
210215
- '@type': type.googleapis.com/envoy.admin.v3.ListenersConfigDump
211216
dynamicListeners:

internal/cmd/egctl/testdata/translate/out/from-gateway-api-to-xds.cluster.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ xds:
1414
resourceApiVersion: V3
1515
name: default-backend-rule-0-match-0-www.example.com
1616
outlierDetection: {}
17+
perConnectionBufferLimitBytes: 32768
1718
type: EDS
1819
- cluster:
1920
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -27,6 +28,7 @@ xds:
2728
resourceApiVersion: V3
2829
name: default-backend-rule-0-match-0-www.grpc-example.com
2930
outlierDetection: {}
31+
perConnectionBufferLimitBytes: 32768
3032
type: EDS
3133
typedExtensionProtocolOptions:
3234
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
@@ -45,6 +47,7 @@ xds:
4547
resourceApiVersion: V3
4648
name: default-eg-tls-passthrough-backend
4749
outlierDetection: {}
50+
perConnectionBufferLimitBytes: 32768
4851
type: EDS
4952
- cluster:
5053
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -58,6 +61,7 @@ xds:
5861
resourceApiVersion: V3
5962
name: default-eg-tcp-backend
6063
outlierDetection: {}
64+
perConnectionBufferLimitBytes: 32768
6165
type: EDS
6266
- cluster:
6367
'@type': type.googleapis.com/envoy.config.cluster.v3.Cluster
@@ -71,4 +75,5 @@ xds:
7175
resourceApiVersion: V3
7276
name: default-eg-udp-backend
7377
outlierDetection: {}
78+
perConnectionBufferLimitBytes: 32768
7479
type: EDS

internal/xds/translator/cluster.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import (
2222

2323
const (
2424
extensionOptionsKey = "envoy.extensions.upstreams.http.v3.HttpProtocolOptions"
25+
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto#envoy-v3-api-field-config-cluster-v3-cluster-per-connection-buffer-limit-bytes
26+
tcpClusterPerConnectionBufferLimitBytes = 32768
2527
)
2628

2729
func buildXdsCluster(routeName string, tSocket *corev3.TransportSocket, protocol ProtocolType, endpointType EndpointType) *clusterv3.Cluster {
@@ -34,7 +36,8 @@ func buildXdsCluster(routeName string, tSocket *corev3.TransportSocket, protocol
3436
CommonLbConfig: &clusterv3.Cluster_CommonLbConfig{
3537
LocalityConfigSpecifier: &clusterv3.Cluster_CommonLbConfig_LocalityWeightedLbConfig_{
3638
LocalityWeightedLbConfig: &clusterv3.Cluster_CommonLbConfig_LocalityWeightedLbConfig{}}},
37-
OutlierDetection: &clusterv3.OutlierDetection{},
39+
OutlierDetection: &clusterv3.OutlierDetection{},
40+
PerConnectionBufferLimitBytes: wrapperspb.UInt32(tcpClusterPerConnectionBufferLimitBytes),
3841
}
3942

4043
if tSocket != nil {

internal/xds/translator/testdata/out/extension-xds-ir/http-route-extension-filter.clusters.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
resourceApiVersion: V3
99
name: first-route
1010
outlierDetection: {}
11+
perConnectionBufferLimitBytes: 32768
1112
type: EDS
1213
- loadAssignment:
1314
clusterName: mock-extension-injected-cluster

internal/xds/translator/testdata/out/extension-xds-ir/http-route.clusters.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
resourceApiVersion: V3
99
name: first-route
1010
outlierDetection: {}
11+
perConnectionBufferLimitBytes: 32768
1112
type: EDS
1213
- loadAssignment:
1314
clusterName: mock-extension-injected-cluster

internal/xds/translator/testdata/out/xds-ir/authn-multi-route-multi-provider.clusters.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
resourceApiVersion: V3
99
name: first-route-www.test.com
1010
outlierDetection: {}
11+
perConnectionBufferLimitBytes: 32768
1112
type: EDS
1213
- commonLbConfig:
1314
localityWeightedLbConfig: {}
@@ -19,6 +20,7 @@
1920
resourceApiVersion: V3
2021
name: second-route-www.test.com
2122
outlierDetection: {}
23+
perConnectionBufferLimitBytes: 32768
2224
type: EDS
2325
- commonLbConfig:
2426
localityWeightedLbConfig: {}
@@ -38,6 +40,7 @@
3840
locality: {}
3941
name: localhost_443
4042
outlierDetection: {}
43+
perConnectionBufferLimitBytes: 32768
4144
respectDnsTtl: true
4245
transportSocket:
4346
name: envoy.transport_sockets.tls
@@ -58,6 +61,7 @@
5861
resourceApiVersion: V3
5962
name: "192_168_1_250_8080"
6063
outlierDetection: {}
64+
perConnectionBufferLimitBytes: 32768
6165
transportSocket:
6266
name: envoy.transport_sockets.tls
6367
typedConfig:

0 commit comments

Comments
 (0)