Skip to content

Commit

Permalink
feat(kuma-cp): use remote address for Gateway (#4530)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dyszkiewicz <jakub.dyszkiewicz@gmail.com>
  • Loading branch information
jakubdyszkiewicz committed Jul 1, 2022
1 parent 8012c9a commit 2483ffd
Show file tree
Hide file tree
Showing 58 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/plugins/runtime/gateway/filter_chain_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ func newFilterChain(ctx xds_context.MeshContext, info GatewayListenerInfo) *envo
envoy_listeners.StripHostPort(),
envoy_listeners.AddFilterChainConfigurer(
envoy_listeners_v3.HttpConnectionManagerMustConfigureFunc(func(hcm *envoy_hcm.HttpConnectionManager) {
hcm.UseRemoteAddress = util_proto.Bool(true)

hcm.RequestHeadersTimeout = util_proto.Duration(DefaultRequestHeadersTimeout)
hcm.StreamIdleTimeout = util_proto.Duration(DefaultStreamIdleTimeout)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
2 changes: 2 additions & 0 deletions pkg/plugins/runtime/gateway/testdata/02-gateway-listener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down Expand Up @@ -102,6 +103,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Resources:
collectorEndpoint: /api/v2/spans
collectorEndpointVersion: HTTP_JSON
collectorHostname: jaeger-collector.kuma-tracing:9411
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
4 changes: 4 additions & 0 deletions pkg/plugins/runtime/gateway/testdata/05-gateway-listener.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down Expand Up @@ -112,6 +113,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down Expand Up @@ -173,6 +175,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down Expand Up @@ -232,6 +235,7 @@ Resources:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Listeners:
statPrefix: gateway-multihost
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
listenerFilters:
- name: envoy.filters.listener.tls_inspector
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ Listeners:
statPrefix: gateway-default
streamIdleTimeout: 5s
stripAnyHostPort: true
useRemoteAddress: true
transportSocket:
name: envoy.transport_sockets.tls
typedConfig:
Expand Down
Loading

0 comments on commit 2483ffd

Please sign in to comment.