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

[3/n] use update engine for reconfigurator execution #6399

4 changes: 4 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions nexus/reconfigurator/execution/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ reqwest.workspace = true
sled-agent-client.workspace = true
slog.workspace = true
slog-error-chain.workspace = true
tokio.workspace = true
tokio-stream.workspace = true
sunshowers marked this conversation as resolved.
Show resolved Hide resolved
update-engine.workspace = true
uuid.workspace = true

# See omicron-rpaths for more about the "pq-sys" dependency. This is needed
Expand Down
22 changes: 12 additions & 10 deletions nexus/reconfigurator/execution/src/cockroachdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub(crate) async fn ensure_settings(
mod test {
use super::*;
use crate::overridables::Overridables;
use crate::RealizeBlueprintOutput;
use nexus_db_queries::authn;
use nexus_db_queries::authz;
use nexus_test_utils_macros::nexus_test;
Expand Down Expand Up @@ -97,16 +98,17 @@ mod test {
.await;
// Execute the initial blueprint.
let overrides = Overridables::for_test(cptestctx);
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute initial blueprint");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute initial blueprint");
// The CockroachDB settings should not have changed.
assert_eq!(
settings,
Expand Down
106 changes: 56 additions & 50 deletions nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ pub fn blueprint_nexus_external_ips(blueprint: &Blueprint) -> Vec<IpAddr> {
mod test {
use super::*;
use crate::overridables::Overridables;
use crate::RealizeBlueprintOutput;
use crate::Sled;
use dns_service_client::DnsDiff;
use internal_dns::config::Host;
Expand Down Expand Up @@ -1245,16 +1246,17 @@ mod test {

// Now, execute the initial blueprint.
let overrides = Overridables::for_test(cptestctx);
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute initial blueprint");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute initial blueprint");

// DNS ought not to have changed.
verify_dns_unchanged(
Expand Down Expand Up @@ -1385,16 +1387,17 @@ mod test {
.await
.expect("failed to set blueprint as target");

crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint");

// Now fetch DNS again. Both should have changed this time.
let dns_latest_internal = datastore
Expand Down Expand Up @@ -1459,16 +1462,17 @@ mod test {
}

// If we execute it again, we should see no more changes.
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint again");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint again");
verify_dns_unchanged(
&opctx,
datastore,
Expand All @@ -1495,16 +1499,17 @@ mod test {

// One more time, make sure that executing the blueprint does not do
// anything.
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint again");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint2,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute second blueprint again");
verify_dns_unchanged(
&opctx,
datastore,
Expand Down Expand Up @@ -1589,16 +1594,17 @@ mod test {
);

// If we execute the blueprint, DNS should not be changed.
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute blueprint");
let _: RealizeBlueprintOutput =
crate::realize_blueprint_with_overrides(
&opctx,
datastore,
resolver,
&blueprint,
Uuid::new_v4(),
&overrides,
)
.await
.expect("failed to execute blueprint");
let dns_latest_internal = datastore
.dns_config_read(&opctx, DnsGroup::Internal)
.await
Expand Down
Loading
Loading