Skip to content

Commit b4ccadd

Browse files
authored
Overhaul packaging, launching services within a omicron1 branded zones (#686)
This PR provides support for launching and managing services as zones. ### Nexus - Exposes types in a way which can interoperate with Sled Agent. ### Sled Agent - Parse a config file, rather than taking arguments over CLI - Add a "Service Manager", responsible for zones that run independently of datasets (e.g., Nexus, Oximeter) #### Networking - Allow specifying static IP addresses for Zone addresses - In doing so: Add some utilities to `sled-agent/src/illumos/zone.rs` to ensure that link-local addresses are available for IPv6 addressing. This lets us provide static IPv6 addresses for services, which we use elsewhere in the PR when setting up zones. #### Storage - Adds a "filesystem_put" endpoint to the Sled Agent, which allows a caller to request the creation of a local filesystem. - Adds a "service_put" endpoint to the Sled Agent, which allows a caller to request the creation of a local service. - Enable installation of `omicron1` branded zones. - Overhaul the process of auto-loading installed zones and managing running zones. #### Bootstrapping - Enable the parsing of a `config-rss.toml` file, which provides requests that would *normally* arrive from the Rack Setup Service. - Process the "rss requests" in the bootstrap agent, where they are injected before starting any local services. ### Packaging Tools - Rely on [omicron-package](https://github.com/oxidecomputer/omicron-package) for package construction. - Adds a new "zone" type package to omicron-package, allowing the creation of `omicron1`-branded `*.tar.gz` files. - Adds a "cockroachdb", "clickhouse" packages to `package-manifest.toml`, with an associated `manifest.xml` file.
1 parent 547b9c3 commit b4ccadd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2851
-1795
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ logs
66
out
77
tools/clickhouse*
88
tools/cockroach*
9-
clickhouse/
10-
cockroachdb/
9+
/clickhouse/
10+
/cockroachdb/
1111
smf/nexus/root.json

Cargo.lock

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.adoc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,14 @@ in a format which lets them be transferred to a Helios machine.
452452
This tool acts on a `package-manifest.toml` file which describes the packages to be
453453
bundled in the build.
454454

455+
Configuration files are used to select IP addresses, and to manage Zpools
456+
utilized by the Sled Agent. These configuration files are located within
457+
`smf/`, and likely need to be modified to use addresses and zpools which match
458+
your hardware. Much of this configuration will be automated in the future
459+
(e.g., IP addresses will be inferred and posted to a DNS system, Zpools will
460+
automatically be detected on discovered disks), but for now it remains
461+
hard-coded.
462+
455463
[source,text]
456464
----
457465
$ cargo build
@@ -481,8 +489,10 @@ initialize other service as part of its setup sequence anyway.
481489
----
482490
# List all services:
483491
$ svcs
492+
# View zones managed by Omicron (prefixed with "oxz_"):
493+
$ zoneadm list -cv
484494
# View logs for a service:
485-
$ tail -f $(svcs -L nexus)
495+
$ pfexec tail -f $(pfexec svcs -z oxz_nexus -L nexus)
486496
----
487497

488498
To uninstall all Omicron services from a machine, the following may be

common/src/api/internal/sled_agent.rs

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,70 @@ pub struct InstanceRuntimeStateRequested {
108108
pub run_state: InstanceStateRequested,
109109
pub migration_params: Option<InstanceRuntimeStateMigrateParams>,
110110
}
111+
112+
/// The type of a dataset, and an auxiliary information necessary
113+
/// to successfully launch a zone managing the associated data.
114+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
115+
#[serde(tag = "type", rename_all = "snake_case")]
116+
pub enum DatasetKind {
117+
CockroachDb {
118+
/// The addresses of all nodes within the cluster.
119+
all_addresses: Vec<SocketAddr>,
120+
},
121+
Crucible,
122+
Clickhouse,
123+
}
124+
125+
impl std::fmt::Display for DatasetKind {
126+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
127+
use DatasetKind::*;
128+
let s = match self {
129+
Crucible => "crucible",
130+
CockroachDb { .. } => "cockroach",
131+
Clickhouse => "clickhouse",
132+
};
133+
write!(f, "{}", s)
134+
}
135+
}
136+
137+
/// Used to request a new partition kind exists within a zpool.
138+
///
139+
/// Many partition types are associated with services that will be
140+
/// instantiated when the partition is detected.
141+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
142+
pub struct DatasetEnsureBody {
143+
// The name (and UUID) of the Zpool which we are inserting into.
144+
pub zpool_uuid: Uuid,
145+
// The type of the filesystem.
146+
pub partition_kind: DatasetKind,
147+
// The address on which the zone will listen for requests.
148+
pub address: SocketAddr,
149+
// NOTE: We could insert a UUID here, if we want that to be set by the
150+
// caller explicitly? Currently, the lack of a UUID implies that
151+
// "at most one partition type" exists within a zpool.
152+
//
153+
// It's unclear if this is actually necessary - making this change
154+
// would also require the RSS to query existing datasets before
155+
// requesting new ones (after all, we generally wouldn't want to
156+
// create two CRDB datasets with different UUIDs on the same zpool).
157+
}
158+
159+
#[derive(
160+
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
161+
)]
162+
pub struct ServiceRequest {
163+
// The name of the service to be created.
164+
pub name: String,
165+
// The addresses on which the service should listen for requests.
166+
pub addresses: Vec<SocketAddr>,
167+
}
168+
169+
/// Used to request that the Sled initialize certain services on initialization.
170+
///
171+
/// This may be used to record that certain sleds are responsible for
172+
/// launching services which may not be associated with a partition, such
173+
/// as Nexus.
174+
#[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)]
175+
pub struct ServiceEnsureBody {
176+
pub services: Vec<ServiceRequest>,
177+
}

common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pub mod api;
2828
pub mod backoff;
2929
pub mod cmd;
3030
pub mod config;
31-
pub mod packaging;
3231

3332
#[macro_export]
3433
macro_rules! generate_logging_api {

common/src/packaging.rs

Lines changed: 0 additions & 29 deletions
This file was deleted.

nexus-client/src/lib.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,19 @@ impl From<types::InstanceState>
6464
}
6565
}
6666

67+
impl From<omicron_common::api::internal::sled_agent::DatasetKind>
68+
for types::DatasetKind
69+
{
70+
fn from(d: omicron_common::api::internal::sled_agent::DatasetKind) -> Self {
71+
use omicron_common::api::internal::sled_agent::DatasetKind::*;
72+
match d {
73+
CockroachDb { .. } => types::DatasetKind::Cockroach,
74+
Crucible { .. } => types::DatasetKind::Crucible,
75+
Clickhouse { .. } => types::DatasetKind::Clickhouse,
76+
}
77+
}
78+
}
79+
6780
impl From<omicron_common::api::internal::nexus::InstanceRuntimeState>
6881
for types::InstanceRuntimeState
6982
{

0 commit comments

Comments
 (0)