-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[sled-agent] Separate CockroachDB "start" from CockroachDB "init" #2954
Merged
Merged
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
7b54128
[sled-agent] Make service_manager responsible for storage services too
smklein f410325
Merge branch 'main' into storage-manager-cleanup
smklein 0b4b040
CRDB auto-format on boot
smklein ef9517c
better use of 'unique_name' (for storage zones), auto-launch storage …
smklein f1fd1f5
Merge branch 'main' into storage-manager-cleanup
smklein 3a9ad87
Merge branch 'main' into storage-manager-cleanup
smklein 5752a83
[RSS] Explicit set of Bootstrap Agents
smklein 31b52a7
Refuse to enact a sled plan unless it's on the explicit set
smklein f77f235
wip
smklein 2810f93
RSS explicitly calling to initialize CRDB
smklein 5297950
Read the CRDB address from the running zone
smklein c21be48
Send requests to the right address
smklein f11c153
fmt
smklein 4377f1d
Stop deleting chelsio addresses during uninstall (#2953)
smklein ec3b1e4
[RSS] Explicit set of Bootstrap Agents
smklein c812609
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein cbfb8c8
Merge branch 'rss-explicit' into cockroach-init
smklein 9d00c93
Fix tests
smklein 8a08090
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 7155257
Merge branch 'rss-explicit' into cockroach-init
smklein cfb7cbc
make serialization happier
smklein 6346ca7
Merge branch 'rss-explicit' into cockroach-init
smklein c37e57e
Improve parsing for toml, openapi
smklein 541f68d
Remove the comments about the ledger, we do that in #2972
smklein 5d59951
configs -> ledgers
smklein ed20fff
review feedback
smklein 7fe9f06
Merge branch 'rss-explicit' into cockroach-init
smklein ba2ba2c
Merge branch 'main' into storage-manager-cleanup
smklein afc03bd
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein c970c4f
Merge branch 'main' into storage-manager-cleanup
smklein c00e2db
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 599f669
Merge branch 'main' into storage-manager-cleanup
smklein e2b1a5b
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 00633c1
Merge branch 'rss-explicit' into cockroach-init
smklein 2487972
Merge branch 'main' into storage-manager-cleanup
smklein 56a73e3
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 6aef2e7
Merge branch 'main' into storage-manager-cleanup
smklein b84515f
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 016f32d
Merge branch 'rss-explicit' into cockroach-init
smklein 6718f5f
Merge branch 'main' into storage-manager-cleanup
smklein cbc90af
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein 9abc1f2
Merge branch 'main' into storage-manager-cleanup
smklein 18337e4
Merge branch 'storage-manager-cleanup' into rss-explicit
smklein fc1d4a7
Merge branch 'rss-explicit' into cockroach-init
smklein 74e8d66
Merge remote-tracking branch 'origin/main' into cockroach-init
davepacheco e3febbe
typos / rendering issues
davepacheco 6291141
WIP (untested): use DNS to find the other Cockroach nodes
davepacheco c942e53
fix property builder for multi-valued properties
davepacheco d283479
trust-dns docs sent me down the wrong path
davepacheco ba8820c
move the point where we do DNS resolution
davepacheco 05fef51
fix up comments
davepacheco 3c54223
WIP (untested): use Rust program to resolve DNS
davepacheco 4a8fe18
clippy nits
davepacheco 9141db7
dnswait needs to move to its own package
davepacheco 1406d7f
fix path
davepacheco 967f03d
dnswait should report hostnames
davepacheco 3c0e157
should be comma-separated
davepacheco 3546cde
Merge branch 'main' into dap/cockroach-init
davepacheco 8bcdbba
review feedback
davepacheco cab937e
Merge branch 'main' into dap/cockroach-init
davepacheco b99b1a5
fix Cargo.lock
davepacheco 97ab92f
Merge branch 'main' into dap/cockroach-init
davepacheco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "internal-dns-cli" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "MPL-2.0" | ||
|
||
[dependencies] | ||
anyhow.workspace = true | ||
clap.workspace = true | ||
dropshot.workspace = true | ||
internal-dns.workspace = true | ||
omicron-common.workspace = true | ||
slog.workspace = true | ||
tokio.workspace = true | ||
trust-dns-resolver.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! Resolves DNS names within the Oxide control plane | ||
|
||
use anyhow::Context; | ||
use anyhow::Result; | ||
use clap::Parser; | ||
use clap::ValueEnum; | ||
use internal_dns::resolver::ResolveError; | ||
use internal_dns::resolver::Resolver; | ||
use slog::{info, warn}; | ||
use std::net::SocketAddr; | ||
|
||
#[derive(Debug, Parser)] | ||
#[clap(name = "dnswait", about = "Resolves DNS names in the control plane")] | ||
struct Opt { | ||
/// Nameserver(s) to query | ||
/// | ||
/// If unspecified, uses the system configuration (usually the nameservers | ||
/// configured in /etc/resolv.conf). | ||
#[clap(long, action)] | ||
nameserver_addresses: Vec<SocketAddr>, | ||
|
||
/// service name to be resolved (should be the target of a DNS name) | ||
#[arg(value_enum)] | ||
srv_name: ServiceName, | ||
} | ||
|
||
#[derive(Debug, Clone, Copy, ValueEnum)] | ||
#[value(rename_all = "kebab-case")] | ||
enum ServiceName { | ||
Cockroach, | ||
} | ||
|
||
impl From<ServiceName> for internal_dns::ServiceName { | ||
fn from(value: ServiceName) -> Self { | ||
match value { | ||
ServiceName::Cockroach => internal_dns::ServiceName::Cockroach, | ||
} | ||
} | ||
} | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<()> { | ||
let opt = Opt::parse(); | ||
let log = dropshot::ConfigLogging::File { | ||
path: "/dev/stderr".into(), | ||
level: dropshot::ConfigLoggingLevel::Info, | ||
if_exists: dropshot::ConfigLoggingIfExists::Append, | ||
} | ||
.to_logger("dnswait") | ||
.context("creating log")?; | ||
|
||
let resolver = if opt.nameserver_addresses.is_empty() { | ||
info!(&log, "using system configuration"); | ||
let async_resolver = | ||
trust_dns_resolver::AsyncResolver::tokio_from_system_conf() | ||
.context("initializing resolver from system configuration")?; | ||
Resolver::new_with_resolver(log.clone(), async_resolver) | ||
} else { | ||
let addrs = opt.nameserver_addresses; | ||
info!(&log, "using explicit nameservers"; "nameservers" => ?addrs); | ||
Resolver::new_from_addrs(log.clone(), addrs) | ||
.context("creating resolver with explicit nameserver addresses")? | ||
}; | ||
|
||
let result = omicron_common::backoff::retry_notify( | ||
omicron_common::backoff::retry_policy_internal_service(), | ||
|| async { | ||
let dns_name = internal_dns::ServiceName::from(opt.srv_name); | ||
resolver.lookup_srv(dns_name).await.map_err(|error| match error { | ||
ResolveError::Resolve(_) | ||
| ResolveError::NotFound(_) | ||
| ResolveError::NotFoundByString(_) => { | ||
omicron_common::backoff::BackoffError::transient(error) | ||
} | ||
}) | ||
}, | ||
|error, delay| { | ||
warn!( | ||
&log, | ||
"DNS query failed; will try again"; | ||
"error" => format!("{:#}", error), | ||
"delay" => ?delay, | ||
); | ||
}, | ||
) | ||
.await | ||
.context("unexpectedly gave up")?; | ||
|
||
for ip in result { | ||
println!("{}", ip) | ||
} | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to make sure I'm clear - the main reason for using this instead of
dig +short <name>
is the timeout?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I had
dig
at first, but I realized it will only try a handful of times and only wait a few seconds, and you can't tell from its exit status that it's failed. I needed something that's going to retry an arbitrary number of times, waits until it finds some results, too, and if it's going to fail, fails clearly.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR, but maybe it makes sense to move this utility into the omicron-brand zone alongside some of the other network setup that might be more general? Seems a bit like a pain-in-the-butt to manually package it into each zone that could need it