Skip to content

Commit 5fb9029

Browse files
authored
Reconfigurator: Add support for boundary NTP zones (#6259)
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.
1 parent de73010 commit 5fb9029

File tree

14 files changed

+518
-149
lines changed

14 files changed

+518
-149
lines changed

common/src/address.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ pub const MAX_PORT: u16 = u16::MAX;
2525
/// minimum possible value for a tcp or udp port
2626
pub const MIN_PORT: u16 = u16::MIN;
2727

28+
/// The amount of redundancy for boundary NTP servers.
29+
pub const BOUNDARY_NTP_REDUNDANCY: usize = 2;
30+
2831
/// The amount of redundancy for Nexus services.
2932
///
3033
/// This is used by both RSS (to distribute the initial set of services) and the

dev-tools/reconfigurator-cli/src/main.rs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use omicron_common::api::external::Generation;
3434
use omicron_common::api::external::Name;
3535
use omicron_uuid_kinds::CollectionUuid;
3636
use omicron_uuid_kinds::GenericUuid;
37+
use omicron_uuid_kinds::OmicronZoneUuid;
3738
use omicron_uuid_kinds::SledUuid;
3839
use omicron_uuid_kinds::VnicUuid;
3940
use reedline::{Reedline, Signal};
@@ -435,6 +436,8 @@ enum BlueprintEditCommands {
435436
},
436437
/// add a CockroachDB instance to a particular sled
437438
AddCockroach { sled_id: SledUuid },
439+
/// expunge a particular zone from a particular sled
440+
ExpungeZone { sled_id: SledUuid, zone_id: OmicronZoneUuid },
438441
}
439442

440443
#[derive(Debug, Args)]
@@ -747,8 +750,8 @@ fn cmd_blueprint_edit(
747750

748751
let label = match args.edit_command {
749752
BlueprintEditCommands::AddNexus { sled_id } => {
750-
let current =
751-
builder.sled_num_zones_of_kind(sled_id, ZoneKind::Nexus);
753+
let current = builder
754+
.sled_num_running_zones_of_kind(sled_id, ZoneKind::Nexus);
752755
let added = builder
753756
.sled_ensure_zone_multiple_nexus(sled_id, current + 1)
754757
.context("failed to add Nexus zone")?;
@@ -759,8 +762,8 @@ fn cmd_blueprint_edit(
759762
format!("added Nexus zone to sled {}", sled_id)
760763
}
761764
BlueprintEditCommands::AddCockroach { sled_id } => {
762-
let current =
763-
builder.sled_num_zones_of_kind(sled_id, ZoneKind::CockroachDb);
765+
let current = builder
766+
.sled_num_running_zones_of_kind(sled_id, ZoneKind::CockroachDb);
764767
let added = builder
765768
.sled_ensure_zone_multiple_cockroachdb(sled_id, current + 1)
766769
.context("failed to add CockroachDB zone")?;
@@ -770,9 +773,25 @@ fn cmd_blueprint_edit(
770773
);
771774
format!("added CockroachDB zone to sled {}", sled_id)
772775
}
776+
BlueprintEditCommands::ExpungeZone { sled_id, zone_id } => {
777+
builder
778+
.sled_expunge_zone(sled_id, zone_id)
779+
.context("failed to expunge zone")?;
780+
format!("expunged zone {zone_id} from sled {sled_id}")
781+
}
773782
};
774783

775-
let new_blueprint = builder.build();
784+
let mut new_blueprint = builder.build();
785+
786+
// Normally `builder.build()` would construct the cockroach fingerprint
787+
// based on what we read from CRDB and put into the planning input, but
788+
// since we don't have a CRDB we had to make something up for our planning
789+
// input's CRDB fingerprint. In the absense of a better alternative, we'll
790+
// just copy our parent's CRDB fingerprint and carry it forward.
791+
new_blueprint
792+
.cockroachdb_fingerprint
793+
.clone_from(&blueprint.cockroachdb_fingerprint);
794+
776795
let rv = format!(
777796
"blueprint {} created from blueprint {}: {}",
778797
new_blueprint.id, blueprint_id, label

nexus/reconfigurator/execution/src/dns.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ mod test {
499499
use omicron_common::address::get_switch_zone_address;
500500
use omicron_common::address::IpRange;
501501
use omicron_common::address::Ipv6Subnet;
502+
use omicron_common::address::BOUNDARY_NTP_REDUNDANCY;
502503
use omicron_common::address::COCKROACHDB_REDUNDANCY;
503504
use omicron_common::address::NEXUS_REDUNDANCY;
504505
use omicron_common::address::RACK_PREFIX;
@@ -1313,6 +1314,7 @@ mod test {
13131314
cockroachdb_settings: &CockroachDbSettings::empty(),
13141315
external_ip_rows: &[],
13151316
service_nic_rows: &[],
1317+
target_boundary_ntp_zone_count: BOUNDARY_NTP_REDUNDANCY,
13161318
target_nexus_zone_count: NEXUS_REDUNDANCY,
13171319
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
13181320
target_cockroachdb_cluster_version:
@@ -1340,7 +1342,8 @@ mod test {
13401342
.unwrap();
13411343
let sled_id =
13421344
blueprint.sleds().next().expect("expected at least one sled");
1343-
let nalready = builder.sled_num_zones_of_kind(sled_id, ZoneKind::Nexus);
1345+
let nalready =
1346+
builder.sled_num_running_zones_of_kind(sled_id, ZoneKind::Nexus);
13441347
let rv = builder
13451348
.sled_ensure_zone_multiple_nexus(sled_id, nalready + 1)
13461349
.unwrap();

nexus/reconfigurator/planning/proptest-regressions/planner/omicron_zone_placement.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
# It is recommended to check this file in to source control so that
66
# everyone who runs the test benefits from these saved cases.
77
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] } } }
8+
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] } } }

0 commit comments

Comments
 (0)