Skip to content
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

Expose use_remote_address #1290

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

skonto
Copy link
Contributor

@skonto skonto commented Sep 20, 2024

Changes

  • As per title
  • When the field is set to true and num of hops is zero (Kourier at the edge) you can get the downstream ip of the client in X-Envoy-External-Address.
    To observe use in config-observability:
 logging.enable-request-log: "true"
 logging.request-log-template: '{"httpRequest": {"requestMethod": "{{.Request.Method}}", "requestUrl": "{{js .Request.RequestURI}}", "requestSize": "{{.Request.ContentLength}}", "status": {{.Response.Code}}, "responseSize": "{{.Response.Size}}", "userAgent": "{{js .Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp": "{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency": "{{.Response.Latency}}s", "protocol": "{{.Request.Proto}}"}, "traceId": "{{index .Request.Header "X-B3-Traceid"}}", "XFF": "{{index .Request.Header "X-Forwarded-For"}}", "XEAA": "{{index .Request.Header "X-Envoy-External-Address"}}"}'

For more check Example 1 in here.

/kind enhancement

Fixes #1289

Release Note

Adds support for use_remote_address field.

Docs


Copy link

knative-prow bot commented Sep 20, 2024

@skonto: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

In response to this:

Changes

  • As per title
  • When the field is set to true and num of hops is zero (Kourier at the edge) you can get the downstream ip of the client.
    To observe use in config-obsverability:
logging.enable-request-log: "true"
logging.request-log-template: '{"httpRequest": {"requestMethod": "{{.Request.Method}}", "requestUrl": "{{js .Request.RequestURI}}", "requestSize": "{{.Request.ContentLength}}", "status": {{.Response.Code}}, "responseSize": "{{.Response.Size}}", "userAgent": "{{js .Request.UserAgent}}", "remoteIp": "{{js .Request.RemoteAddr}}", "serverIp": "{{.Revision.PodIP}}", "referer": "{{js .Request.Referer}}", "latency": "{{.Response.Latency}}s", "protocol": "{{.Request.Proto}}"}, "traceId": "{{index .Request.Header "X-B3-Traceid"}}", "XFF": "{{index .Request.Header "X-Forwarded-For"}}", "XEAA": "{{index .Request.Header "X-Envoy-External-Address"}}"}'

For more check Example 1 in here.

/kind

Fixes #1289

Release Note

Adds support for use_remote_address field.

Docs


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link

knative-prow bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: skonto

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 20, 2024
@@ -40,7 +40,7 @@ func TestNewHTTPConnectionManagerWithoutAccessLogWithoutProxyProtocol(t *testing
}
connManager := NewHTTPConnectionManager("test", &kourierConfig)
assert.Check(t, len(connManager.AccessLog) == 0)
assert.Check(t, connManager.UseRemoteAddress == nil)
assert.Check(t, connManager.UseRemoteAddress.Value == false)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they mutual exclusive? Should we warn the user? 🤔

@skonto skonto changed the title Expose use-remote-address Expose use_remote_address Sep 20, 2024
Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.38%. Comparing base (705fb63) to head (4247297).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1290      +/-   ##
==========================================
+ Coverage   62.31%   62.38%   +0.06%     
==========================================
  Files          24       24              
  Lines        1632     1635       +3     
==========================================
+ Hits         1017     1020       +3     
  Misses        553      553              
  Partials       62       62              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@skonto
Copy link
Contributor Author

skonto commented Sep 20, 2024

@ReToCode any idea about the tls failures?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose use_remote_address for edge scanarios
3 participants