Skip to content

Commit

Permalink
add communication probes
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Dec 22, 2023
1 parent b19c61a commit 0fee0f5
Show file tree
Hide file tree
Showing 69 changed files with 2,591 additions and 142 deletions.
1 change: 1 addition & 0 deletions .github/buildomat/jobs/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ zones=(
out/omicron-gateway-softnpu.tar.gz
out/omicron-gateway-asic.tar.gz
out/overlay.tar.gz
out/probe.tar.gz
)
cp "${zones[@]}" /work/zones/

Expand Down
Empty file modified .github/buildomat/jobs/tuf-repo.sh
100644 → 100755
Empty file.
11 changes: 5 additions & 6 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -594,3 +594,7 @@ branch = "oxide/omicron"
# to it.
[patch.crates-io.omicron-workspace-hack]
path = "workspace-hack"

[patch.crates-io.zone]
git = 'https://github.com/oxidecomputer/zone'
branch = 'state-derive-eq-hash'
2 changes: 2 additions & 0 deletions clients/nexus-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ progenitor::generate_api!(
MacAddr = omicron_common::api::external::MacAddr,
Name = omicron_common::api::external::Name,
NewPasswordHash = omicron_passwords::NewPasswordHash,
NetworkInterface = omicron_common::api::internal::shared::NetworkInterface,
NetworkInterfaceKind = omicron_common::api::internal::shared::NetworkInterfaceKind,
}
);

Expand Down
36 changes: 2 additions & 34 deletions clients/sled-agent-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ progenitor::generate_api!(
IpNetwork = ipnetwork::IpNetwork,
PortFec = omicron_common::api::internal::shared::PortFec,
PortSpeed = omicron_common::api::internal::shared::PortSpeed,
NetworkInterface = omicron_common::api::internal::shared::NetworkInterface,
NetworkInterfaceKind = omicron_common::api::internal::shared::NetworkInterfaceKind,
}
);

Expand Down Expand Up @@ -455,40 +457,6 @@ impl From<omicron_common::api::external::VpcFirewallRuleProtocol>
}
}

impl From<omicron_common::api::internal::shared::NetworkInterfaceKind>
for types::NetworkInterfaceKind
{
fn from(
s: omicron_common::api::internal::shared::NetworkInterfaceKind,
) -> Self {
use omicron_common::api::internal::shared::NetworkInterfaceKind::*;
match s {
Instance { id } => Self::Instance(id),
Service { id } => Self::Service(id),
}
}
}

impl From<omicron_common::api::internal::shared::NetworkInterface>
for types::NetworkInterface
{
fn from(
s: omicron_common::api::internal::shared::NetworkInterface,
) -> Self {
Self {
id: s.id,
kind: s.kind.into(),
name: (&s.name).into(),
ip: s.ip,
mac: s.mac.into(),
subnet: s.subnet.into(),
vni: s.vni.into(),
primary: s.primary,
slot: s.slot,
}
}
}

impl From<omicron_common::api::internal::shared::SourceNatConfig>
for types::SourceNatConfig
{
Expand Down
10 changes: 10 additions & 0 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,7 @@ pub enum ResourceType {
Vmm,
Ipv4NatEntry,
FloatingIp,
ProbeNetworkInterface,
}

// IDENTITY METADATA
Expand Down Expand Up @@ -2621,6 +2622,15 @@ pub struct BgpImportedRouteIpv4 {
pub switch: SwitchLocation,
}

#[derive(
Clone, Debug, Deserialize, JsonSchema, Serialize, PartialEq, ObjectIdentity,
)]
pub struct Probe {
#[serde(flatten)]
pub identity: IdentityMetadata,
pub sled: Uuid,
}

#[cfg(test)]
mod test {
use serde::Deserialize;
Expand Down
2 changes: 2 additions & 0 deletions common/src/api/internal/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ pub enum NetworkInterfaceKind {
Instance { id: Uuid },
/// A vNIC associated with an internal service
Service { id: Uuid },
/// A vNIC associated with a probe
Probe { id: Uuid },
}

/// Information required to construct a virtual network interface
Expand Down
33 changes: 10 additions & 23 deletions dev-tools/omdb/tests/successes.out
Original file line number Diff line number Diff line change
Expand Up @@ -59,43 +59,30 @@ note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=d
note: database schema version matches expected (<redacted database version>)
=============================================
EXECUTING COMMAND: omdb ["db", "services", "list-instances"]
termination: Exited(0)
termination: Exited(1)
---------------------------------------------
stdout:
SERVICE INSTANCE_ID ADDR SLED_SERIAL
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
ExternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
InternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Nexus REDACTED_UUID_REDACTED_UUID_REDACTED [::ffff:127.0.0.1]:REDACTED_PORT sim-b6d65341
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT sim-b6d65341
---------------------------------------------
stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
note: database schema version matches expected (<redacted database version>)
Error: listing instances of kind Probe

Caused by:
Internal Error: unexpected database error: error in argument for $1: invalid input value for enum service_kind: "probe"
=============================================
EXECUTING COMMAND: omdb ["db", "services", "list-by-sled"]
termination: Exited(0)
termination: Exited(1)
---------------------------------------------
stdout:
sled: sim-b6d65341 (id REDACTED_UUID_REDACTED_UUID_REDACTED)

SERVICE INSTANCE_ID ADDR
CruciblePantry REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Dendrite REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
ExternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
InternalDns REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Nexus REDACTED_UUID_REDACTED_UUID_REDACTED [::ffff:127.0.0.1]:REDACTED_PORT
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT
Mgd REDACTED_UUID_REDACTED_UUID_REDACTED [::1]:REDACTED_PORT

---------------------------------------------
stderr:
note: using database URL postgresql://root@[::1]:REDACTED_PORT/omicron?sslmode=disable
note: database schema version matches expected (<redacted database version>)
Error: listing instances of kind Probe

Caused by:
Internal Error: unexpected database error: error in argument for $1: invalid input value for enum service_kind: "probe"
=============================================
EXECUTING COMMAND: omdb ["db", "sleds"]
termination: Exited(0)
Expand Down
4 changes: 4 additions & 0 deletions illumos-utils/src/running_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,10 @@ impl RunningZone {
&self.inner.links
}

pub fn links_mut(&mut self) -> &mut Vec<Link> {
&mut self.inner.links
}

/// Return the running processes associated with all the SMF services this
/// zone is intended to run.
pub fn service_processes(
Expand Down
4 changes: 2 additions & 2 deletions installinator/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ struct InstallOpts {
#[clap(long)]
install_on_gimlet: bool,

//TODO(ry) this probably needs to get plumbed somewhere instead of relying
//TODO this probably needs to get plumbed somewhere instead of relying
//on a default.
/// The first gimlet data link to use.
#[clap(long, default_value = "cxgbe0")]
data_link0: String,

//TODO(ry) this probably needs to get plumbed somewhere instead of relying
//TODO this probably needs to get plumbed somewhere instead of relying
//on a default.
/// The second gimlet data link to use.
#[clap(long, default_value = "cxgbe1")]
Expand Down
2 changes: 1 addition & 1 deletion nexus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ http.workspace = true
hyper.workspace = true
internal-dns.workspace = true
ipnetwork.workspace = true
itertools.workspace = true
macaddr.workspace = true
mime_guess.workspace = true
# Not under "dev-dependencies"; these also need to be implemented for
Expand Down Expand Up @@ -93,7 +94,6 @@ diesel.workspace = true
dns-server.workspace = true
expectorate.workspace = true
hyper-rustls.workspace = true
itertools.workspace = true
gateway-messages.workspace = true
gateway-test-utils.workspace = true
hubtools.workspace = true
Expand Down
48 changes: 46 additions & 2 deletions nexus/db-model/src/external_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use nexus_types::external_api::views;
use omicron_common::address::NUM_SOURCE_NAT_PORTS;
use omicron_common::api::external::Error;
use omicron_common::api::external::IdentityMetadata;
use schemars::JsonSchema;
use serde::Deserialize;
use serde::Serialize;
use std::convert::TryFrom;
Expand All @@ -32,7 +33,7 @@ impl_enum_type!(
#[diesel(postgres_type(name = "ip_kind"))]
pub struct IpKindEnum;

#[derive(Clone, Copy, Debug, AsExpression, FromSqlRow, PartialEq)]
#[derive(Clone, Copy, Debug, AsExpression, FromSqlRow, PartialEq, Serialize, Deserialize, JsonSchema)]
#[diesel(sql_type = IpKindEnum)]
pub enum IpKind;

Expand All @@ -51,7 +52,16 @@ impl_enum_type!(
/// addresses and port ranges, while source NAT IPs are not discoverable in the
/// API at all, and only provide outbound connectivity to instances, not
/// inbound.
#[derive(Debug, Clone, Selectable, Queryable, Insertable)]
#[derive(
Debug,
Clone,
Selectable,
Queryable,
Insertable,
Serialize,
Deserialize,
JsonSchema,
)]
#[diesel(table_name = external_ip)]
pub struct ExternalIp {
pub id: Uuid,
Expand Down Expand Up @@ -120,6 +130,7 @@ pub struct IncompleteExternalIp {
time_created: DateTime<Utc>,
kind: IpKind,
is_service: bool,
is_probe: bool,
parent_id: Option<Uuid>,
pool_id: Uuid,
project_id: Option<Uuid>,
Expand All @@ -142,6 +153,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::SNat,
is_service: false,
is_probe: false,
parent_id: Some(instance_id),
pool_id,
project_id: None,
Expand All @@ -158,6 +170,28 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::Ephemeral,
is_service: false,
is_probe: false,
parent_id: Some(instance_id),
pool_id,
project_id: None,
explicit_ip: None,
explicit_port_range: None,
}
}

pub fn for_ephemeral_probe(
id: Uuid,
instance_id: Uuid,
pool_id: Uuid,
) -> Self {
Self {
id,
name: None,
description: None,
time_created: Utc::now(),
kind: IpKind::Ephemeral,
is_service: false,
is_probe: true,
parent_id: Some(instance_id),
pool_id,
project_id: None,
Expand All @@ -180,6 +214,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::Floating,
is_service: false,
is_probe: false,
parent_id: None,
pool_id,
project_id: Some(project_id),
Expand All @@ -203,6 +238,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::Floating,
is_service: false,
is_probe: false,
parent_id: None,
pool_id,
project_id: Some(project_id),
Expand All @@ -226,6 +262,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::Floating,
is_service: true,
is_probe: false,
parent_id: Some(service_id),
pool_id,
project_id: None,
Expand Down Expand Up @@ -255,6 +292,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::SNat,
is_service: true,
is_probe: false,
parent_id: Some(service_id),
pool_id,
project_id: None,
Expand All @@ -277,6 +315,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::Floating,
is_service: true,
is_probe: false,
parent_id: Some(service_id),
pool_id,
project_id: None,
Expand All @@ -293,6 +332,7 @@ impl IncompleteExternalIp {
time_created: Utc::now(),
kind: IpKind::SNat,
is_service: true,
is_probe: false,
parent_id: Some(service_id),
pool_id,
project_id: None,
Expand Down Expand Up @@ -325,6 +365,10 @@ impl IncompleteExternalIp {
&self.is_service
}

pub fn is_probe(&self) -> &bool {
&self.is_probe
}

pub fn parent_id(&self) -> &Option<Uuid> {
&self.parent_id
}
Expand Down
2 changes: 2 additions & 0 deletions nexus/db-model/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ mod network_interface;
mod oximeter_info;
mod physical_disk;
mod physical_disk_kind;
mod probe;
mod producer_endpoint;
mod project;
mod semver_version;
Expand Down Expand Up @@ -139,6 +140,7 @@ pub use network_interface::*;
pub use oximeter_info::*;
pub use physical_disk::*;
pub use physical_disk_kind::*;
pub use probe::*;
pub use producer_endpoint::*;
pub use project::*;
pub use quota::*;
Expand Down
Loading

0 comments on commit 0fee0f5

Please sign in to comment.