Skip to content

Commit 1ad2313

Browse files
committed
rename listener using its address and port
Signed-off-by: Huabing (Robin) Zhao <[email protected]>
1 parent 0ca5abd commit 1ad2313

File tree

184 files changed

+236
-258
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

184 files changed

+236
-258
lines changed

internal/xds/translator/listener.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package translator
77

88
import (
99
"errors"
10+
"fmt"
1011
"net"
1112
"strconv"
1213
"strings"
@@ -185,7 +186,7 @@ func originalIPDetectionExtensions(clientIPDetection *ir.ClientIPDetectionSettin
185186
// buildXdsTCPListener creates a xds Listener resource
186187
// TODO: Improve function parameters
187188
func buildXdsTCPListener(
188-
name, address string,
189+
address string,
189190
port uint32,
190191
ipFamily *egv1a1.IPFamily,
191192
keepalive *ir.TCPKeepalive,
@@ -200,7 +201,7 @@ func buildXdsTCPListener(
200201
bufferLimitBytes := buildPerConnectionBufferLimitBytes(connection)
201202
maxAcceptPerSocketEvent := buildMaxAcceptPerSocketEvent(connection)
202203
listener := &listenerv3.Listener{
203-
Name: name,
204+
Name: tcpListenerName(address, port),
204205
AccessLog: al,
205206
SocketOptions: socketOptions,
206207
PerConnectionBufferLimitBytes: bufferLimitBytes,
@@ -226,6 +227,10 @@ func buildXdsTCPListener(
226227
return listener, nil
227228
}
228229

230+
func tcpListenerName(address string, port uint32) string {
231+
return fmt.Sprintf("%s-%d", address, port)
232+
}
233+
229234
func buildPerConnectionBufferLimitBytes(connection *ir.ClientConnection) *wrapperspb.UInt32Value {
230235
if connection != nil && connection.BufferLimitBytes != nil {
231236
return wrapperspb.UInt32(*connection.BufferLimitBytes)

internal/xds/translator/testdata/in/xds-ir/jsonpatch-invalid-patch.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ envoyPatchPolicies:
1010
namespace: "default"
1111
jsonPatches:
1212
- type: "type.googleapis.com/envoy.config.listener.v3.Listener"
13-
name: "first-listener"
13+
name: "::-10080"
1414
operation:
1515
op: "add"
1616
path: "/this/path/never/existed"

internal/xds/translator/testdata/out/extension-xds-ir/extensionpolicy-tcp-udp-http.listeners.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
cluster: tcp-route-dest
3939
statPrefix: tcp-10080
4040
maxConnectionsToAcceptPerSocketEvent: 1
41-
name: envoy-gateway/gateway-1/http1
41+
name: 0.0.0.0-10080
4242
perConnectionBufferLimitBytes: 32768
43-
statPrefix: envoy-gateway/gateway-1/http1
4443
- address:
4544
socketAddress:
4645
address: 0.0.0.0

internal/xds/translator/testdata/out/extension-xds-ir/http-route-custom-backend-error.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: custom-backend-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: custom-backend-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

internal/xds/translator/testdata/out/extension-xds-ir/http-route-custom-backend-multiple-backend-error.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: multiple-custom-backends-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: multiple-custom-backends-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

internal/xds/translator/testdata/out/extension-xds-ir/http-route-custom-backend.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: custom-backend-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: custom-backend-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

internal/xds/translator/testdata/out/extension-xds-ir/http-route-custom-backends-mixed.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: multiple-custom-backends-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: multiple-custom-backends-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

internal/xds/translator/testdata/out/extension-xds-ir/http-route-custom-backends-multiple-mixed.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: multiple-custom-backends-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: multiple-custom-backends-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@
3131
useRemoteAddress: true
3232
name: extension-listener
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: extension-listener
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768
36-
statPrefix: mock-extension-inserted-prefix

internal/xds/translator/testdata/out/extension-xds-ir/http-route-extension-listener-error.listeners.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
useRemoteAddress: true
3232
name: extension-post-xdslistener-hook-error
3333
maxConnectionsToAcceptPerSocketEvent: 1
34-
name: extension-post-xdslistener-hook-error
34+
name: 0.0.0.0-10080
3535
perConnectionBufferLimitBytes: 32768

0 commit comments

Comments
 (0)