-
Notifications
You must be signed in to change notification settings - Fork 712
feat: Support Client IP Detection using XFF on ClientTrafficPolicy #2535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
arkodg
merged 15 commits into
envoyproxy:main
from
davidalger:algerdev/http-conn-mgr-settings
Feb 3, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c3d18a4
feat: HTTPConnectionManager settings for XFF headers on ClientTraffic…
davidalger d4419ee
Remove useRemoteAddress configuration and rename section to originalI…
davidalger e6de174
Add example curl request demonstrating request headers
davidalger adeace3
Merge remote-tracking branch 'upstream/main' into algerdev/http-conn-…
davidalger f378a99
Implement support for original ip detection extensions
davidalger da5fd65
Merge remote-tracking branch 'upstream/main' into algerdev/http-conn-…
davidalger 884d616
Rename to clientIP
davidalger 76f64a9
Update tests
davidalger d5b953a
Update docs
davidalger d2c7d61
Refactor xff / custom_header implementation
davidalger 7cbc942
Merge remote-tracking branch 'upstream/main' into algerdev/http-conn-…
davidalger 91b938d
Update tests
davidalger 957aef3
Strip out customHeader support for now
davidalger 518157d
Make optional
davidalger e23da95
Cleanup
davidalger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
internal/gatewayapi/testdata/clienttrafficpolicy-client-ip-detection.in.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| clientTrafficPolicies: | ||
| - apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
| kind: ClientTrafficPolicy | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: target-gateway-1 | ||
| spec: | ||
| clientIPDetection: | ||
| xForwardedFor: | ||
| numTrustedHops: 2 | ||
| targetRef: | ||
| group: gateway.networking.k8s.io | ||
| kind: Gateway | ||
| name: gateway-1 | ||
| namespace: envoy-gateway | ||
| gateways: | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| namespace: envoy-gateway | ||
| name: gateway-1 | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| listeners: | ||
| - name: http-1 | ||
| protocol: HTTP | ||
| port: 8081 | ||
| allowedRoutes: | ||
| namespaces: | ||
| from: Same |
98 changes: 98 additions & 0 deletions
98
internal/gatewayapi/testdata/clienttrafficpolicy-client-ip-detection.out.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| clientTrafficPolicies: | ||
| - apiVersion: gateway.envoyproxy.io/v1alpha1 | ||
| kind: ClientTrafficPolicy | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: target-gateway-1 | ||
| namespace: envoy-gateway | ||
| spec: | ||
| clientIPDetection: | ||
| xForwardedFor: | ||
| numTrustedHops: 2 | ||
| targetRef: | ||
| group: gateway.networking.k8s.io | ||
| kind: Gateway | ||
| name: gateway-1 | ||
| namespace: envoy-gateway | ||
| status: | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: ClientTrafficPolicy has been accepted. | ||
| reason: Accepted | ||
| status: "True" | ||
| type: Accepted | ||
| gateways: | ||
| - apiVersion: gateway.networking.k8s.io/v1 | ||
| kind: Gateway | ||
| metadata: | ||
| creationTimestamp: null | ||
| name: gateway-1 | ||
| namespace: envoy-gateway | ||
| spec: | ||
| gatewayClassName: envoy-gateway-class | ||
| listeners: | ||
| - allowedRoutes: | ||
| namespaces: | ||
| from: Same | ||
| name: http-1 | ||
| port: 8081 | ||
| protocol: HTTP | ||
| status: | ||
| listeners: | ||
| - attachedRoutes: 0 | ||
| conditions: | ||
| - lastTransitionTime: null | ||
| message: Sending translated listener configuration to the data plane | ||
| reason: Programmed | ||
| status: "True" | ||
| type: Programmed | ||
| - lastTransitionTime: null | ||
| message: Listener has been successfully translated | ||
| reason: Accepted | ||
| status: "True" | ||
| type: Accepted | ||
| - lastTransitionTime: null | ||
| message: Listener references have been resolved | ||
| reason: ResolvedRefs | ||
| status: "True" | ||
| type: ResolvedRefs | ||
| name: http-1 | ||
| supportedKinds: | ||
| - group: gateway.networking.k8s.io | ||
| kind: HTTPRoute | ||
| - group: gateway.networking.k8s.io | ||
| kind: GRPCRoute | ||
| infraIR: | ||
| envoy-gateway/gateway-1: | ||
| proxy: | ||
| listeners: | ||
| - address: null | ||
| name: envoy-gateway/gateway-1/http-1 | ||
| ports: | ||
| - containerPort: 8081 | ||
| name: http-1 | ||
| protocol: HTTP | ||
| servicePort: 8081 | ||
| metadata: | ||
| labels: | ||
| gateway.envoyproxy.io/owning-gateway-name: gateway-1 | ||
| gateway.envoyproxy.io/owning-gateway-namespace: envoy-gateway | ||
| name: envoy-gateway/gateway-1 | ||
| xdsIR: | ||
| envoy-gateway/gateway-1: | ||
| accessLog: | ||
| text: | ||
| - path: /dev/stdout | ||
| http: | ||
| - address: 0.0.0.0 | ||
| clientIPDetection: | ||
| xForwardedFor: | ||
| numTrustedHops: 2 | ||
| hostnames: | ||
| - '*' | ||
| isHTTP2: false | ||
| name: envoy-gateway/gateway-1/http-1 | ||
| path: | ||
| escapedSlashesAction: UnescapeAndRedirect | ||
| mergeSlashes: true | ||
| port: 8081 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
internal/xds/translator/testdata/in/xds-ir/client-ip-detection.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| http: | ||
| - name: "first-listener" | ||
| address: "0.0.0.0" | ||
| port: 8081 | ||
| hostnames: | ||
| - "*" | ||
| routes: | ||
| - name: "first-route" | ||
| hostname: "*" | ||
| destination: | ||
| name: "first-route-dest" | ||
| settings: | ||
| - endpoints: | ||
| - host: "1.1.1.1" | ||
| port: 8081 | ||
| clientIPDetection: | ||
| xForwardedFor: | ||
| numTrustedHops: 2 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.