-
Notifications
You must be signed in to change notification settings - Fork 39
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
[3/n] [reconfigurator-cli] drop dependency on reconfigurator-execution #6783
[3/n] [reconfigurator-cli] drop dependency on reconfigurator-execution #6783
Conversation
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
Created using spr 1.3.6-beta.1
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.
@sunshowers this is great! Thanks for speeding up crate builds!
use omicron_common::api::external::Name; | ||
|
||
/// The ID of the "default" silo. | ||
pub static DEFAULT_SILO_ID: uuid::Uuid = |
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.
Is it weird that the *-types
crate is gaining constants? I don't object to this, but I wonder if this is a gap in our crate organization or naming somehow.
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 guess I view this as roughly in the same ballpark as, say, the CockroachDB version constants:
omicron/nexus/types/src/deployment/planning_input.rs
Lines 357 to 377 in dda39e3
/// The hardcoded CockroachDB cluster version we want to be on, used in | |
/// [`Policy`]. | |
/// | |
/// /!\ WARNING: If you change this, there is no going back. /!\ | |
pub const POLICY: CockroachDbClusterVersion = | |
CockroachDbClusterVersion::V22_1; | |
/// The CockroachDB cluster version created as part of newly-initialized | |
/// racks. | |
/// | |
/// CockroachDB knows how to create a new cluster with the current cluster | |
/// version, and how to upgrade the cluster version from the previous major | |
/// release, but it does not have any ability to create a new cluster with | |
/// the previous major release's cluster version. | |
/// | |
/// During "tick" releases, newly-initialized racks will be running | |
/// this cluster version, which will be one major version newer than the | |
/// version specified by `CockroachDbClusterVersion::POLICY`. During "tock" | |
/// releases, these versions are the same. | |
pub const NEWLY_INITIALIZED: CockroachDbClusterVersion = | |
CockroachDbClusterVersion::V22_1; |
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.
Thanks. Practically this looks like a great change.
As @jgallagher alluded to: there's something a little off about some of the stuff that's moving into nexus-types
. Some of these are fixed data constants. silo_dns_name()
is super tiny but also semantically pretty significant. The blueprint-to-{internal,external}-DNS-configuration is also semantically pretty load-bearing. The net result seems like a big win! And it's definitely fine as-is. It just remains surprising that the "types" crate would also have implementation for execution behavior and I'm not sure what the takeaway is.
@@ -44,6 +44,7 @@ uuid.workspace = true | |||
api_identity.workspace = true | |||
dns-service-client.workspace = true | |||
gateway-client.workspace = true | |||
internal-dns.workspace = true |
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.
Is it easy to check if this affects the output of cargo xtask ls-apis
? I'm a little worried this is going to make everything that uses nexus-types
appear to be a client of the DNS servers. I think that'll be avoided by one of the existing exceptions.
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.
cargo xtask ls-apis apis
showed no difference before and after.
If we're worried about this dependency, it's probably best to move the types out into a separate internal-dns-types
crate.
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.
Ah I see what's going on -- this is because internal-dns (both the types and the resolver) depends on dns-service-client
for the types. I guess the way to address that is to define the types in another crate, then use replace
-- similar to other places we've broken dependencies from _client
to _types
.
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. I think that as I hoped, this is being covered by this rule:
omicron/dev-tools/ls-apis/api-manifest.toml
Lines 390 to 400 in 1a6343e
[[dependency_filter_rules]] | |
ancestor = "internal-dns" | |
client = "dns-service-client" | |
evaluation = "bogus" | |
note = """ | |
internal-dns depends on dns-service-client to use its types. They're only used | |
when configuring DNS, which is only done in a couple of components. But many | |
other components use internal-dns solely to read DNS. This dependency makes it | |
look like everything uses the DNS server API, but that's not true. We should | |
consider splitting this crate in two to eliminate this false positive. | |
""" |
As long as you see no change in the output, there's no (new) problem here.
Thanks for the reviews!
True -- though there's a fair bit of load-bearing implementation code in nexus-types already, e.g. omicron/nexus/types/src/deployment/planning_input.rs Lines 711 to 719 in dda39e3
|
Created using spr 1.3.6-beta.1
The only functions from reconfigurator-execution currently pulled in are these
helper methods. Move them into nexus-types so that reconfigurator-cli no longer
has to pull in the execution crate and all of its dependencies (particularly
nexus-db-model and nexus-db-queries).
There is one downside, which is that
Overridables
's#[cfg(test)]
methodsare no longer marked that way. However, it does make the overrides available to
places such as the reconfigurator-cli. (It would be interesting to have a
test-related overlay feature in omicron, i.e. a
testing
feature in many ofour crates, but we don't have that yet.)
I had to move some of the silo fixed data into nexus-types as well -- as part
of that I took the opportunity to switch to const methods for a couple of
UUIDs.