Handle HTTP traffic over opaque transport connections#1416
Merged
Conversation
If an endpoint is set as opaque, but its logical service is not marked as opaque, the connection will error out. The `TransportHeader` in this case will not contain the logical name of the service, but it will still do protocol detection. Through this change, when an endpoint is marked as opaque and we connect to the proxy's inbound port, if the `TransportHeader` has a protocol, we go through the inbound HTTP stack instead of proxying TCP. Add session protocol to local Signed-off-by: Matei David <[email protected]>
Signed-off-by: Matei David <[email protected]>
Signed-off-by: Matei David <[email protected]>
Signed-off-by: Matei David <[email protected]>
olix0r
reviewed
Dec 20, 2021
Comment on lines
-134
to
-135
| let permit = | ||
| allow.check_authorized(client.client_addr, &tls)?; |
Member
There was a problem hiding this comment.
If I understand correctly, we are no longer checking the policy on opaque connections?
It's probably better to introduce a new target type--LocalHttp or something (and rename Local to LocalTcp?). This switch could return an Either<Either<LocalTcp, LocalHttp>, GatewayTransportHeader> and then the inner switch predicate can simply return the target... I can probably put a suggestion up to this effect.
* Introduce a dedicated direct::LocalHttp target type * -pub * - needless borrow * remove redundant check_policy
olix0r
approved these changes
Dec 23, 2021
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
Jan 6, 2022
In addition to dependency updates, this change updates the inbound proxy to handle opaquely transported HTTP traffic. This fixes an issue encountered when a `Service`'s opaque ports annotation does not match that of the pods in the service. This situation should be rare. --- * Handle HTTP traffic over opaque transport connections (linkerd/linkerd2-proxy#1416) * build(deps): bump tracing-subscriber from 0.3.3 to 0.3.4 (linkerd/linkerd2-proxy#1421) * build(deps): bump pin-project from 1.0.8 to 1.0.9 (linkerd/linkerd2-proxy#1422) * build(deps): bump tracing-subscriber from 0.3.4 to 0.3.5 (linkerd/linkerd2-proxy#1423) * build(deps): bump pin-project from 1.0.9 to 1.0.10 (linkerd/linkerd2-proxy#1425) * build(deps): bump http from 0.2.5 to 0.2.6 (linkerd/linkerd2-proxy#1424) * build(deps): bump serde_json from 1.0.73 to 1.0.74 (linkerd/linkerd2-proxy#1427) * Decouple client connection metadata from the I/O type (linkerd/linkerd2-proxy#1426) * tests: rename 'metrics' addr to 'admin' (linkerd/linkerd2-proxy#1429)
olix0r
added a commit
to linkerd/linkerd2
that referenced
this pull request
Jan 6, 2022
In addition to dependency updates, this change updates the inbound proxy to handle opaquely transported HTTP traffic. This fixes an issue encountered when a `Service`'s opaque ports annotation does not match that of the pods in the service. This situation should be rare. --- * Handle HTTP traffic over opaque transport connections (linkerd/linkerd2-proxy#1416) * build(deps): bump tracing-subscriber from 0.3.3 to 0.3.4 (linkerd/linkerd2-proxy#1421) * build(deps): bump pin-project from 1.0.8 to 1.0.9 (linkerd/linkerd2-proxy#1422) * build(deps): bump tracing-subscriber from 0.3.4 to 0.3.5 (linkerd/linkerd2-proxy#1423) * build(deps): bump pin-project from 1.0.9 to 1.0.10 (linkerd/linkerd2-proxy#1425) * build(deps): bump http from 0.2.5 to 0.2.6 (linkerd/linkerd2-proxy#1424) * build(deps): bump serde_json from 1.0.73 to 1.0.74 (linkerd/linkerd2-proxy#1427) * Decouple client connection metadata from the I/O type (linkerd/linkerd2-proxy#1426) * tests: rename 'metrics' addr to 'admin' (linkerd/linkerd2-proxy#1429)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes linkerd/linkerd2#6178
When an endpoint is marked as opaque, but its logical service does not have an opaque annotation, the
TransportHeaderwill not an include an alternate name, but it will the connection protocol:The connection will be closed with an error. Through this change, we can handle HTTP traffic over opaque connections a bit more gracefully. When a
TransportHeaderhas a protocol but no alternate name for the target, instead of rejecting the connection, we go through the inbound http stack. The full set of logs are attached in a spoiler tag below.Full set of logs from k3d test
This seems to work in k3d. To get this to work, I had to implement a bunch of param traits on
Localso that it can be used with the HTTP stack. In the process, I refactored some of the existingparamimplementations; would appreciate a more thorough look there to make sure we don't have redundancies or obvious failures.Edit: I see there are some leftover compiler assertions we used for the target type. Do we generally want those removed when the PR is submitted? Probably an obvious question but thought I'd ask anyway.