Skip to content

Commit

Permalink
review feedback, bump maghemite
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Jul 10, 2024
1 parent 2d2e324 commit 415fcf8
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 96 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ macaddr = { version = "1.0.1", features = ["serde_std"] }
maplit = "1.0.2"
mockall = "0.12"
newtype_derive = "0.1.6"
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" }
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3" }
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" }
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c" }
multimap = "0.10.0"
nexus-auth = { path = "nexus/auth" }
nexus-client = { path = "clients/nexus-client" }
Expand Down
11 changes: 0 additions & 11 deletions nexus/src/app/bgp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,6 @@ impl super::Nexus {
Ok(result)
}

pub async fn bgp_create_announce_set(
&self,
opctx: &OpContext,
announce: &params::BgpAnnounceSetCreate,
) -> CreateResult<(BgpAnnounceSet, Vec<BgpAnnouncement>)> {
opctx.authorize(authz::Action::Modify, &authz::FLEET).await?;
let result =
self.db_datastore.bgp_create_announce_set(opctx, announce).await?;
Ok(result)
}

pub async fn bgp_update_announce_set(
&self,
opctx: &OpContext,
Expand Down
29 changes: 2 additions & 27 deletions nexus/src/external_api/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ pub(crate) fn external_api() -> NexusApiDescription {
api.register(networking_bgp_status)?;
api.register(networking_bgp_imported_routes_ipv4)?;
api.register(networking_bgp_config_delete)?;
api.register(networking_bgp_announce_set_create)?;
api.register(networking_bgp_announce_set_update)?;
api.register(networking_bgp_announce_set_list)?;
api.register(networking_bgp_announce_set_delete)?;
Expand Down Expand Up @@ -4060,32 +4059,8 @@ async fn networking_bgp_config_delete(
.await
}

/// Create new BGP announce set
#[endpoint {
method = POST,
path = "/v1/system/networking/bgp-announce",
tags = ["system/networking"],
}]
async fn networking_bgp_announce_set_create(
rqctx: RequestContext<ApiContext>,
config: TypedBody<params::BgpAnnounceSetCreate>,
) -> Result<HttpResponseCreated<BgpAnnounceSet>, HttpError> {
let apictx = rqctx.context();
let handler = async {
let nexus = &apictx.context.nexus;
let config = config.into_inner();
let opctx = crate::context::op_context_for_external_api(&rqctx).await?;
let result = nexus.bgp_create_announce_set(&opctx, &config).await?;
Ok(HttpResponseCreated::<BgpAnnounceSet>(result.0.into()))
};
apictx
.context
.external_latencies
.instrument_dropshot_handler(&rqctx, handler)
.await
}

/// Update a BGP announce set
/// Update a BGP announce set. If the announce set exists this endpoint replaces
/// the existing announce set with the one specified.
#[endpoint {
method = PUT,
path = "/v1/system/networking/bgp-announce",
Expand Down
3 changes: 0 additions & 3 deletions nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2307,9 +2307,6 @@ pub static VERIFY_ENDPOINTS: Lazy<Vec<VerifyEndpoint>> = Lazy::new(|| {
visibility: Visibility::Public,
unprivileged_access: UnprivilegedAccess::None,
allowed_methods: vec![
AllowedMethod::Post(
serde_json::to_value(&*DEMO_BGP_ANNOUNCE).unwrap(),
),
AllowedMethod::Put(
serde_json::to_value(&*DEMO_BGP_ANNOUNCE).unwrap(),
),
Expand Down
1 change: 0 additions & 1 deletion nexus/tests/output/nexus_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ networking_allow_list_view GET /v1/system/networking/allow-li
networking_bfd_disable POST /v1/system/networking/bfd-disable
networking_bfd_enable POST /v1/system/networking/bfd-enable
networking_bfd_status GET /v1/system/networking/bfd-status
networking_bgp_announce_set_create POST /v1/system/networking/bgp-announce
networking_bgp_announce_set_delete DELETE /v1/system/networking/bgp-announce
networking_bgp_announce_set_list GET /v1/system/networking/bgp-announce
networking_bgp_announce_set_update PUT /v1/system/networking/bgp-announce
Expand Down
38 changes: 2 additions & 36 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -6634,7 +6634,8 @@
"tags": [
"system/networking"
],
"summary": "Update a BGP announce set",
"summary": "Update a BGP announce set. If the announce set exists this endpoint replaces",
"description": "the existing announce set with the one specified.",
"operationId": "networking_bgp_announce_set_update",
"requestBody": {
"content": {
Expand Down Expand Up @@ -6665,41 +6666,6 @@
}
}
},
"post": {
"tags": [
"system/networking"
],
"summary": "Create new BGP announce set",
"operationId": "networking_bgp_announce_set_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BgpAnnounceSetCreate"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "successful creation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BgpAnnounceSet"
}
}
}
},
"4XX": {
"$ref": "#/components/responses/Error"
},
"5XX": {
"$ref": "#/components/responses/Error"
}
}
},
"delete": {
"tags": [
"system/networking"
Expand Down
12 changes: 6 additions & 6 deletions package-manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -563,10 +563,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3"
source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm-gz.sha256.txt
source.sha256 = "01b63e4b2b9537b223a417b9283cefb998ae8a3180108b7fbd7710adcf49bbf0"
source.sha256 = "280bd6e5c30d8f1076bac9b8dbbdbc45379e76259aa6319da257192fcbf64a54"
output.type = "tarball"

[package.mg-ddm]
Expand All @@ -579,10 +579,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3"
source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mg-ddm.sha256.txt
source.sha256 = "29ac6f5f61795795a2b1026606ac43d48435f1d685d2db2ab097aaaa9c5d6e6c"
source.sha256 = "f15f8bb0e13b1a9372c895775dae96b68ff1cc5e395e6bad4389c2a97957354e"
output.type = "zone"
output.intermediate_only = true

Expand All @@ -594,10 +594,10 @@ source.repo = "maghemite"
# `tools/maghemite_openapi_version`. Failing to do so will cause a failure when
# building `ddm-admin-client` (which will instruct you to update
# `tools/maghemite_openapi_version`).
source.commit = "6e0a232fd0b443c19f61f94bf02b7695505aa8e3"
source.commit = "8c5806d0bb3ac38efec716e22fe7cdcd424de09c"
# The SHA256 digest is automatically posted to:
# https://buildomat.eng.oxide.computer/public/file/oxidecomputer/maghemite/image/<commit>/mgd.sha256.txt
source.sha256 = "49f5224ea5f5078c11d71098fea29db9aafe9575876825f4e0216d9c64361f55"
source.sha256 = "b0223e0aad4c22bf980da17084caf6704d0428bad1b3e5daf54e7d415ce82d3e"
output.type = "zone"
output.intermediate_only = true

Expand Down
2 changes: 1 addition & 1 deletion tools/maghemite_ddm_openapi_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="6e0a232fd0b443c19f61f94bf02b7695505aa8e3"
COMMIT="8c5806d0bb3ac38efec716e22fe7cdcd424de09c"
SHA2="007bfb717ccbc077c0250dee3121aeb0c5bb0d1c16795429a514fa4f8635a5ef"
2 changes: 1 addition & 1 deletion tools/maghemite_mg_openapi_version
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
COMMIT="6e0a232fd0b443c19f61f94bf02b7695505aa8e3"
COMMIT="8c5806d0bb3ac38efec716e22fe7cdcd424de09c"
SHA2="e4b42ab9daad90f0c561a830b62a9d17e294b4d0da0a6d44b4030929b0c37b7e"
4 changes: 2 additions & 2 deletions tools/maghemite_mgd_checksums
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CIDL_SHA256="49f5224ea5f5078c11d71098fea29db9aafe9575876825f4e0216d9c64361f55"
MGD_LINUX_SHA256="48aa39bb2d68a81be5ad49986d9ebd3cbad64eee0bd6b4556c91b089760265ec"
CIDL_SHA256="b0223e0aad4c22bf980da17084caf6704d0428bad1b3e5daf54e7d415ce82d3e"
MGD_LINUX_SHA256="776f18e9e7fc905d5a2f33d1a1bdd8863ed988bb2965a222217ec06790a3f452"
42 changes: 42 additions & 0 deletions tools/update_maghemite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,45 @@ PACKAGES=(
REPO="oxidecomputer/maghemite"
. "$SOURCE_DIR/update_helpers.sh"

function update_openapi {
TARGET_COMMIT="$1"
DRY_RUN="$2"
DAEMON="$3"
SHA=$(get_sha "$REPO" "$TARGET_COMMIT" "${DAEMON}-admin.json" "openapi")
OUTPUT=$(printf "COMMIT=\"%s\"\nSHA2=\"%s\"\n" "$TARGET_COMMIT" "$SHA")

if [ -n "$DRY_RUN" ]; then
OPENAPI_PATH="/dev/null"
else
OPENAPI_PATH="$SOURCE_DIR/maghemite_${DAEMON}_openapi_version"
fi
echo "Updating Maghemite OpenAPI from: $TARGET_COMMIT"
set -x
echo "$OUTPUT" > "$OPENAPI_PATH"
set +x
}

function update_mgd {
TARGET_COMMIT="$1"
DRY_RUN="$2"
DAEMON="$3"
SHA=$(get_sha "$REPO" "$TARGET_COMMIT" "mgd" "image")
OUTPUT=$(printf "CIDL_SHA256=\"%s\"\n" "$SHA")

SHA_LINUX=$(get_sha "$REPO" "$TARGET_COMMIT" "mgd" "linux")
OUTPUT_LINUX=$(printf "MGD_LINUX_SHA256=\"%s\"\n" "$SHA_LINUX")

if [ -n "$DRY_RUN" ]; then
MGD_PATH="/dev/null"
else
MGD_PATH="$SOURCE_DIR/maghemite_mgd_checksums"
fi
echo "Updating Maghemite mgd from: $TARGET_COMMIT"
set -x
printf "$OUTPUT\n$OUTPUT_LINUX" > $MGD_PATH
set +x
}

function main {
TARGET_COMMIT=""
DRY_RUN=""
Expand All @@ -47,6 +86,9 @@ function main {
TARGET_COMMIT=$(get_latest_commit_from_gh "$REPO" "$TARGET_BRANCH")
fi
install_toml2json
update_mgd "$TARGET_COMMIT" "$DRY_RUN"
update_openapi "$TARGET_COMMIT" "$DRY_RUN" ddm
update_openapi "$TARGET_COMMIT" "$DRY_RUN" mg
do_update_packages "$TARGET_COMMIT" "$DRY_RUN" "$REPO" "${PACKAGES[@]}"
}

Expand Down

0 comments on commit 415fcf8

Please sign in to comment.