From 8cc6e1febaf6043a3ccc042eeae4af29ba154c42 Mon Sep 17 00:00:00 2001 From: Sean Klein Date: Sun, 24 Apr 2022 21:24:33 -0400 Subject: [PATCH] [internal-dns] Shove service discovery into a zone (#807) Builds on https://github.com/oxidecomputer/omicron/pull/800 , actually launching the internal DNS subsystem as a Zone. Part of https://github.com/oxidecomputer/omicron/issues/718 --- Cargo.lock | 6 ---- docs/how-to-run.adoc | 1 + internal-dns-client/Cargo.toml | 6 ---- internal-dns/Cargo.toml | 2 +- .../src/bin/dnsadm.rs | 0 package-manifest.toml | 9 +++++ smf/internal-dns/config.toml | 17 +++++++++ smf/internal-dns/manifest.xml | 36 +++++++++++++++++++ smf/nexus/config.toml | 11 ++---- smf/oximeter/config.toml | 4 ++- smf/sled-agent/config-rss.toml | 4 +++ smf/sled-agent/config.toml | 4 ++- 12 files changed, 77 insertions(+), 23 deletions(-) rename {internal-dns-client => internal-dns}/src/bin/dnsadm.rs (100%) create mode 100644 smf/internal-dns/config.toml create mode 100644 smf/internal-dns/manifest.xml diff --git a/Cargo.lock b/Cargo.lock index 33f72ff6ed..117bdefd27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1895,18 +1895,12 @@ dependencies = [ name = "internal-dns-client" version = "0.1.0" dependencies = [ - "anyhow", - "clap 3.1.9", "progenitor", "reqwest", "serde", "serde_json", "slog", - "slog-async", - "slog-envlogger", - "slog-term", "structopt", - "tokio", ] [[package]] diff --git a/docs/how-to-run.adoc b/docs/how-to-run.adoc index 071611d7ae..663c3bae52 100644 --- a/docs/how-to-run.adoc +++ b/docs/how-to-run.adoc @@ -128,6 +128,7 @@ unique local addresses in the subnet of the first Sled Agent: `fd00:1122:3344:1: | Crucible Downstairs 1 | `[fd00:1122:3344:1::6]:32345` | Crucible Downstairs 2 | `[fd00:1122:3344:1::7]:32345` | Crucible Downstairs 3 | `[fd00:1122:3344:1::8]:32345` +| Internal DNS | `[fd00:1122:3344:1::9]:5353` |=================================================================================================== Note that Sled Agent runs in the global zone and is the one responsible for bringing up all the other diff --git a/internal-dns-client/Cargo.toml b/internal-dns-client/Cargo.toml index 70af97d5ac..22e28c91bc 100644 --- a/internal-dns-client/Cargo.toml +++ b/internal-dns-client/Cargo.toml @@ -5,15 +5,9 @@ edition = "2021" license = "MPL-2.0" [dependencies] -anyhow = "1.0" -clap = { version = "3.1", features = [ "derive" ] } progenitor = { git = "https://github.com/oxidecomputer/progenitor" } serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" slog = { version = "2.5.0", features = [ "max_level_trace", "release_max_level_debug" ] } -slog-term = "2.7" -slog-async = "2.7" -slog-envlogger = "2.2" structopt = "0.3" -tokio = { version = "1.17", features = [ "full" ] } reqwest = { version = "0.11", features = ["json", "rustls-tls", "stream"] } diff --git a/internal-dns/Cargo.toml b/internal-dns/Cargo.toml index 6696723744..63664b6c3c 100644 --- a/internal-dns/Cargo.toml +++ b/internal-dns/Cargo.toml @@ -7,6 +7,7 @@ license = "MPL-2.0" [dependencies] anyhow = "1.0" clap = { version = "3.1", features = [ "derive" ] } +internal-dns-client = { path = "../internal-dns-client" } dropshot = { git = "https://github.com/oxidecomputer/dropshot", branch = "main", features = [ "usdt-probes" ] } pretty-hex = "0.3.0" schemars = "0.8" @@ -26,7 +27,6 @@ trust-dns-server = "0.21" [dev-dependencies] expectorate = "1.0.5" -internal-dns-client = { path = "../internal-dns-client" } omicron-test-utils = { path = "../test-utils" } openapiv3 = "1.0" openapi-lint = { git = "https://github.com/oxidecomputer/openapi-lint", branch = "main" } diff --git a/internal-dns-client/src/bin/dnsadm.rs b/internal-dns/src/bin/dnsadm.rs similarity index 100% rename from internal-dns-client/src/bin/dnsadm.rs rename to internal-dns/src/bin/dnsadm.rs diff --git a/package-manifest.toml b/package-manifest.toml index f7512e1a32..2861ca4520 100644 --- a/package-manifest.toml +++ b/package-manifest.toml @@ -58,6 +58,15 @@ to = "/opt/oxide/cockroachdb/sql" from = "smf/cockroachdb" to = "/var/svc/manifest/site/cockroachdb" +[package.internal-dns] +rust.binary_names = ["dnsadm", "dns-server"] +rust.release = true +service_name = "internal-dns" +zone = true +[[package.internal-dns.paths]] +from = "smf/internal-dns" +to = "/var/svc/manifest/site/internal-dns" + # Packages not built within Omicron, but which must be imported. # Refer to diff --git a/smf/internal-dns/config.toml b/smf/internal-dns/config.toml new file mode 100644 index 0000000000..8edc8d3372 --- /dev/null +++ b/smf/internal-dns/config.toml @@ -0,0 +1,17 @@ +[dropshot] +bind_address = "[fd00:1122:3344:1::9]:5353" +request_body_max_bytes = 1048576 + +[dns] +bind_address = "[fd00:1122:3344:1::9]:53" + +[log] +# Show log messages of this level and more severe +level = "info" +mode = "file" +path = "/var/oxide/internal-dns.log" +if_exists = "append" + +[data] +nmax_messages = 16 +storage_path = "/var/oxide/dns" diff --git a/smf/internal-dns/manifest.xml b/smf/internal-dns/manifest.xml new file mode 100644 index 0000000000..25b03434c3 --- /dev/null +++ b/smf/internal-dns/manifest.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/smf/nexus/config.toml b/smf/nexus/config.toml index f11c275c31..3377acfbff 100644 --- a/smf/nexus/config.toml +++ b/smf/nexus/config.toml @@ -31,14 +31,9 @@ bind_address = "[fd00:1122:3344:1::3]:12221" [log] # Show log messages of this level and more severe level = "info" - -# Example output to a terminal (with colors) -mode = "stderr-terminal" - -# Example output to a file, appending if it already exists. -#mode = "file" -#path = "logs/server.log" -#if_exists = "append" +mode = "file" +path = "/var/oxide/nexus.log" +if_exists = "append" # Configuration for interacting with the timeseries database [timeseries_db] diff --git a/smf/oximeter/config.toml b/smf/oximeter/config.toml index a4812d01fd..8f66cb0603 100644 --- a/smf/oximeter/config.toml +++ b/smf/oximeter/config.toml @@ -11,7 +11,9 @@ batch_interval = 5 # In seconds [log] level = "debug" -mode = "stderr-terminal" +mode = "file" +path = "/var/oxide/oximeter.log" +if_exists = "append" [dropshot] bind_address = "[fd00:1122:3344:1::4]:12223" diff --git a/smf/sled-agent/config-rss.toml b/smf/sled-agent/config-rss.toml index ad8993c1ae..2efa04c507 100644 --- a/smf/sled-agent/config-rss.toml +++ b/smf/sled-agent/config-rss.toml @@ -54,3 +54,7 @@ name = "oximeter" addresses = [ "[fd00:1122:3344:1::4]:12223", ] + +[[request.service]] +name = "internal-dns" +addresses = [ "[fd00:1122:3344:1::9]:5353" ] diff --git a/smf/sled-agent/config.toml b/smf/sled-agent/config.toml index 6dfe87fe9b..ac4a4283bf 100644 --- a/smf/sled-agent/config.toml +++ b/smf/sled-agent/config.toml @@ -23,4 +23,6 @@ zpools = [ [log] level = "info" -mode = "stderr-terminal" +mode = "file" +path = "/var/oxide/sled-agent.log" +if_exists = "append"