-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use HTTP path prefix of TCP connections to match Docker context behavior #23486
Use HTTP path prefix of TCP connections to match Docker context behavior #23486
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you running the service behind a reverse proxy or what is the use case of this?
Yes, exactly. Say if you had something like Without this change, you would need to create and run a small service that reverse proxied the base path to the prefixed path for every single prefixed connection. My change won't work if the reverse proxy required any authentication, though. I suppose you could also use the c.URI.User to insert HTTP Basic Auth info back into the URI, but I didn't include this in the PR. However, this change still helps in the case of connecting to a remote reverse proxy with auth, because you could run a single local reverse proxy that authenticates to the remote reverse proxy rather than one per prefix. That was a little confusing, but I hope it makes sense. Reverse proxies are the use case here. P.S. I'm looking into adding a test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once a test is added, not sure what a good test for it though. Adding a reverse proxy into our test setup seems way to overkill.
One option is test/e2e/system_connection_test.go and just create a http server there in the test via go std lib and then check the path in the request we got from the client.
LGTM |
i think we are just waiting on some form of a test? LGTM otherwise |
72523b6
to
07a2315
Compare
Added a quick and dirty test. I haven't been able to get integration tests running locally, so I doubt it works, but does this look like the right direction? |
4e3f719
to
56fd266
Compare
Got tests passing outside of containerized environments. Inside a container, there's a failure in the BeforeEach when running |
56fd266
to
8ec9638
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can you squash both of your commits please
8963f4a
to
623aaa9
Compare
This is now ready for re-review. The e2e test has been changed to 1) work and 2) set a boolean var when the reverse proxy path is actually triggered. Further, Example logs from CI (https://api.cirrus-ci.com/v1/task/4624964236607488/logs/main.log) of the test running successfully:
|
623aaa9
to
5e26dd2
Compare
Signed-off-by: Ben Krieger <[email protected]>
5e26dd2
to
6c68f4a
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ben-krieger, rhatdan 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 |
Currently
podman system connection add
allows providing TCP connections with paths. However, these paths are not actually used.NB: The
d
value for host is an ignored placeholder value, because the client uses an*http.Transport
that dials the correct host with the correct scheme (not necessarily TCP).The docker client, however, does respect this path prefix. Upon parsing the connection/context URI, it saves the path as
basePath
: https://github.com/moby/moby/blob/ddea6b0fa8f816377b59e3f7d7b3c32fef629022/client/client.go#L401-L423This PR introduces the same behavior:
Release Note