-
Notifications
You must be signed in to change notification settings - Fork 42
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
System Update API #2100
System Update API #2100
Conversation
// pub high: semver::Version, | ||
pub low: String, | ||
pub high: String, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smklein if we want to use semver::Version
here, which sounds sensible, we need to wrap it and impl JsonSchema
on that. Correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so - looks like someone already started work on this here: GREsau/schemars#195
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good timing. I looked but apparently in the wrong place.
5e9eac3
to
468a263
Compare
@@ -479,6 +479,8 @@ pub enum VersionStatus { | |||
pub struct SystemVersion { | |||
pub version_range: VersionRange, | |||
pub status: VersionStatus, | |||
// TODO: time_released? time_last_applied? I got a fever and the only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐮🔔
system_user_list /system/user | ||
system_user_view /system/user/{user_name} | ||
system_version /v1/system/update/version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IF (big IF) we don't have anything else hanging off of /system/update
other than what's here, seems like we could get away without doing my goofy /update/updates
idea if we put system version and component version tree under /system/version
. So:
system_update_list /v1/system/updates
system_update_view /v1/system/updates/{update_id}
system_update_components_list /v1/system/updates/{update_id}/components
system_update_start /v1/system/updates/{update_id}/start
system_update_stop /v1/system/updates/{update_id}/stop
system_version /v1/system/version
system_component_version_list /v1/system/version/components
This has the disadvantage of putting version under a different top-level key, which makes it less obvious how closely tied it is to the /system/updates
endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I much prefer this. The /system/update/updates
pattern is fairly different than the rest of our API where typically resources are plural.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is this: what do we do when want to add another endpoint that should go under /updates
? With /system/update/updates
we just add /system/update/other_thing
. With /system/updates
we can't do /system/updates/other_thing
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot, we already have one (which is at /system/updates
because it preexisted my current work):
omicron/nexus/src/external_api/http_entrypoints.rs
Lines 5032 to 5040 in 75bd905
/// Refresh update data | |
#[endpoint { | |
method = POST, | |
path = "/system/updates/refresh", | |
tags = ["system"], | |
}] | |
async fn updates_refresh( | |
rqctx: Arc<RequestContext<Arc<ServerContext>>>, | |
) -> Result<HttpResponseUpdatedNoContent, HttpError> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't guess dropshot would let you register /system/updates/refresh
before /system/updates/{update_id}
to have it automatically be handled, would it? 😅. There's actually no overlap in this case because refresh
isn't a valid UUID. If that worked, it'd be sort of ideal.
Beyond that, I'm not really sure. I obviously don't think we should stall on this API decision and I'm fine with moving forward with what's here. Hopefully we'll figure out a better way to do this at some point and update accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, Dropshot would have to be modified: oxidecomputer/dropshot#199
And more and more I agree with the comments on that issue arguing it’s a footgun.
@smklein so far it seems like we'll need the following tables. Maybe we can pair tomorrow on throwing something basic in.
System version + status response would be put together by looking at the update in progress table for the status and pulling the low and high versions from the list of components. |
0d12371
to
4f6490a
Compare
4f6490a
to
1ce8ae6
Compare
common/src/sql/dbinit.sql
Outdated
|
||
/* Unique semver version */ | ||
/* TODO: If the version is really supposed to be unique, we could make it the PK? */ | ||
version STRING(40) NOT NULL, |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
422de03
to
d0ef0ce
Compare
d0ef0ce
to
859605c
Compare
…her file (#2102) I noticed two things while working on #2100. 1. `AssetIdentityMetadata` is defined in `views.rs`, but it is used by both DB models and views. To me that makes it not primarily a view, so it should go in a different file. I moved it to `nexus/types/src/identity.rs`, where `Asset` is defined. 2. Instead of the `identity()` method for copying around the identity metadata (which `Resource` has), there is a `impl From<T: Asset> for AssetIdentityMetadata`, which is perfectly fine, but I think it's nicer to have them be the same. As far as I remember, these are accidents of history and not for any particular reason.
44da0a0
to
8b03b9a
Compare
8b03b9a
to
ea4bbde
Compare
# Conflicts: # nexus/src/external_api/http_entrypoints.rs
d628afa
to
0746adf
Compare
3f93e25
to
a1772af
Compare
698fdb7
to
f109cfe
Compare
Closes #2344. Followup to #2100. Rather than manually adding a sortable `version_sort` column alongside the `version` column, make `SemverVersion` itself automatically sortable by serializing it to the DB in sortable form (with zero padding on the numbers). On deserialization, we remove the padding before trying to parse it.
RFD 348 is still in progress, but I find it helpful to do this in parallel.
This is a big PR, but fortunately it is very straightforward: endpoints plus the service functions, models, and tables you'd expect to see backing those endpoints. It's a good time to add "updateable" to your computer's dictionary.
Included here
SystemUpdateDeployment
)/v1/system/update/...
conventionversion_sort
column onsystem_update
andcomponent_update
that lets us hack in sorting by versionversion_sort
relies on zero-paddingNameOrId
without comparable value due to the latter's reuse in many places. Version is unique and immutable, so this should be good enough to start.Conspicuously missing, to be done in followups
nexus
functions for updating updateable component rows (possibly also system updates and component updates — not sure if they're supposed to be modified)Do a find for
TODO:
for an embarrassing number of additional bullets.Open questions