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

[nexus] Support Bundle HTTP endpoint implementations #7187

Draft
wants to merge 18 commits into
base: support-bundle-bg-task
Choose a base branch
from

Conversation

smklein
Copy link
Collaborator

@smklein smklein commented Nov 28, 2024

PR 5 / ???

Implements support bundle APIs for accessing storage bundles.

Builds atop the API skeleton in:

Uses the support bundle datastore interfaces in:

Relies on the background task in:

TODO before merging:

  • Integration tests?
  • If possible, make range requests work correctly?

Comment on lines +102 to +112
let mut builder = Response::builder().status(response.status());
let headers = builder.headers_mut().unwrap();
headers.extend(
response.headers().iter().map(|(k, v)| (k.clone(), v.clone())),
);
let body = http_body_util::StreamBody::new(
response
.into_inner_stream()
.map_ok(|b| hyper::body::Frame::data(b)),
);
Ok(builder.body(Body::wrap(body)).unwrap())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My intent here is to act as much like a transparent proxy as I can -- find the sled that should hold the bundle, and send a request there.

If it's possible to do that without these types, I'd love that.

.await?;
let client = self.sled_client(&sled_id).await?;

// TODO: Use "range"?
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure how to do this with the progenitor-generated API.

I could pull out the reqwest client manually, with client.client() (names are silly) , and then I could manually construct the URL / body / headers, but... that kinda defeats the point of using progenitor, right?

That might be our only option for the moment.

@smklein smklein force-pushed the support-bundle-wire-up-http-endpoints branch from 07be0de to 9b2176c Compare November 28, 2024 00:52
@smklein smklein changed the title [nexus] Support bundle HTTP endpoint implementations [nexus] Support Bundle HTTP endpoint implementations Nov 28, 2024
SetupReq::Post {
url: &SUPPORT_BUNDLES_URL,
body: serde_json::to_value(()).unwrap(),
id_routes: vec!["/experimental/v1/system/support-bundles/{id}"],
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: If I want to get coverage for the download/index paths, I need them here as id_routes too.

Comment on lines 5 to 7
support_bundle_download (get "/experimental/v1/system/support-bundles/{support_bundle}/download")
support_bundle_download_file (get "/experimental/v1/system/support-bundles/{support_bundle}/download/{file}")
support_bundle_index (get "/experimental/v1/system/support-bundles/{support_bundle}/index")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's probably possible to test these endpoints in the unathorized.rs test, but it's kinda a pain -- one of the "setup requests" there involves POST-ing the support bundle, but it doesn't wait for the background task of collection to complete asynchronously.

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.

1 participant