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 cockroachdb zones as needed #5797

Merged
merged 14 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
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
Next Next commit
add cockroachdb target count to reconfigurator Policy
  • Loading branch information
jgallagher committed May 22, 2024
commit 82dba118ddaf4b41ce63831763ffdb7618ae80b8
6 changes: 6 additions & 0 deletions common/src/address.rs
Original file line number Diff line number Diff line change
@@ -30,6 +30,12 @@ pub const MIN_PORT: u16 = u16::MIN;
/// Reconfigurator (to know whether to add new Nexus zones)
pub const NEXUS_REDUNDANCY: usize = 3;

/// The amount of redundancy for CockroachDb services.
///
/// This is used by both RSS (to distribute the initial set of services) and the
/// Reconfigurator (to know whether to add new crdb zones)
pub const COCKROACHDB_REDUNDANCY: usize = 5;

/// The amount of redundancy for internal DNS servers.
///
/// Must be less than or equal to MAX_DNS_REDUNDANCY.
2 changes: 2 additions & 0 deletions nexus/reconfigurator/execution/src/dns.rs
Original file line number Diff line number Diff line change
@@ -490,6 +490,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::COCKROACHDB_REDUNDANCY;
use omicron_common::address::NEXUS_REDUNDANCY;
use omicron_common::address::RACK_PREFIX;
use omicron_common::address::SLED_PREFIX;
@@ -1225,6 +1226,7 @@ mod test {
external_ip_rows: &[],
service_nic_rows: &[],
target_nexus_zone_count: NEXUS_REDUNDANCY,
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
log,
}
.build()
5 changes: 5 additions & 0 deletions nexus/reconfigurator/planning/src/system.rs
Original file line number Diff line number Diff line change
@@ -28,6 +28,7 @@ use nexus_types::inventory::SpType;
use omicron_common::address::get_sled_address;
use omicron_common::address::IpRange;
use omicron_common::address::Ipv6Subnet;
use omicron_common::address::COCKROACHDB_REDUNDANCY;
use omicron_common::address::NEXUS_REDUNDANCY;
use omicron_common::address::RACK_PREFIX;
use omicron_common::address::SLED_PREFIX;
@@ -74,6 +75,7 @@ pub struct SystemDescription {
available_non_scrimlet_slots: BTreeSet<u16>,
available_scrimlet_slots: BTreeSet<u16>,
target_nexus_zone_count: usize,
target_cockroachdb_zone_count: usize,
service_ip_pool_ranges: Vec<IpRange>,
internal_dns_version: Generation,
external_dns_version: Generation,
@@ -121,6 +123,7 @@ impl SystemDescription {

// Policy defaults
let target_nexus_zone_count = NEXUS_REDUNDANCY;
let target_cockroachdb_zone_count = COCKROACHDB_REDUNDANCY;
// IPs from TEST-NET-1 (RFC 5737)
let service_ip_pool_ranges = vec![IpRange::try_from((
"192.0.2.2".parse::<Ipv4Addr>().unwrap(),
@@ -135,6 +138,7 @@ impl SystemDescription {
available_non_scrimlet_slots,
available_scrimlet_slots,
target_nexus_zone_count,
target_cockroachdb_zone_count,
service_ip_pool_ranges,
internal_dns_version: Generation::new(),
external_dns_version: Generation::new(),
@@ -301,6 +305,7 @@ impl SystemDescription {
let policy = Policy {
service_ip_pool_ranges: self.service_ip_pool_ranges.clone(),
target_nexus_zone_count: self.target_nexus_zone_count,
target_cockroachdb_zone_count: self.target_cockroachdb_zone_count,
};
let mut builder = PlanningInputBuilder::new(
policy,
4 changes: 4 additions & 0 deletions nexus/reconfigurator/preparation/src/lib.rs
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ use nexus_types::identity::Resource;
use nexus_types::inventory::Collection;
use omicron_common::address::IpRange;
use omicron_common::address::Ipv6Subnet;
use omicron_common::address::COCKROACHDB_REDUNDANCY;
use omicron_common::address::NEXUS_REDUNDANCY;
use omicron_common::address::SLED_PREFIX;
use omicron_common::api::external::Error;
@@ -58,6 +59,7 @@ pub struct PlanningInputFromDb<'a> {
pub external_ip_rows: &'a [nexus_db_model::ExternalIp],
pub service_nic_rows: &'a [nexus_db_model::ServiceNetworkInterface],
pub target_nexus_zone_count: usize,
pub target_cockroachdb_zone_count: usize,
pub internal_dns_version: nexus_db_model::Generation,
pub external_dns_version: nexus_db_model::Generation,
pub log: &'a Logger,
@@ -70,6 +72,7 @@ impl PlanningInputFromDb<'_> {
let policy = Policy {
service_ip_pool_ranges,
target_nexus_zone_count: self.target_nexus_zone_count,
target_cockroachdb_zone_count: self.target_cockroachdb_zone_count,
};
let mut builder = PlanningInputBuilder::new(
policy,
@@ -223,6 +226,7 @@ pub async fn reconfigurator_state_load(
zpool_rows: &zpool_rows,
ip_pool_range_rows: &ip_pool_range_rows,
target_nexus_zone_count: NEXUS_REDUNDANCY,
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
external_ip_rows: &external_ip_rows,
service_nic_rows: &service_nic_rows,
log: &opctx.log,
2 changes: 2 additions & 0 deletions nexus/src/app/deployment.rs
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ use nexus_types::deployment::BlueprintTargetSet;
use nexus_types::deployment::PlanningInput;
use nexus_types::deployment::SledFilter;
use nexus_types::inventory::Collection;
use omicron_common::address::COCKROACHDB_REDUNDANCY;
use omicron_common::address::NEXUS_REDUNDANCY;
use omicron_common::api::external::CreateResult;
use omicron_common::api::external::DataPageParams;
@@ -170,6 +171,7 @@ impl super::Nexus {
external_ip_rows: &external_ip_rows,
service_nic_rows: &service_nic_rows,
target_nexus_zone_count: NEXUS_REDUNDANCY,
target_cockroachdb_zone_count: COCKROACHDB_REDUNDANCY,
log: &opctx.log,
internal_dns_version,
external_dns_version,
4 changes: 4 additions & 0 deletions nexus/types/src/deployment/planning_input.rs
Original file line number Diff line number Diff line change
@@ -447,6 +447,9 @@ pub struct Policy {

/// desired total number of deployed Nexus zones
pub target_nexus_zone_count: usize,

/// desired total number of deployed CockroachDB zones
pub target_cockroachdb_zone_count: usize,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -494,6 +497,7 @@ impl PlanningInputBuilder {
policy: Policy {
service_ip_pool_ranges: Vec::new(),
target_nexus_zone_count: 0,
target_cockroachdb_zone_count: 0,
},
internal_dns_version: Generation::new(),
external_dns_version: Generation::new(),
11 changes: 4 additions & 7 deletions sled-agent/src/rack_setup/plan/service.rs
Original file line number Diff line number Diff line change
@@ -17,9 +17,9 @@ use internal_dns::config::{Host, Zone};
use internal_dns::ServiceName;
use omicron_common::address::{
get_sled_address, get_switch_zone_address, Ipv6Subnet, ReservedRackSubnet,
DENDRITE_PORT, DNS_HTTP_PORT, DNS_PORT, DNS_REDUNDANCY, MAX_DNS_REDUNDANCY,
MGD_PORT, MGS_PORT, NEXUS_REDUNDANCY, NTP_PORT, NUM_SOURCE_NAT_PORTS,
RSS_RESERVED_ADDRESSES, SLED_PREFIX,
COCKROACHDB_REDUNDANCY, DENDRITE_PORT, DNS_HTTP_PORT, DNS_PORT,
DNS_REDUNDANCY, MAX_DNS_REDUNDANCY, MGD_PORT, MGS_PORT, NEXUS_REDUNDANCY,
NTP_PORT, NUM_SOURCE_NAT_PORTS, RSS_RESERVED_ADDRESSES, SLED_PREFIX,
};
use omicron_common::api::external::{Generation, MacAddr, Vni};
use omicron_common::api::internal::shared::{
@@ -48,9 +48,6 @@ use uuid::Uuid;
// The number of boundary NTP servers to create from RSS.
const BOUNDARY_NTP_COUNT: usize = 2;

// The number of CRDB instances to create from RSS.
const CRDB_COUNT: usize = 5;

// TODO(https://github.com/oxidecomputer/omicron/issues/732): Remove
// when Nexus provisions Oximeter.
const OXIMETER_COUNT: usize = 1;
@@ -426,7 +423,7 @@ impl Plan {
}

// Provision CockroachDB zones, continuing to stripe across Sleds.
for _ in 0..CRDB_COUNT {
for _ in 0..COCKROACHDB_REDUNDANCY {
let sled = {
let which_sled =
sled_allocator.next().ok_or(PlanError::NotEnoughSleds)?;