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

[repo depot 2/n] sled agent APIs to manage update artifact storage #6764

Merged
merged 33 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a5052d0
sled agent APIs to manage update artifact storage
iliana Oct 2, 2024
ce1bc42
fn datasets -> fn dataset_mountpoints
iliana Oct 4, 2024
5ad16a1
be more resilient in the face of io errors
iliana Oct 4, 2024
485ee40
clean up temporary files on startup
iliana Oct 4, 2024
26f4107
naming consistency
iliana Oct 4, 2024
893980e
log.cleanup_successful();
iliana Oct 4, 2024
03a51c7
Merge remote-tracking branch 'origin/main' into iliana/tuf-repo-depot
iliana Oct 15, 2024
efcfb92
document ArtifactStore
iliana Oct 11, 2024
e8b2673
fn put -> put_impl
iliana Oct 11, 2024
3b15f3b
copy_from_depot should take a URL
iliana Oct 15, 2024
c909649
reduce semantic satiation
iliana Oct 15, 2024
4325077
remove default type parameter
iliana Oct 15, 2024
86b8047
StorageBackend -> DatasetsManager; attempt clean up
iliana Oct 15, 2024
599089a
create reqwest client at startup, not on first use
iliana Oct 15, 2024
f624e5d
don't embed source error strings
iliana Oct 15, 2024
b44d06b
fewer contextless errors
iliana Oct 15, 2024
013e67f
another docstring
iliana Oct 15, 2024
5eefb6e
add the repo depot API to api-manifest.toml
iliana Oct 15, 2024
aebfe32
add list artifacts operation
iliana Oct 16, 2024
d743727
Merge remote-tracking branch 'origin/main' into iliana/tuf-repo-depot
iliana Oct 28, 2024
2ae3743
create an update artifact dataset on both M.2s
iliana Oct 28, 2024
45c4cac
PUT artifacts to all artifact datasets
iliana Oct 28, 2024
3c2f866
change list API to return a count of each artifact
iliana Oct 29, 2024
743a67b
make copy_from_depot create a task and return
iliana Oct 29, 2024
58b9cbe
ls-apis expectorate
iliana Oct 29, 2024
6906679
Merge remote-tracking branch 'origin/main' into iliana/tuf-repo-depot
iliana Oct 30, 2024
cd7dc7b
review comments
iliana Oct 30, 2024
e967f02
propagate non-fatal write errors to `finalize()`
iliana Oct 30, 2024
508861d
expectoraaaaate
iliana Oct 30, 2024
9f96f71
Merge remote-tracking branch 'origin/main' into iliana/tuf-repo-depot
iliana Oct 31, 2024
32afac5
improved API responses for PUT/POST
iliana Oct 31, 2024
4d00c16
document ArtifactPutResponse fields
iliana Oct 31, 2024
9b3691a
Merge remote-tracking branch 'origin/main' into iliana/tuf-repo-depot
iliana Oct 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ members = [
"clients/nexus-client",
"clients/oxide-client",
"clients/oximeter-client",
"clients/repo-depot-client",
"clients/sled-agent-client",
"clients/wicketd-client",
"cockroach-admin",
Expand Down Expand Up @@ -97,6 +98,7 @@ members = [
"sled-agent",
"sled-agent/api",
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-hardware",
"sled-hardware/types",
Expand Down Expand Up @@ -135,6 +137,7 @@ default-members = [
"clients/nexus-client",
"clients/oxide-client",
"clients/oximeter-client",
"clients/repo-depot-client",
"clients/sled-agent-client",
"clients/wicketd-client",
"cockroach-admin",
Expand Down Expand Up @@ -219,6 +222,7 @@ default-members = [
"sled-agent",
"sled-agent/api",
"sled-agent/bootstrap-agent-api",
"sled-agent/repo-depot-api",
"sled-agent/types",
"sled-hardware",
"sled-hardware/types",
Expand Down Expand Up @@ -529,6 +533,8 @@ reedline = "0.33.0"
ref-cast = "1.0"
regex = "1.10.6"
regress = "0.9.1"
repo-depot-api = { path = "sled-agent/repo-depot-api" }
repo-depot-client = { path = "clients/repo-depot-client" }
reqwest = { version = "0.12", default-features = false }
ring = "0.17.8"
rpassword = "7.3.1"
Expand Down
16 changes: 16 additions & 0 deletions clients/repo-depot-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "repo-depot-client"
version = "0.1.0"
edition = "2021"
license = "MPL-2.0"

[lints]
workspace = true

[dependencies]
omicron-workspace-hack.workspace = true
progenitor.workspace = true
reqwest.workspace = true
schemars.workspace = true
serde.workspace = true
slog.workspace = true
24 changes: 24 additions & 0 deletions clients/repo-depot-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Interface for Sled Agent's Repo Depot to make API requests.

progenitor::generate_api!(
spec = "../../openapi/repo-depot.json",
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
slog::debug!(log, "client request";
"method" => %request.method(),
"uri" => %request.url(),
"body" => ?&request.body(),
);
}),
post_hook = (|log: &slog::Logger, result: &Result<_, _>| {
slog::debug!(log, "client response"; "result" => ?result);
}),
derives = [schemars::JsonSchema],
);

/// A type alias for errors returned by this crate.
pub type ClientError = crate::Error<crate::types::Error>;
1 change: 1 addition & 0 deletions common/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub const MIN_PORT: u16 = u16::MIN;
pub const DNS_PORT: u16 = 53;
pub const DNS_HTTP_PORT: u16 = 5353;
pub const SLED_AGENT_PORT: u16 = 12345;
pub const REPO_DEPOT_PORT: u16 = 12348;

pub const COCKROACH_PORT: u16 = 32221;
pub const COCKROACH_ADMIN_PORT: u16 = 32222;
Expand Down
7 changes: 4 additions & 3 deletions dev-tools/openapi-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ anyhow.workspace = true
atomicwrites.workspace = true
bootstrap-agent-api.workspace = true
camino.workspace = true
clap.workspace = true
clickhouse-admin-api.workspace = true
cockroach-admin-api.workspace = true
clap.workspace = true
dns-server-api.workspace = true
dropshot.workspace = true
fs-err.workspace = true
Expand All @@ -24,13 +24,14 @@ installinator-api.workspace = true
nexus-external-api.workspace = true
nexus-internal-api.workspace = true
omicron-workspace-hack.workspace = true
openapiv3.workspace = true
openapi-lint.workspace = true
openapi-manager-types.workspace = true
openapiv3.workspace = true
owo-colors.workspace = true
oximeter-api.workspace = true
repo-depot-api.workspace = true
serde_json.workspace = true
sled-agent-api.workspace = true
similar.workspace = true
sled-agent-api.workspace = true
supports-color.workspace = true
wicketd-api.workspace = true
9 changes: 9 additions & 0 deletions dev-tools/openapi-manager/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ pub fn all_apis() -> Vec<ApiSpec> {
filename: "oximeter.json",
extra_validation: None,
},
ApiSpec {
title: "Oxide TUF Repo Depot API",
version: "0.0.1",
description: "API for fetching update artifacts",
boundary: ApiBoundary::Internal,
api_description: repo_depot_api::repo_depot_api_mod::stub_api_description,
filename: "repo-depot.json",
extra_validation: None,
},
ApiSpec {
title: "Oxide Sled Agent API",
version: "0.0.1",
Expand Down
82 changes: 82 additions & 0 deletions openapi/repo-depot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"openapi": "3.0.3",
"info": {
"title": "Oxide TUF Repo Depot API",
"description": "API for fetching update artifacts",
"contact": {
"url": "https://oxide.computer",
"email": "[email protected]"
},
"version": "0.0.1"
},
"paths": {
"/artifact/sha256/{sha256}": {
"get": {
"summary": "Fetch an artifact from the depot.",
"operationId": "artifact_get_by_sha256",
"parameters": [
{
"in": "path",
"name": "sha256",
"required": true,
"schema": {
"type": "string",
"format": "hex string (32 bytes)"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"*/*": {
"schema": {}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
}
}
},
"components": {
"schemas": {
"Error": {
"description": "Error information from a response.",
"type": "object",
"properties": {
"error_code": {
"type": "string"
},
"message": {
"type": "string"
},
"request_id": {
"type": "string"
}
},
"required": [
"message",
"request_id"
]
}
},
"responses": {
"Error": {
"description": "Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}
Loading
Loading