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

refactor(proxy/http): extricate Body middleware types #3382

Merged
merged 6 commits into from
Nov 26, 2024

Conversation

cratelyn
Copy link
Collaborator

@cratelyn cratelyn commented Nov 21, 2024

this branch pulls a number of components providing http_body::Body middleware out of linkerd-proxy-http and into new libraries: linkerd-http-classify, linkerd-http-stream-timeouts, linkerd-http-retain, and linkerd-http-override-authority.

these are each performed in distinct commits, to facilitate review.

@cratelyn cratelyn marked this pull request as ready for review November 21, 2024 22:53
@cratelyn cratelyn requested a review from a team as a code owner November 21, 2024 22:53
Copy link
Collaborator

@sfleen sfleen left a comment

Choose a reason for hiding this comment

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

This is awesome! A few minor style nits, nothing substantial.

Cargo.toml Outdated
@@ -85,7 +87,7 @@ members = [
"opencensus-proto",
"opentelemetry-proto",
"spiffe-proto",
"tools",
"tools", "linkerd/http/override-authority",
Copy link
Collaborator

Choose a reason for hiding this comment

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

format nit: sort and put on it's own line

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thank you for spotting this!

this is moved onto its own sorted line in the amended commit 5f9c146

@@ -23,6 +26,27 @@ pub struct OverrideAuthority<S, H> {
inner: S,
}

/// Sets the [`Authority`][uri::Authority] of the given URI.
Copy link
Collaborator

Choose a reason for hiding this comment

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

optional: This can just be [`Authority`] since it's already imported, but I'm not sure what our style guidelines are around this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good catch, thanks! i appreciate the close eye. 🦅

this is fixed in the amended commit 5f9c146

@cratelyn cratelyn force-pushed the kate/yoink-http-body-middleware branch 2 times, most recently from 5f9c146 to 1631681 Compare November 22, 2024 14:55
@cratelyn
Copy link
Collaborator Author

rebased to address a minor typo in a commit message 👼

cratelyn added a commit that referenced this pull request Nov 22, 2024
in this case we already had a crate defining the classify traits, but
the http body and other assorted middleware were defined in
`linkerd-proxy-http`.

this commit moves those types to the `linkerd-http-classify` crate,
which astute readers may notice, is a concrete step towards simplifying
the `linkerd-proxy-http` crate's upgrade process.

one small detail worth calling out: we implement `http_body::Body`
directly, to avoid taking on a `hyper` dependency. otherwise, nothing
has changed in the `channel`, `gate`, and `insert` middleware.

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit that referenced this pull request Nov 22, 2024
this moves the `Retain` middleware from `linkerd-proxy-http` into a new
`linkerd-http-retain` crate.

as previously, reëxports are added to make this a backwards compatible
change.

this moves another http body middleware out of the proxy's core http
crate. great news.

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit that referenced this pull request Nov 22, 2024
)

this commit outlines the stream timeout middleware, pulling it out of
`linkerd-proxy-http` and into a standalone crate.

again, reëxports are added to make this a backwards compatible change.

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit that referenced this pull request Nov 22, 2024
…3382)

NB: based on #3379 and #3380.

this pull the `override_authority` submodule out of
`linkerd-http-proxy` and into a standalone crate.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn cratelyn force-pushed the kate/yoink-http-body-middleware branch from 1631681 to 7f564f9 Compare November 22, 2024 14:59
in this case we already had a crate defining the classify traits, but
the http body and other assorted middleware were defined in
`linkerd-proxy-http`.

this commit moves those types to the `linkerd-http-classify` crate,
which astute readers may notice, is a concrete step towards simplifying
the `linkerd-proxy-http` crate's upgrade process.

one small detail worth calling out: we implement `http_body::Body`
directly, to avoid taking on a `hyper` dependency. otherwise, nothing
has changed in the `channel`, `gate`, and `insert` middleware.

Signed-off-by: katelyn martin <[email protected]>
this moves the `Retain` middleware from `linkerd-proxy-http` into a new
`linkerd-http-retain` crate.

as previously, reëxports are added to make this a backwards compatible
change.

this moves another http body middleware out of the proxy's core http
crate. great news.

Signed-off-by: katelyn martin <[email protected]>
)

this commit outlines the stream timeout middleware, pulling it out of
`linkerd-proxy-http` and into a standalone crate.

again, reëxports are added to make this a backwards compatible change.

Signed-off-by: katelyn martin <[email protected]>
…3382)

NB: based on #3379 and #3380.

this pull the `override_authority` submodule out of
`linkerd-http-proxy` and into a standalone crate.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn cratelyn force-pushed the kate/yoink-http-body-middleware branch from 7f564f9 to cb9f511 Compare November 25, 2024 16:46
this is only used in once place, so as a brief chore before we move the
upgrade submodule out into its own crate, we pull `is_bad_request()`
next to its call site.

Signed-off-by: katelyn martin <[email protected]>
this moves the inter-related `upgrade` and `glue` submodules out of the
`linkerd-proxy-http` library and into a new standalone crate.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn cratelyn force-pushed the kate/yoink-http-body-middleware branch from cb9f511 to 61d2a63 Compare November 25, 2024 16:48
@cratelyn
Copy link
Collaborator Author

rebased onto the latest main, and pulled in the HTTP/1 upgrade facilities originally outlined in #3386.

@olix0r olix0r self-assigned this Nov 25, 2024
Copy link
Member

@olix0r olix0r left a comment

Choose a reason for hiding this comment

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

Yep, this is looking good to me.

@cratelyn cratelyn merged commit aa1dbd7 into main Nov 26, 2024
20 checks passed
@cratelyn cratelyn deleted the kate/yoink-http-body-middleware branch November 26, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants