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

Reconfigurator: Add support for boundary NTP zones #6259

Merged
merged 8 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, nice!

}

#[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
Loading