Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion clients/bootstrap-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Interface for making API requests to a Bootstrap Agent

progenitor::generate_api!(
spec = "../../openapi/bootstrap-agent.json",
spec = "../../openapi/bootstrap-agent/bootstrap-agent-1.0.0-127591.json",
interface = Positional,
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
Expand Down
2 changes: 1 addition & 1 deletion clients/installinator-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Interface for installinator to make API requests.

progenitor::generate_api!(
spec = "../../openapi/installinator.json",
spec = "../../openapi/installinator/installinator-1.0.0-c0ed87.json",
interface = Positional,
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
Expand Down
12 changes: 11 additions & 1 deletion clients/nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! from within the control plane

progenitor::generate_api!(
spec = "../../openapi/nexus-internal.json",
spec = "../../openapi/nexus-internal/nexus-internal-1.0.0-6d8ade.json",
interface = Positional,
derives = [schemars::JsonSchema, PartialEq],
inner_type = slog::Logger,
Expand Down Expand Up @@ -261,3 +261,13 @@ impl TryFrom<types::ProducerEndpoint>
})
}
}

impl From<nexus_types::external_api::shared::Baseboard> for types::Baseboard {
fn from(value: nexus_types::external_api::shared::Baseboard) -> Self {
types::Baseboard {
part: value.part,
revision: value.revision,
serial: value.serial,
}
}
}
2 changes: 1 addition & 1 deletion clients/repo-depot-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! Interface for Sled Agent's Repo Depot to make API requests.

progenitor::generate_api!(
spec = "../../openapi/repo-depot.json",
spec = "../../openapi/repo-depot/repo-depot-1.0.0-65083f.json",
interface = Positional,
inner_type = slog::Logger,
pre_hook = (|log: &slog::Logger, request: &reqwest::Request| {
Expand Down
16 changes: 12 additions & 4 deletions dev-tools/dropshot-apis/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
let apis = vec![
ManagedApiConfig {
title: "Bootstrap Agent API",
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
versions: Versions::new_versioned(
bootstrap_agent_api::supported_versions(),
),
metadata: ManagedApiMetadata {
description: Some("Per-sled API for setup and teardown"),
contact_url: Some("https://oxide.computer"),
Expand Down Expand Up @@ -172,7 +174,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
},
ManagedApiConfig {
title: "Installinator API",
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
versions: Versions::new_versioned(
installinator_api::supported_versions(),
),
metadata: ManagedApiMetadata {
description: Some(
"API for installinator to fetch artifacts \
Expand Down Expand Up @@ -205,7 +209,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
},
ManagedApiConfig {
title: "Nexus internal API",
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
versions: Versions::new_versioned(
nexus_internal_api::supported_versions(),
),
metadata: ManagedApiMetadata {
description: Some("Nexus internal API"),
contact_url: Some("https://oxide.computer"),
Expand Down Expand Up @@ -261,7 +267,9 @@ fn all_apis() -> anyhow::Result<ManagedApis> {
},
ManagedApiConfig {
title: "Oxide TUF Repo Depot API",
versions: Versions::new_lockstep(semver::Version::new(0, 0, 1)),
versions: Versions::new_versioned(
repo_depot_api::supported_versions(),
),
metadata: ManagedApiMetadata {
description: Some("API for fetching update artifacts"),
contact_url: Some("https://oxide.computer"),
Expand Down
3 changes: 2 additions & 1 deletion dev-tools/repo-depot-standalone/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ clap.workspace = true
dropshot.workspace = true
futures.workspace = true
libc.workspace = true
omicron-common.workspace = true
omicron-workspace-hack.workspace = true
oxide-tokio-rt.workspace = true
repo-depot-api.workspace = true
serde_json.workspace = true
Expand All @@ -26,7 +28,6 @@ tokio = { workspace = true, features = [ "full" ] }
tokio-util.workspace = true
tufaceous-artifact.workspace = true
update-common.workspace = true
omicron-workspace-hack.workspace = true

[[bin]]
name = "repo-depot-standalone"
Expand Down
6 changes: 6 additions & 0 deletions dev-tools/repo-depot-standalone/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ impl RepoDepotStandalone {
bind_address: self.listen_addr,
..Default::default()
})
.version_policy(dropshot::VersionPolicy::Dynamic(Box::new(
dropshot::ClientSpecifiesVersionInHeader::new(
omicron_common::api::VERSION_HEADER,
repo_depot_api::latest_version(),
),
)))
.start()
.context("failed to create server")?;

Expand Down
1 change: 1 addition & 0 deletions installinator-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ workspace = true
[dependencies]
anyhow.workspace = true
dropshot.workspace = true
dropshot-api-manager-types.workspace = true
hyper.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
Expand Down
7 changes: 7 additions & 0 deletions installinator-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ use dropshot::{
HttpResponseHeaders, HttpResponseOk, HttpResponseUpdatedNoContent, Path,
RequestContext, TypedBody,
};
use dropshot_api_manager_types::api_versions;
use hyper::header;
use omicron_uuid_kinds::MupdateUuid;
use schemars::JsonSchema;
use serde::Deserialize;
use tufaceous_artifact::ArtifactHashId;
use update_engine::{NestedSpec, events::EventReport};

api_versions!([
// Do not create new versions of this client-side versioned API.
// https://github.com/oxidecomputer/omicron/issues/9290
(1, INITIAL),
]);

const PROGRESS_REPORT_MAX_BYTES: usize = 4 * 1024 * 1024;

#[derive(Debug, Deserialize, JsonSchema)]
Expand Down
1 change: 1 addition & 0 deletions nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ httpmock.workspace = true
httptest.workspace = true
hubtools.workspace = true
hyper-rustls.workspace = true
nexus-client.workspace = true
nexus-db-queries = { workspace = true, features = ["testing"] }
nexus-lockstep-client.workspace = true
nexus-test-utils.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion nexus/internal-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ workspace = true

[dependencies]
dropshot.workspace = true
dropshot-api-manager-types.workspace = true
http.workspace = true
nexus-types.workspace = true
omicron-common.workspace = true
omicron-uuid-kinds.workspace = true
omicron-workspace-hack.workspace = true
serde.workspace = true
schemars.workspace = true
serde.workspace = true
uuid.workspace = true
7 changes: 7 additions & 0 deletions nexus/internal-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use dropshot::{
HttpResponseUpdatedNoContent, Path, Query, RequestContext, ResultsPage,
TypedBody,
};
use dropshot_api_manager_types::api_versions;
use nexus_types::{
external_api::{
shared::ProbeInfo,
Expand All @@ -34,6 +35,12 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;

api_versions!([
// Do not create new versions of this client-side versioned API.
// https://github.com/oxidecomputer/omicron/issues/9290
(1, INITIAL),
]);

#[dropshot::api_description]
pub trait NexusInternalApi {
type Context;
Expand Down
6 changes: 6 additions & 0 deletions nexus/mgs-updates/src/test_util/test_artifacts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,12 @@ impl TestArtifacts {
.unwrap();

ServerBuilder::new(my_api, Arc::new(artifact_data), log)
.version_policy(dropshot::VersionPolicy::Dynamic(Box::new(
dropshot::ClientSpecifiesVersionInHeader::new(
omicron_common::api::VERSION_HEADER,
repo_depot_api::latest_version(),
),
)))
.start()
.context("failed to create server")?
};
Expand Down
6 changes: 6 additions & 0 deletions nexus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ impl InternalServer {
log.new(o!("component" => "dropshot_internal")),
)
.config(config.deployment.dropshot_internal.clone())
.version_policy(dropshot::VersionPolicy::Dynamic(Box::new(
dropshot::ClientSpecifiesVersionInHeader::new(
omicron_common::api::VERSION_HEADER,
nexus_internal_api::latest_version(),
),
)))
.start()
.map_err(|error| format!("initializing internal server: {}", error))
{
Expand Down
1 change: 1 addition & 0 deletions nexus/test-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ id-map.workspace = true
illumos-utils.workspace = true
internal-dns-resolver.workspace = true
internal-dns-types.workspace = true
nexus-client.workspace = true
nexus-config.workspace = true
nexus-db-queries = { workspace = true, features = [ "testing" ] }
nexus-lockstep-client.workspace = true
Expand Down
7 changes: 7 additions & 0 deletions nexus/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,13 @@ impl<N: NexusServer> ControlPlaneTestContext<N> {
}
}

pub fn internal_client(&self) -> nexus_client::Client {
nexus_client::Client::new(
&format!("http://{}", self.internal_client.bind_address),
self.internal_client.client_log.clone(),
)
}

pub async fn teardown(mut self) {
self.server.close().await;
self.database.cleanup().await.unwrap();
Expand Down
13 changes: 3 additions & 10 deletions nexus/tests/integration_tests/crucible_replacements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ mod region_snapshot_replacement {
datastore: Arc<DataStore>,
disk_test: DiskTest<'a>,
client: ClientTestContext,
internal_client: ClientTestContext,
internal_client: nexus_client::Client,
lockstep_client: ClientTestContext,
replacement_request_id: Uuid,
snapshot_socket_addr: SocketAddr,
Expand All @@ -1334,7 +1334,7 @@ mod region_snapshot_replacement {
.await;

let client = &cptestctx.external_client;
let internal_client = &cptestctx.internal_client;
let internal_client = cptestctx.internal_client();
let lockstep_client = &cptestctx.lockstep_client;
let datastore = nexus.datastore().clone();

Expand Down Expand Up @@ -1768,15 +1768,8 @@ mod region_snapshot_replacement {

let disk_id = disk_from_snapshot.identity.id;

// Note: `make_request` needs a type here, otherwise rustc cannot
// figure out the type of the `request_body` parameter
self.internal_client
.make_request::<u32>(
http::Method::POST,
&format!("/disk/{disk_id}/remove-read-only-parent"),
None,
http::StatusCode::NO_CONTENT,
)
.cpapi_disk_remove_read_only_parent(&disk_id)
.await
.unwrap();
}
Expand Down
Loading
Loading