Skip to content

Commit

Permalink
Reconfigurator: Add support for boundary NTP zones (#6259)
Browse files Browse the repository at this point in the history
This is almost entirely planner work; no executor work was required,
because it already supports "zones with external networking", and
there's nothing special to boundary NTP beyond that from an execution
point of view.

I put this through a fairly thorough test on london; I'll put my notes
from that in comments on the PR momentarily.

This builds on #6050 and should be merged after it.
  • Loading branch information
jgallagher authored Aug 8, 2024
1 parent de73010 commit 5fb9029
Show file tree
Hide file tree
Showing 14 changed files with 518 additions and 149 deletions.
3 changes: 3 additions & 0 deletions common/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ pub const MAX_PORT: u16 = u16::MAX;
/// minimum possible value for a tcp or udp port
pub const MIN_PORT: u16 = u16::MIN;

/// The amount of redundancy for boundary NTP servers.
pub const BOUNDARY_NTP_REDUNDANCY: usize = 2;

/// The amount of redundancy for Nexus services.
///
/// This is used by both RSS (to distribute the initial set of services) and the
Expand Down
29 changes: 24 additions & 5 deletions dev-tools/reconfigurator-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use omicron_common::api::external::Generation;
use omicron_common::api::external::Name;
use omicron_uuid_kinds::CollectionUuid;
use omicron_uuid_kinds::GenericUuid;
use omicron_uuid_kinds::OmicronZoneUuid;
use omicron_uuid_kinds::SledUuid;
use omicron_uuid_kinds::VnicUuid;
use reedline::{Reedline, Signal};
Expand Down Expand Up @@ -435,6 +436,8 @@ enum BlueprintEditCommands {
},
/// add a CockroachDB instance to a particular sled
AddCockroach { sled_id: SledUuid },
/// expunge a particular zone from a particular sled
ExpungeZone { sled_id: SledUuid, zone_id: OmicronZoneUuid },
}

#[derive(Debug, Args)]
Expand Down Expand Up @@ -747,8 +750,8 @@ fn cmd_blueprint_edit(

let label = match args.edit_command {
BlueprintEditCommands::AddNexus { sled_id } => {
let current =
builder.sled_num_zones_of_kind(sled_id, ZoneKind::Nexus);
let current = builder
.sled_num_running_zones_of_kind(sled_id, ZoneKind::Nexus);
let added = builder
.sled_ensure_zone_multiple_nexus(sled_id, current + 1)
.context("failed to add Nexus zone")?;
Expand All @@ -759,8 +762,8 @@ fn cmd_blueprint_edit(
format!("added Nexus zone to sled {}", sled_id)
}
BlueprintEditCommands::AddCockroach { sled_id } => {
let current =
builder.sled_num_zones_of_kind(sled_id, ZoneKind::CockroachDb);
let current = builder
.sled_num_running_zones_of_kind(sled_id, ZoneKind::CockroachDb);
let added = builder
.sled_ensure_zone_multiple_cockroachdb(sled_id, current + 1)
.context("failed to add CockroachDB zone")?;
Expand All @@ -770,9 +773,25 @@ fn cmd_blueprint_edit(
);
format!("added CockroachDB zone to sled {}", sled_id)
}
BlueprintEditCommands::ExpungeZone { sled_id, zone_id } => {
builder
.sled_expunge_zone(sled_id, zone_id)
.context("failed to expunge zone")?;
format!("expunged zone {zone_id} from sled {sled_id}")
}
};

let new_blueprint = builder.build();
let mut new_blueprint = builder.build();

// Normally `builder.build()` would construct the cockroach fingerprint
// based on what we read from CRDB and put into the planning input, but
// since we don't have a CRDB we had to make something up for our planning
// input's CRDB fingerprint. In the absense of a better alternative, we'll
// just copy our parent's CRDB fingerprint and carry it forward.
new_blueprint
.cockroachdb_fingerprint
.clone_from(&blueprint.cockroachdb_fingerprint);

let rv = format!(
"blueprint {} created from blueprint {}: {}",
new_blueprint.id, blueprint_id, label
Expand Down
5 changes: 4 additions & 1 deletion nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ mod test {
use omicron_common::address::get_switch_zone_address;
use omicron_common::address::IpRange;
use omicron_common::address::Ipv6Subnet;
use omicron_common::address::BOUNDARY_NTP_REDUNDANCY;
use omicron_common::address::COCKROACHDB_REDUNDANCY;
use omicron_common::address::NEXUS_REDUNDANCY;
use omicron_common::address::RACK_PREFIX;
Expand Down Expand Up @@ -1313,6 +1314,7 @@ mod test {
cockroachdb_settings: &CockroachDbSettings::empty(),
external_ip_rows: &[],
service_nic_rows: &[],
target_boundary_ntp_zone_count: BOUNDARY_NTP_REDUNDANCY,
target_nexus_zone_count: NEXUS_REDUNDANCY,
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
target_cockroachdb_cluster_version:
Expand Down Expand Up @@ -1340,7 +1342,8 @@ mod test {
.unwrap();
let sled_id =
blueprint.sleds().next().expect("expected at least one sled");
let nalready = builder.sled_num_zones_of_kind(sled_id, ZoneKind::Nexus);
let nalready =
builder.sled_num_running_zones_of_kind(sled_id, ZoneKind::Nexus);
let rv = builder
.sled_ensure_zone_multiple_nexus(sled_id, nalready + 1)
.unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc 72b902d1405681df2dd46efc097da6840ff1234dc9d0d7c0ecf07bed0b0e7d8d # shrinks to input = _TestPlaceOmicronZonesArgs { input: ArbitraryTestInput { existing_sleds: {[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]: ExistingSled { zones: ZonesToPlace { zones: [] }, waiting_for_ntp: false, num_disks: 1 }}, zones_to_place: ZonesToPlace { zones: [Nexus] } } }
cc d725ad7fd51d0409c2f24088730159c1c3043a7675d46b966e45cb86b570a141 # shrinks to input = _TestPlaceOmicronZonesArgs { input: ArbitraryTestInput { existing_sleds: {[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]: ExistingSled { zones: ZonesToPlace { zones: [] }, num_zpools: 2 }}, zones_to_place: ZonesToPlace { zones: [BoundaryNtp, BoundaryNtp] } } }
Loading

0 comments on commit 5fb9029

Please sign in to comment.