Skip to content

Commit 960489f

Browse files
committed
add rack-topology package feature
This adds the rack-topology package feature with possible values of single-sled or multi-sled. single-sled is intended for dev/CI deployments, while multi-sled is intended for dogfood/prod. The value of this determines which nexus config-partial.toml is packaged. Right now the only difference single/multi is the crucible region allocation strategy.
1 parent 4885fb2 commit 960489f

File tree

10 files changed

+114
-13
lines changed

10 files changed

+114
-13
lines changed

.github/buildomat/jobs/package.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ptime -m ./tools/ci_download_softnpu_machinery
4545

4646
# Build the test target
4747
ptime -m cargo run --locked --release --bin omicron-package -- \
48-
-t test target create -i standard -m non-gimlet -s softnpu
48+
-t test target create -i standard -m non-gimlet -s softnpu -r single-sled
4949
ptime -m cargo run --locked --release --bin omicron-package -- \
5050
-t test package
5151

@@ -83,7 +83,7 @@ stamp_packages() {
8383

8484
# Build necessary for the global zone
8585
ptime -m cargo run --locked --release --bin omicron-package -- \
86-
-t host target create -i standard -m gimlet -s asic
86+
-t host target create -i standard -m gimlet -s asic -r multi-sled
8787
ptime -m cargo run --locked --release --bin omicron-package -- \
8888
-t host package
8989
stamp_packages omicron-sled-agent maghemite propolis-server overlay

.github/buildomat/jobs/tuf-repo.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ done
7575
mkdir /work/package
7676
pushd /work/package
7777
tar xf /input/package/work/package.tar.gz out package-manifest.toml target/release/omicron-package
78-
target/release/omicron-package -t default target create -i standard -m gimlet -s asic
78+
target/release/omicron-package -t default target create -i standard -m gimlet -s asic -r multi-sled
7979
ln -s /input/package/work/zones/* out/
8080
rm out/switch-softnpu.tar.gz # not used when target switch=asic
8181
rm out/omicron-gateway-softnpu.tar.gz # not used when target switch=asic

docs/how-to-run.adoc

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,42 @@ Error: Creates a new build target, and sets it as "active"
287287
Usage: omicron-package target create [OPTIONS]
288288
289289
Options:
290-
-i, --image <IMAGE> [default: standard] [possible values: standard, trampoline]
291-
-m, --machine <MACHINE> [possible values: gimlet, gimlet-standalone, non-gimlet]
292-
-s, --switch <SWITCH> [possible values: asic, stub, softnpu]
293-
-h, --help Print help (see more with '--help')
290+
-i, --image <IMAGE>
291+
[default: standard]
292+
293+
Possible values:
294+
- standard: A typical host OS image
295+
- trampoline: A recovery host OS image, intended to bootstrap a Standard image
296+
297+
-m, --machine <MACHINE>
298+
Possible values:
299+
- gimlet: Use sled agent configuration for a Gimlet
300+
- gimlet-standalone: Use sled agent configuration for a Gimlet running in isolation
301+
- non-gimlet: Use sled agent configuration for a device emulating a Gimlet
302+
303+
-s, --switch <SWITCH>
304+
Possible values:
305+
- asic: Use the "real" Dendrite, that attempts to interact with the Tofino
306+
- stub: Use a "stub" Dendrite that does not require any real hardware
307+
- softnpu: Use a "softnpu" Dendrite that uses the SoftNPU asic emulator
308+
309+
-r, --rack-topology <RACK_TOPOLOGY>
310+
Possible values:
311+
- multi-sled: Use configurations suitable for a multi-sled deployment, such as dogfood and production racks
312+
- single-sled: Use configurations suitable for a single-sled deployment, such as CI and dev machines
313+
314+
-h, --help
315+
Print help (see a summary with '-h')
294316
295317
----
296318

297319
To setup a build target for a non-Gimlet machine with simulated (but fully functional) external networking, you would run:
298320

299321
[source,console]
300322
----
301-
$ cargo run --release --bin omicron-package -- -t default target create -i standard -m non-gimlet -s softnpu
323+
$ cargo run --release --bin omicron-package -- -t default target create -i standard -m non-gimlet -s softnpu -r single-sled
302324
Finished release [optimized] target(s) in 0.66s
303-
Running `target/release/omicron-package -t default target create -i standard -m non-gimlet -s softnpu`
325+
Running `target/release/omicron-package -t default target create -i standard -m non-gimlet -s softnpu -r single-sled`
304326
Created new build target 'default' and set it as active
305327
----
306328

package-manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ source.rust.binary_names = ["nexus", "schema-updater"]
9292
source.rust.release = true
9393
source.paths = [
9494
{ from = "/opt/ooce/pgsql-13/lib/amd64", to = "/opt/ooce/pgsql-13/lib/amd64" },
95-
{ from = "smf/nexus", to = "/var/svc/manifest/site/nexus" },
95+
{ from = "smf/nexus/{{rack-topology}}", to = "/var/svc/manifest/site/nexus" },
9696
{ from = "out/console-assets", to = "/var/nexus/static" },
9797
{ from = "schema/crdb", to = "/var/nexus/schema/crdb" },
9898
]

package/src/bin/omicron-package.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,12 @@ async fn do_target(
187187
let target_dir = artifact_dir.join("target");
188188
tokio::fs::create_dir_all(&target_dir).await?;
189189
match subcommand {
190-
TargetCommand::Create { image, machine, switch } => {
190+
TargetCommand::Create { image, machine, switch, rack_topology } => {
191191
let target = KnownTarget::new(
192192
image.clone(),
193193
machine.clone(),
194194
switch.clone(),
195+
rack_topology.clone(),
195196
)?;
196197

197198
let path = get_single_target(&target_dir, name).await?;

package/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ pub enum TargetCommand {
4646

4747
#[clap(short, long, default_value_if("image", "standard", "stub"))]
4848
switch: Option<crate::target::Switch>,
49+
50+
#[clap(
51+
short,
52+
long,
53+
default_value_if("image", "standard", "single-sled")
54+
)]
55+
rack_topology: Option<crate::target::RackTopology>,
4956
},
5057
/// List all existing targets
5158
List,

package/src/target.rs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,35 @@ pub enum Switch {
4848
SoftNpu,
4949
}
5050

51+
/// Topology of the sleds within the rack.
52+
#[derive(Clone, Debug, strum::EnumString, strum::Display, ValueEnum)]
53+
#[strum(serialize_all = "kebab-case")]
54+
#[clap(rename_all = "kebab-case")]
55+
pub enum RackTopology {
56+
/// Use configurations suitable for a multi-sled deployment, such as dogfood
57+
/// and production racks.
58+
MultiSled,
59+
60+
/// Use configurations suitable for a single-sled deployment, such as CI and
61+
/// dev machines.
62+
SingleSled,
63+
}
64+
5165
/// A strongly-typed variant of [Target].
5266
#[derive(Clone, Debug)]
5367
pub struct KnownTarget {
5468
image: Image,
5569
machine: Option<Machine>,
5670
switch: Option<Switch>,
71+
rack_topology: Option<RackTopology>,
5772
}
5873

5974
impl KnownTarget {
6075
pub fn new(
6176
image: Image,
6277
machine: Option<Machine>,
6378
switch: Option<Switch>,
79+
rack_topology: Option<RackTopology>,
6480
) -> Result<Self> {
6581
if matches!(image, Image::Trampoline) {
6682
if machine.is_some() {
@@ -77,7 +93,7 @@ impl KnownTarget {
7793
bail!("'switch=asic' is only valid with 'machine=gimlet'");
7894
}
7995

80-
Ok(Self { image, machine, switch })
96+
Ok(Self { image, machine, switch, rack_topology })
8197
}
8298
}
8399

@@ -87,6 +103,7 @@ impl Default for KnownTarget {
87103
image: Image::Standard,
88104
machine: Some(Machine::NonGimlet),
89105
switch: Some(Switch::Stub),
106+
rack_topology: Some(RackTopology::MultiSled),
90107
}
91108
}
92109
}
@@ -101,6 +118,9 @@ impl From<KnownTarget> for Target {
101118
if let Some(switch) = kt.switch {
102119
map.insert("switch".to_string(), switch.to_string());
103120
}
121+
if let Some(rack_topology) = kt.rack_topology {
122+
map.insert("rack-topology".to_string(), rack_topology.to_string());
123+
}
104124
Target(map)
105125
}
106126
}
@@ -121,6 +141,7 @@ impl std::str::FromStr for KnownTarget {
121141
let mut image = Self::default().image;
122142
let mut machine = None;
123143
let mut switch = None;
144+
let mut rack_topology = None;
124145

125146
for (k, v) in target.0.into_iter() {
126147
match k.as_str() {
@@ -133,6 +154,9 @@ impl std::str::FromStr for KnownTarget {
133154
"switch" => {
134155
switch = Some(v.parse()?);
135156
}
157+
"rack-topology" => {
158+
rack_topology = Some(v.parse()?);
159+
}
136160
_ => {
137161
bail!(
138162
"Unknown target key {k}\nValid keys include: [{}]",
@@ -146,6 +170,6 @@ impl std::str::FromStr for KnownTarget {
146170
}
147171
}
148172
}
149-
KnownTarget::new(image, machine, switch)
173+
KnownTarget::new(image, machine, switch, rack_topology)
150174
}
151175
}

sled-agent/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,5 @@ machine-non-gimlet = []
119119
switch-asic = []
120120
switch-stub = []
121121
switch-softnpu = []
122+
rack-topology-single-sled = []
123+
rack-topology-multi-sled = []
File renamed without changes.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#
2+
# Oxide API: partial configuration file
3+
#
4+
5+
[console]
6+
# Directory for static assets. Absolute path or relative to CWD.
7+
static_dir = "/var/nexus/static"
8+
session_idle_timeout_minutes = 60
9+
session_absolute_timeout_minutes = 480
10+
11+
[authn]
12+
schemes_external = ["session_cookie", "access_token"]
13+
14+
[log]
15+
# Show log messages of this level and more severe
16+
level = "debug"
17+
mode = "file"
18+
path = "/dev/stdout"
19+
if_exists = "append"
20+
21+
# TODO: Uncomment the following lines to enable automatic schema
22+
# migration on boot.
23+
#
24+
# [schema]
25+
# schema_dir = "/var/nexus/schema/crdb"
26+
27+
[background_tasks]
28+
dns_internal.period_secs_config = 60
29+
dns_internal.period_secs_servers = 60
30+
dns_internal.period_secs_propagation = 60
31+
dns_internal.max_concurrent_server_updates = 5
32+
dns_external.period_secs_config = 60
33+
dns_external.period_secs_servers = 60
34+
dns_external.period_secs_propagation = 60
35+
dns_external.max_concurrent_server_updates = 5
36+
# How frequently we check the list of stored TLS certificates. This is
37+
# approximately an upper bound on how soon after updating the list of
38+
# certificates it will take _other_ Nexus instances to notice and stop serving
39+
# them (on a sunny day).
40+
external_endpoints.period_secs = 60
41+
42+
[default_region_allocation_strategy]
43+
# by default, allocate without requirement for distinct sleds.
44+
# seed is omitted so a new seed will be chosen with every allocation.
45+
type = "random"

0 commit comments

Comments
 (0)