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

[sled-agent] Store service configuration data in duplicate in M.2s #2972

Merged
merged 31 commits into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7b54128
[sled-agent] Make service_manager responsible for storage services too
smklein Apr 28, 2023
f410325
Merge branch 'main' into storage-manager-cleanup
smklein Apr 28, 2023
0b4b040
CRDB auto-format on boot
smklein Apr 28, 2023
ef9517c
better use of 'unique_name' (for storage zones), auto-launch storage …
smklein Apr 30, 2023
f1fd1f5
Merge branch 'main' into storage-manager-cleanup
smklein Apr 30, 2023
3a9ad87
Merge branch 'main' into storage-manager-cleanup
smklein Apr 30, 2023
4377f1d
Stop deleting chelsio addresses during uninstall (#2953)
smklein Apr 30, 2023
ec3b1e4
[RSS] Explicit set of Bootstrap Agents
smklein Apr 30, 2023
c812609
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein Apr 30, 2023
9d00c93
Fix tests
smklein Apr 30, 2023
8a08090
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein Apr 30, 2023
cfb7cbc
make serialization happier
smklein Apr 30, 2023
2ab628b
Store service ledgers in duplicate in M.2s
smklein May 1, 2023
c37e57e
Improve parsing for toml, openapi
smklein May 1, 2023
4cbde16
Merge branch 'rss-explicit' into service-ledger
smklein May 1, 2023
541f68d
Remove the comments about the ledger, we do that in #2972
smklein May 1, 2023
5d59951
configs -> ledgers
smklein May 1, 2023
ed20fff
review feedback
smklein May 1, 2023
ba2ba2c
Merge branch 'main' into storage-manager-cleanup
smklein May 1, 2023
afc03bd
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein May 1, 2023
fbae358
Merge branch 'rss-explicit' into service-ledger
smklein May 1, 2023
0ae5531
We should allow synthetic disks to be used as M2s
smklein May 1, 2023
c970c4f
Merge branch 'main' into storage-manager-cleanup
smklein May 2, 2023
c00e2db
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein May 2, 2023
599f669
Merge branch 'main' into storage-manager-cleanup
smklein May 2, 2023
e2b1a5b
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein May 2, 2023
96c8fb4
Merge branch 'rss-explicit' into service-ledger
smklein May 2, 2023
2487972
Merge branch 'main' into storage-manager-cleanup
smklein May 2, 2023
56a73e3
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein May 2, 2023
488759e
Merge branch 'rss-explicit' into service-ledger
smklein May 2, 2023
ef6756d
Fix indexing
smklein May 2, 2023
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
12 changes: 6 additions & 6 deletions illumos-utils/src/running_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ impl InstalledZone {
///
/// This results in a zone name which is distinct across different zpools,
/// but stable and predictable across reboots.
pub fn get_zone_name(zone_name: &str, unique_name: Option<&str>) -> String {
let mut zone_name = format!("{}{}", ZONE_PREFIX, zone_name);
pub fn get_zone_name(zone_type: &str, unique_name: Option<&str>) -> String {
let mut zone_name = format!("{}{}", ZONE_PREFIX, zone_type);
if let Some(suffix) = unique_name {
zone_name.push_str(&format!("_{}", suffix));
}
Expand All @@ -618,7 +618,7 @@ impl InstalledZone {
log: &Logger,
underlay_vnic_allocator: &VnicAllocator<Etherstub>,
zone_root_path: &Path,
zone_name: &str,
zone_type: &str,
unique_name: Option<&str>,
datasets: &[zone::Dataset],
filesystems: &[zone::Fs],
Expand All @@ -631,14 +631,14 @@ impl InstalledZone {
let control_vnic =
underlay_vnic_allocator.new_control(None).map_err(|err| {
InstallZoneError::CreateVnic {
zone: zone_name.to_string(),
zone: zone_type.to_string(),
err,
}
})?;

let full_zone_name = Self::get_zone_name(zone_name, unique_name);
let full_zone_name = Self::get_zone_name(zone_type, unique_name);
let zone_image_path =
PathBuf::from(&format!("/opt/oxide/{}.tar.gz", zone_name));
PathBuf::from(&format!("/opt/oxide/{}.tar.gz", zone_type));

let net_device_names: Vec<String> = opte_ports
.iter()
Expand Down
1 change: 1 addition & 0 deletions illumos-utils/src/zpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ impl Zpool {
}

#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum ZpoolKind {
// This zpool is used for external storage (u.2)
External,
Expand Down
52 changes: 52 additions & 0 deletions openapi/bootstrap-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,49 @@
}
},
"schemas": {
"BootstrapAddressDiscovery": {
"oneOf": [
{
"description": "Ignore all bootstrap addresses except our own.",
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"only_ours"
]
}
},
"required": [
"type"
]
},
{
"description": "Ignore all bootstrap addresses except the following.",
"type": "object",
"properties": {
"addrs": {
"type": "array",
"items": {
"type": "string",
"format": "ipv6"
},
"uniqueItems": true
},
"type": {
"type": "string",
"enum": [
"only_these"
]
}
},
"required": [
"addrs",
"type"
]
}
]
},
"Component": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -239,6 +282,14 @@
"description": "Configuration for the \"rack setup service\".\n\nThe Rack Setup Service should be responsible for one-time setup actions, such as CockroachDB placement and initialization. Without operator intervention, however, these actions need a way to be automated in our deployment.",
"type": "object",
"properties": {
"bootstrap_discovery": {
"description": "Describes how bootstrap addresses should be collected during RSS.",
"allOf": [
{
"$ref": "#/components/schemas/BootstrapAddressDiscovery"
}
]
},
"dns_servers": {
"description": "The external DNS server addresses.",
"type": "array",
Expand Down Expand Up @@ -281,6 +332,7 @@
}
},
"required": [
"bootstrap_discovery",
"dns_servers",
"internal_services_ip_pool_ranges",
"ntp_servers",
Expand Down
110 changes: 98 additions & 12 deletions openapi/sled-agent.json
Original file line number Diff line number Diff line change
Expand Up @@ -640,13 +640,6 @@
{
"type": "object",
"properties": {
"all_addresses": {
"description": "The addresses of all nodes within the cluster.",
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string",
"enum": [
Expand All @@ -655,7 +648,6 @@
}
},
"required": [
"all_addresses",
"type"
]
},
Expand Down Expand Up @@ -689,6 +681,21 @@
}
]
},
"DatasetName": {
"type": "object",
"properties": {
"kind": {
"$ref": "#/components/schemas/DatasetKind"
},
"pool_name": {
"$ref": "#/components/schemas/ZpoolName"
}
},
"required": [
"kind",
"pool_name"
]
},
"DendriteAsic": {
"type": "string",
"enum": [
Expand Down Expand Up @@ -1738,7 +1745,7 @@
"pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
},
"ServiceEnsureBody": {
"description": "Used to request that the Sled initialize certain services on initialization.\n\nThis may be used to record that certain sleds are responsible for launching services which may not be associated with a dataset, such as Nexus.",
"description": "Used to request that the Sled initialize multiple services.\n\nThis may be used to record that certain sleds are responsible for launching services which may not be associated with a dataset, such as Nexus.",
"type": "object",
"properties": {
"services": {
Expand Down Expand Up @@ -2036,6 +2043,48 @@
"mode",
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"clickhouse"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"cockroach_db"
]
}
},
"required": [
"type"
]
},
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": [
"crucible"
]
}
},
"required": [
"type"
]
}
]
},
Expand All @@ -2050,6 +2099,15 @@
"format": "ipv6"
}
},
"dataset": {
"nullable": true,
"default": null,
"allOf": [
{
"$ref": "#/components/schemas/DatasetName"
}
]
},
"gz_addresses": {
"default": [],
"type": "array",
Expand Down Expand Up @@ -2080,6 +2138,7 @@
]
},
"ServiceZoneService": {
"description": "Used to request that the Sled initialize a single service.",
"type": "object",
"properties": {
"details": {
Expand Down Expand Up @@ -2481,13 +2540,16 @@
"description": "The type of zone which may be requested from Sled Agent",
"type": "string",
"enum": [
"clickhouse",
"cockroach_db",
"crucible_pantry",
"crucible",
"external_dns",
"internal_dns",
"nexus",
"ntp",
"oximeter",
"switch",
"crucible_pantry",
"ntp"
"switch"
]
},
"Zpool": {
Expand All @@ -2505,6 +2567,30 @@
"disk_type",
"id"
]
},
"ZpoolKind": {
"type": "string",
"enum": [
"external",
"internal"
]
},
"ZpoolName": {
"description": "A wrapper around a zpool name.\n\nThis expects that the format will be: `ox{i,p}_<UUID>` - we parse the prefix when reading the structure, and validate that the UUID can be utilized.",
"type": "object",
"properties": {
"id": {
"type": "string",
"format": "uuid"
},
"kind": {
"$ref": "#/components/schemas/ZpoolKind"
}
},
"required": [
"id",
"kind"
]
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions sled-agent/src/bootstrap/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,7 @@ impl HardwareMonitor {
let hardware = HardwareManager::new(log, sled_mode)
.map_err(|e| Error::Hardware(e))?;

// TODO: The coupling between the storage and service manager is growing
// pretty tight; we should consider merging them together.
let storage_manager =
StorageManager::new(&log, underlay_etherstub.clone()).await;
let storage_manager = StorageManager::new(&log).await;

let service_manager = ServiceManager::new(
log.clone(),
Expand Down
13 changes: 13 additions & 0 deletions sled-agent/src/bootstrap/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,19 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use std::borrow::Cow;
use std::collections::HashSet;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddrV6};
use uuid::Uuid;

#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case", tag = "type")]
pub enum BootstrapAddressDiscovery {
/// Ignore all bootstrap addresses except our own.
OnlyOurs,
/// Ignore all bootstrap addresses except the following.
OnlyThese { addrs: HashSet<Ipv6Addr> },
}

/// Configuration for the "rack setup service".
///
/// The Rack Setup Service should be responsible for one-time setup actions,
Expand All @@ -24,6 +34,9 @@ use uuid::Uuid;
pub struct RackInitializeRequest {
pub rack_subnet: Ipv6Addr,

/// Describes how bootstrap addresses should be collected during RSS.
pub bootstrap_discovery: BootstrapAddressDiscovery,

/// The minimum number of sleds required to unlock the rack secret.
///
/// If this value is less than 2, no rack secret will be created on startup;
Expand Down
1 change: 1 addition & 0 deletions sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ async fn filesystem_put(
let sa = rqctx.context();
let body_args = body.into_inner();
sa.filesystem_ensure(
body_args.id,
body_args.zpool_id,
body_args.dataset_kind,
body_args.address,
Expand Down
Loading