Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
118 commits
Select commit Hold shift + click to select a range
b78ff98
[nexus] Split Nexus configuration (package vs runtime)
smklein Jun 8, 2022
cca5795
Merge branch 'main' into nexus-argsplit
smklein Jun 8, 2022
fccc15c
Ensure postgres config was just a rename
smklein Jun 8, 2022
2443215
Merge branch 'main' into nexus-argsplit
smklein Jun 8, 2022
a077bd4
review feedback
smklein Jun 8, 2022
f91cea1
Merge branch 'main' into nexus-argsplit
smklein Jun 8, 2022
d16eda2
DNS client
smklein Jun 8, 2022
8db30b7
Add concurrency
smklein Jun 8, 2022
3a0c6ba
comment
smklein Jun 8, 2022
33b3e02
fmt
smklein Jun 8, 2022
3eb57dc
lockfile
smklein Jun 8, 2022
39aa9ff
Merge branch 'main' into nexus-argsplit
smklein Jun 15, 2022
dd04a67
s/runtime/deployment
smklein Jun 15, 2022
63b6379
Merge branch 'nexus-argsplit' into dns-client
smklein Jun 15, 2022
e1dc941
[nexus][sled-agent] Generate rack ID in RSS, plumb it through Nexus
smklein Jun 15, 2022
a4309ac
need rack_id in the test config too
smklein Jun 15, 2022
02f592d
Merge branch 'main' into nexus-argsplit
smklein Jun 20, 2022
ff2d7b9
[internal-dns] Avoid 'picking ports'
smklein Jun 20, 2022
a261155
Merge branch 'nexus-argsplit' into dns-client
smklein Jun 20, 2022
6cc7864
Merge branch 'fix-internal-dns-api' into dns-client
smklein Jun 20, 2022
2a035a5
Changes from rss-handoff
smklein Jun 20, 2022
e84faaf
Merge branch 'dns-client' into rack-id
smklein Jun 20, 2022
c3a49bb
[nexus] Add a new user for background tasks
smklein Jun 20, 2022
5440cbf
[rss] Set DNS records during RSS initialization
smklein Jun 20, 2022
3e1495f
[oximeter] Rely on dynamically set arguments within Oximeter
smklein Jun 20, 2022
5d330bc
fix import
smklein Jun 20, 2022
130ffa0
okay not THAT dynamic just yet
smklein Jun 20, 2022
7ceb8fa
[nexus] Populate rack during initialization
smklein Jun 21, 2022
5188880
[nexus] Add tests for rack endpoints
smklein Jun 21, 2022
7cbac9f
[nexus] Optionally resolve clickhouse, cockroach from DNS names
smklein Jun 21, 2022
01c7465
[nexus] Add service manager to Nexus
smklein Jun 21, 2022
1e0b8fe
Merge branch 'main' into nexus-argsplit
smklein Jun 21, 2022
da4a2b8
Merge branch 'nexus-argsplit' into fix-internal-dns-api
smklein Jun 21, 2022
d7b10cf
Merge branch 'fix-internal-dns-api' into dns-client
smklein Jun 21, 2022
bb9a3af
Merge branch 'dns-client' into rack-id
smklein Jun 21, 2022
fed4a3d
Merge branch 'rack-id' into background-work-user
smklein Jun 21, 2022
6f75649
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 21, 2022
c7ea709
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 21, 2022
5c00d54
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 21, 2022
77d626f
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 21, 2022
9dd6b27
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 21, 2022
4df23c2
jgallagher feedback
smklein Jun 21, 2022
71f3aac
Merge branch 'fix-internal-dns-api' into dns-client
smklein Jun 21, 2022
5556d5f
Patch tests
smklein Jun 21, 2022
226fd94
Merge branch 'fix-internal-dns-api' into dns-client
smklein Jun 21, 2022
6126e41
merge
smklein Jun 21, 2022
b01bffd
Merge branch 'dns-client' into rack-id
smklein Jun 21, 2022
d09c8d5
Merge branch 'rack-id' into background-work-user
smklein Jun 21, 2022
d764d2a
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 21, 2022
ad0ddce
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 21, 2022
d4cbe41
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 21, 2022
41d5503
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 21, 2022
6427eeb
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 21, 2022
e4f434f
Merge branch 'main' into nexus-argsplit
smklein Jun 21, 2022
62fccb2
Merge branch 'nexus-argsplit' into fix-internal-dns-api
smklein Jun 21, 2022
1905985
Merge branch 'fix-internal-dns-api' into dns-client
smklein Jun 21, 2022
1a0b61b
Merge branch 'dns-client' into rack-id
smklein Jun 21, 2022
f5ee394
Merge branch 'rack-id' into background-work-user
smklein Jun 21, 2022
588fe8f
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 21, 2022
fed243d
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 21, 2022
a6b5240
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 21, 2022
d53c426
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 21, 2022
30ec2f9
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 21, 2022
d6e3c9d
background-work -> service-balancer
smklein Jun 22, 2022
fd8286a
Merge branch 'main' into dns-client
smklein Jun 22, 2022
bed0269
Merge branch 'dns-client' into rack-id
smklein Jun 22, 2022
ef6072d
Merge branch 'rack-id' into background-work-user
smklein Jun 22, 2022
4c53d4a
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 22, 2022
05da5db
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 22, 2022
83eb272
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 22, 2022
84ed8ad
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 22, 2022
8940d4e
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 22, 2022
8150d60
background opctx -> service balancer opctx
smklein Jun 22, 2022
b959c39
Merge branch 'main' into dns-client
smklein Jun 23, 2022
470da8b
review feedback
smklein Jun 24, 2022
a23a036
Merge branch 'dns-client' into rack-id
smklein Jun 24, 2022
56d2e1c
Merge branch 'rack-id' into background-work-user
smklein Jun 24, 2022
155fd10
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 24, 2022
b5916e0
merge
smklein Jun 24, 2022
3bd9f7a
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 24, 2022
b8a3ffc
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 24, 2022
ba72abd
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 24, 2022
542a9fd
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 24, 2022
b5f1e92
merge
smklein Jun 24, 2022
13b9825
Merge branch 'main' into dns-client
smklein Jun 24, 2022
e1a912f
Merge branch 'dns-client' into rack-id
smklein Jun 24, 2022
28d87f5
Merge branch 'rack-id' into background-work-user
smklein Jun 24, 2022
f7c897a
Merge branch 'background-work-user' into rss-set-dns
smklein Jun 24, 2022
bf687b9
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 24, 2022
40a2433
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 24, 2022
5516746
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 24, 2022
0837415
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 24, 2022
364efb3
rack ID to test interfaces
smklein Jun 24, 2022
40d6126
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 24, 2022
3c8dc52
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 24, 2022
19deb80
comments
smklein Jun 24, 2022
f1b6e20
Merge branch 'main' into rss-set-dns
smklein Jun 26, 2022
756114d
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 26, 2022
ba5275f
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 26, 2022
6a789fc
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 26, 2022
394c803
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 26, 2022
debe96d
Merge branch 'main' into rss-set-dns
smklein Jun 26, 2022
b24dd68
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 26, 2022
c526eba
WIP - test skeleton
smklein Jun 27, 2022
a7bd0d5
Merge branch 'main' into rss-set-dns
smklein Jun 27, 2022
ea84b79
Merge branch 'rss-set-dns' into oximeter-resolves-nexus-address
smklein Jun 27, 2022
91656e8
Merge branch 'oximeter-resolves-nexus-address' into rack-populate
smklein Jun 27, 2022
a2bf4d3
Merge branch 'rack-populate' into nexus-resolves-clickhouse
smklein Jun 27, 2022
8369b8b
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jun 27, 2022
f258488
More work towards tests
smklein Jun 28, 2022
c6a50b4
Merge branch 'main' into nexus-resolves-clickhouse
smklein Jul 5, 2022
7882416
Merge branch 'main' into nexus-resolves-clickhouse
smklein Jul 5, 2022
fdb8ee4
Merge branch 'nexus-resolves-clickhouse' into nexus-service-management
smklein Jul 5, 2022
c56a6fd
Fmt, expand on tests
smklein Jul 5, 2022
f11200e
Merge branch 'main' into nexus-service-management
smklein Jul 11, 2022
7e4a1ed
Merge with dendrite
smklein Jul 11, 2022
dbfc993
Merge branch 'main' into nexus-service-management
smklein Jul 27, 2022
65ac8e5
Fix multi-rack test
smklein Jul 28, 2022
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
1 change: 1 addition & 0 deletions Cargo.lock

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

8 changes: 5 additions & 3 deletions common/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ pub const SLED_PREFIX: u8 = 64;
/// The amount of redundancy for DNS servers.
///
/// Must be less than MAX_DNS_REDUNDANCY.
pub const DNS_REDUNDANCY: usize = 1;
pub const DNS_REDUNDANCY: u32 = 1;
/// The maximum amount of redundancy for DNS servers.
///
/// This determines the number of addresses which are
/// reserved for DNS servers.
pub const MAX_DNS_REDUNDANCY: usize = 5;
pub const MAX_DNS_REDUNDANCY: u32 = 5;

pub const DNS_PORT: u16 = 53;
pub const DNS_SERVER_PORT: u16 = 5353;
Expand All @@ -34,10 +34,12 @@ pub const SLED_AGENT_PORT: u16 = 12345;
/// The port propolis-server listens on inside the propolis zone.
pub const PROPOLIS_PORT: u16 = 12400;
pub const COCKROACH_PORT: u16 = 32221;
pub const CRUCIBLE_PORT: u16 = 32345;
pub const CLICKHOUSE_PORT: u16 = 8123;
pub const OXIMETER_PORT: u16 = 12223;
pub const DENDRITE_PORT: u16 = 12224;

pub const NEXUS_EXTERNAL_PORT: u16 = 12220;
pub const NEXUS_INTERNAL_PORT: u16 = 12221;

// Anycast is a mechanism in which a single IP address is shared by multiple
Expand Down Expand Up @@ -180,7 +182,7 @@ mod test {

// Observe the first DNS subnet within this reserved rack subnet.
let dns_subnets = rack_subnet.get_dns_subnets();
assert_eq!(DNS_REDUNDANCY, dns_subnets.len());
assert_eq!(DNS_REDUNDANCY, dns_subnets.len() as u32);

// The DNS address and GZ address should be only differing by one.
assert_eq!(
Expand Down
23 changes: 20 additions & 3 deletions common/src/sql/dbinit.sql
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ CREATE TABLE omicron.public.sled (
last_used_address INET NOT NULL
);

/* Add an index which lets us look up sleds on a rack */
/* Add an index which lets us look up the sleds on a rack */
CREATE INDEX ON omicron.public.sled (
rack_id
) WHERE time_deleted IS NULL;
) WHERE
time_deleted IS NULL;

/*
* Services
Expand Down Expand Up @@ -117,7 +118,13 @@ CREATE TABLE omicron.public.service (

/* Add an index which lets us look up the services on a sled */
CREATE INDEX ON omicron.public.service (
sled_id
sled_id,
kind
);

/* Add an index which lets us look up services of a particular kind on a sled */
CREATE INDEX ON omicron.public.service (
kind
);

/*
Expand All @@ -140,6 +147,11 @@ CREATE TABLE omicron.public.Zpool (
total_size INT NOT NULL
);

/* Create an index which allows looking up all zpools on a sled */
CREATE INDEX on omicron.public.Zpool (
sled_id
) WHERE time_deleted IS NULL;

CREATE TYPE omicron.public.dataset_kind AS ENUM (
'crucible',
'cockroach',
Expand Down Expand Up @@ -170,6 +182,11 @@ CREATE TABLE omicron.public.Dataset (
size_used INT
);

/* Create an index which allows looking up all datasets in a pool */
CREATE INDEX on omicron.public.Dataset (
pool_id
) WHERE time_deleted IS NULL;

/* Create an index on the size usage for Crucible's allocation */
CREATE INDEX on omicron.public.Dataset (
size_used
Expand Down
1 change: 1 addition & 0 deletions nexus/db-model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ anyhow = "1.0"
chrono = { version = "0.4", features = ["serde"] }
diesel = { version = "2.0.0-rc.1", features = ["postgres", "r2d2", "chrono", "serde_json", "network-address", "uuid"] }
hex = "0.4.3"
internal-dns-client = { path = "../../internal-dns-client" }
ipnetwork = "0.20"
macaddr = { version = "1.0.1", features = [ "serde_std" ]}
newtype_derive = "0.1.6"
Expand Down
31 changes: 24 additions & 7 deletions nexus/db-model/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

use super::{DatasetKind, Generation, Region, SqlU16};
use crate::collection::DatastoreCollectionConfig;
use crate::ipv6;
use crate::schema::{dataset, region};
use chrono::{DateTime, Utc};
use db_macros::Asset;
use internal_dns_client::names::{BackendName, ServiceName, AAAA, SRV};
use nexus_types::identity::Asset;
use serde::{Deserialize, Serialize};
use std::net::SocketAddr;
use std::net::{Ipv6Addr, SocketAddrV6};
use uuid::Uuid;

/// Database representation of a Dataset.
Expand All @@ -35,18 +38,18 @@ pub struct Dataset {

pub pool_id: Uuid,

ip: ipnetwork::IpNetwork,
ip: ipv6::Ipv6Addr,
port: SqlU16,

kind: DatasetKind,
pub kind: DatasetKind,
pub size_used: Option<i64>,
}

impl Dataset {
pub fn new(
id: Uuid,
pool_id: Uuid,
addr: SocketAddr,
addr: SocketAddrV6,
kind: DatasetKind,
) -> Self {
let size_used = match kind {
Expand All @@ -65,12 +68,26 @@ impl Dataset {
}
}

pub fn address(&self) -> SocketAddr {
pub fn address(&self) -> SocketAddrV6 {
self.address_with_port(self.port.into())
}

pub fn address_with_port(&self, port: u16) -> SocketAddr {
SocketAddr::new(self.ip.ip(), port)
pub fn address_with_port(&self, port: u16) -> SocketAddrV6 {
SocketAddrV6::new(Ipv6Addr::from(self.ip), port, 0, 0)
}

pub fn aaaa(&self) -> AAAA {
AAAA::Zone(self.id())
}

pub fn srv(&self) -> SRV {
match self.kind {
DatasetKind::Crucible => {
SRV::Backend(BackendName::Crucible, self.id())
}
DatasetKind::Clickhouse => SRV::Service(ServiceName::Clickhouse),
DatasetKind::Cockroach => SRV::Service(ServiceName::Cockroach),
}
}
}

Expand Down
15 changes: 13 additions & 2 deletions nexus/db-model/src/dataset_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

use super::impl_enum_type;
use nexus_types::internal_api;
use omicron_common::address::{CLICKHOUSE_PORT, COCKROACH_PORT, CRUCIBLE_PORT};
use serde::{Deserialize, Serialize};

impl_enum_type!(
#[derive(SqlType, Debug, QueryId)]
#[derive(Clone, SqlType, Debug, QueryId)]
#[diesel(postgres_type(name = "dataset_kind"))]
pub struct DatasetKindEnum;

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

Expand All @@ -21,6 +22,16 @@ impl_enum_type!(
Clickhouse => b"clickhouse"
);

impl DatasetKind {
pub fn port(&self) -> u16 {
match self {
DatasetKind::Crucible => CRUCIBLE_PORT,
DatasetKind::Cockroach => COCKROACH_PORT,
DatasetKind::Clickhouse => CLICKHOUSE_PORT,
}
}
}

impl From<internal_api::params::DatasetKind> for DatasetKind {
fn from(k: internal_api::params::DatasetKind) -> Self {
match k {
Expand Down
12 changes: 11 additions & 1 deletion nexus/db-model/src/ipv6.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ use diesel::sql_types::Inet;
use ipnetwork::IpNetwork;
use ipnetwork::Ipv6Network;
use omicron_common::api::external::Error;
use serde::{Deserialize, Serialize};

#[derive(
Clone, Copy, AsExpression, FromSqlRow, PartialEq, Ord, PartialOrd, Eq,
Clone,
Copy,
AsExpression,
FromSqlRow,
PartialEq,
Ord,
PartialOrd,
Eq,
Deserialize,
Serialize,
)]
#[diesel(sql_type = Inet)]
pub struct Ipv6Addr(std::net::Ipv6Addr);
Expand Down
32 changes: 30 additions & 2 deletions nexus/db-model/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@ use super::ServiceKind;
use crate::ipv6;
use crate::schema::service;
use db_macros::Asset;
use std::net::Ipv6Addr;
use internal_dns_client::names::{ServiceName, AAAA, SRV};
use nexus_types::identity::Asset;
use omicron_common::address::{
DENDRITE_PORT, DNS_SERVER_PORT, NEXUS_INTERNAL_PORT, OXIMETER_PORT,
};
use std::net::{Ipv6Addr, SocketAddrV6};
use uuid::Uuid;

/// Representation of services which may run on Sleds.
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset)]
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset, PartialEq)]
#[diesel(table_name = service)]
pub struct Service {
#[diesel(embed)]
Expand All @@ -35,4 +40,27 @@ impl Service {
kind,
}
}

pub fn aaaa(&self) -> AAAA {
AAAA::Zone(self.id())
}

pub fn srv(&self) -> SRV {
match self.kind {
ServiceKind::InternalDNS => SRV::Service(ServiceName::InternalDNS),
ServiceKind::Nexus => SRV::Service(ServiceName::Nexus),
ServiceKind::Oximeter => SRV::Service(ServiceName::Oximeter),
ServiceKind::Dendrite => SRV::Service(ServiceName::Dendrite),
}
}

pub fn address(&self) -> SocketAddrV6 {
let port = match self.kind {
ServiceKind::InternalDNS => DNS_SERVER_PORT,
ServiceKind::Nexus => NEXUS_INTERNAL_PORT,
ServiceKind::Oximeter => OXIMETER_PORT,
ServiceKind::Dendrite => DENDRITE_PORT,
};
SocketAddrV6::new(Ipv6Addr::from(self.ip), port, 0, 0)
}
}
4 changes: 2 additions & 2 deletions nexus/db-model/src/service_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use nexus_types::internal_api;
use serde::{Deserialize, Serialize};

impl_enum_type!(
#[derive(SqlType, Debug, QueryId)]
#[derive(Clone, SqlType, Debug, QueryId)]
#[diesel(postgres_type(name = "service_kind"))]
pub struct ServiceKindEnum;

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

Expand Down
2 changes: 1 addition & 1 deletion nexus/db-model/src/sled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use std::net::SocketAddrV6;
use uuid::Uuid;

/// Database representation of a Sled.
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset)]
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset, PartialEq)]
#[diesel(table_name = sled)]
pub struct Sled {
#[diesel(embed)]
Expand Down
2 changes: 1 addition & 1 deletion nexus/db-model/src/zpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use uuid::Uuid;
///
/// A zpool represents a ZFS storage pool, allocated on a single
/// physical sled.
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset)]
#[derive(Queryable, Insertable, Debug, Clone, Selectable, Asset, PartialEq)]
#[diesel(table_name = zpool)]
pub struct Zpool {
#[diesel(embed)]
Expand Down
Loading