Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjstone committed Dec 17, 2024
1 parent 0f92810 commit 48d923e
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ maplit = "1.0.2"
mockall = "0.13"
newtype_derive = "0.1.6"
mg-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "93cd0d642cf1b58f9f4528275e2a2aa758e9feb3" }
ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "93cd0d642cf1b58f9f4528275e2a2aa758e9feb3" }
#ddm-admin-client = { git = "https://github.com/oxidecomputer/maghemite", rev = "93cd0d642cf1b58f9f4528275e2a2aa758e9feb3" }
ddm-admin-client = { path = "../maghemite/ddm-admin-client" }
multimap = "0.10.0"
nexus-auth = { path = "nexus/auth" }
nexus-client = { path = "clients/nexus-client" }
Expand Down
4 changes: 3 additions & 1 deletion common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ pub struct NetworkInterface {
/// outbound network connections from guests or services.
// Note that `Deserialize` is manually implemented; if you make any changes to
// the fields of this structure, you must make them to that implementation too.
#[derive(Debug, Clone, Copy, Serialize, JsonSchema, PartialEq, Eq, Hash)]
#[derive(
Debug, Clone, Copy, Serialize, JsonSchema, PartialEq, Eq, Hash, Diffus,
)]
pub struct SourceNatConfig {
/// The external address provided to the instance or service.
pub ip: IpAddr,
Expand Down
1 change: 1 addition & 0 deletions nexus-sled-agent-shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ edition = "2021"
workspace = true

[dependencies]
diffus.workspace = true
illumos-utils.workspace = true
omicron-common.workspace = true
omicron-passwords.workspace = true
Expand Down
11 changes: 10 additions & 1 deletion nexus-sled-agent-shared/src/inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use std::net::{IpAddr, Ipv6Addr, SocketAddr, SocketAddrV6};

use diffus::Diffus;
use omicron_common::{
api::{
external::{ByteCount, Generation},
Expand Down Expand Up @@ -173,7 +174,15 @@ impl OmicronZoneConfig {

/// Describes a persistent ZFS dataset associated with an Omicron zone
#[derive(
Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq, Eq, Hash,
Clone,
Debug,
Deserialize,
Serialize,
JsonSchema,
PartialEq,
Eq,
Hash,
Diffus,
)]
pub struct OmicronZoneDataset {
pub pool_name: ZpoolName,
Expand Down
15 changes: 14 additions & 1 deletion nexus/types/src/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::inventory::Collection;
pub use crate::inventory::SourceNatConfig;
pub use crate::inventory::ZpoolName;
use blueprint_diff::ClickhouseClusterConfigDiffTablesForSingleBlueprint;
use diffus_derive::Diffus;
use diffus::Diffus;
use nexus_sled_agent_shared::inventory::OmicronZoneConfig;
use nexus_sled_agent_shared::inventory::OmicronZonesConfig;
use nexus_sled_agent_shared::inventory::ZoneKind;
Expand Down Expand Up @@ -190,6 +190,7 @@ pub struct Blueprint {
pub clickhouse_cluster_config: Option<ClickhouseClusterConfig>,

/// when this blueprint was generated (for debugging)
#[diffus_ignore]
pub time_created: chrono::DateTime<chrono::Utc>,
/// identity of the component that generated the blueprint (for debugging)
/// This would generally be the Uuid of a Nexus instance.
Expand Down Expand Up @@ -648,6 +649,12 @@ pub struct BlueprintZoneConfig {
pub zone_type: BlueprintZoneType,
}

impl diffus::Same for BlueprintZoneConfig {
fn same(&self, other: &Self) -> bool {
self == other
}
}

impl BlueprintZoneConfig {
/// Returns the underlay IP address associated with this zone.
///
Expand Down Expand Up @@ -896,6 +903,12 @@ pub struct BlueprintPhysicalDisksConfig {
pub disks: Vec<BlueprintPhysicalDiskConfig>,
}

impl diffus::Same for BlueprintPhysicalDiskConfig {
fn same(&self, other: &Self) -> bool {
self == other
}
}

// Required by RSS
impl Default for BlueprintPhysicalDisksConfig {
fn default() -> Self {
Expand Down
33 changes: 30 additions & 3 deletions nexus/types/src/deployment/network_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use super::tri_map::TriMap;
use super::tri_map::TriMapEntry;
use anyhow::anyhow;
use diffus::Diffus;
use omicron_common::api::external::MacAddr;
use omicron_common::api::internal::shared::SourceNatConfig;
use omicron_uuid_kinds::ExternalIpUuid;
Expand Down Expand Up @@ -199,7 +200,16 @@ pub enum OmicronZoneExternalIpKey {
/// necessary for blueprint planning, and requires that the zone have a single
/// IP.
#[derive(
Debug, Clone, Copy, Hash, PartialEq, Eq, JsonSchema, Serialize, Deserialize,
Debug,
Clone,
Copy,
Hash,
PartialEq,
Eq,
JsonSchema,
Serialize,
Deserialize,
Diffus,
)]
pub struct OmicronZoneExternalFloatingIp {
pub id: ExternalIpUuid,
Expand All @@ -208,7 +218,15 @@ pub struct OmicronZoneExternalFloatingIp {

/// Floating external address with port allocated to an Omicron-managed zone.
#[derive(
Debug, Clone, Copy, PartialEq, Eq, JsonSchema, Serialize, Deserialize,
Debug,
Clone,
Copy,
PartialEq,
Eq,
JsonSchema,
Serialize,
Deserialize,
Diffus,
)]
pub struct OmicronZoneExternalFloatingAddr {
pub id: ExternalIpUuid,
Expand All @@ -227,7 +245,16 @@ impl OmicronZoneExternalFloatingAddr {
/// necessary for blueprint planning, and requires that the zone have a single
/// IP.
#[derive(
Debug, Clone, Copy, Hash, PartialEq, Eq, JsonSchema, Serialize, Deserialize,
Debug,
Clone,
Copy,
Hash,
PartialEq,
Eq,
JsonSchema,
Serialize,
Deserialize,
Diffus,
)]
pub struct OmicronZoneExternalSnatIp {
pub id: ExternalIpUuid,
Expand Down
22 changes: 11 additions & 11 deletions nexus/types/src/deployment/zone_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,15 @@ pub mod blueprint_zone_type {

/// Used in single-node clickhouse setups
#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct Clickhouse {
pub address: SocketAddrV6,
pub dataset: OmicronZoneDataset,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct ClickhouseKeeper {
pub address: SocketAddrV6,
Expand All @@ -370,38 +370,38 @@ pub mod blueprint_zone_type {

/// Used in replicated clickhouse setups
#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct ClickhouseServer {
pub address: SocketAddrV6,
pub dataset: OmicronZoneDataset,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct CockroachDb {
pub address: SocketAddrV6,
pub dataset: OmicronZoneDataset,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct Crucible {
pub address: SocketAddrV6,
pub dataset: OmicronZoneDataset,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct CruciblePantry {
pub address: SocketAddrV6,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct ExternalDns {
pub dataset: OmicronZoneDataset,
Expand All @@ -414,7 +414,7 @@ pub mod blueprint_zone_type {
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct InternalDns {
pub dataset: OmicronZoneDataset,
Expand All @@ -434,14 +434,14 @@ pub mod blueprint_zone_type {
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct InternalNtp {
pub address: SocketAddrV6,
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct Nexus {
/// The address at which the internal nexus server is reachable.
Expand All @@ -457,7 +457,7 @@ pub mod blueprint_zone_type {
}

#[derive(
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize,
Debug, Clone, Eq, PartialEq, JsonSchema, Deserialize, Serialize, Diffus,
)]
pub struct Oximeter {
pub address: SocketAddrV6,
Expand Down

0 comments on commit 48d923e

Please sign in to comment.