Skip to content

Commit a0ffd3d

Browse files
authored
Introduce sled-agent-scrimlet-reconcilers crate (#10313)
This is groundwork for #10167, and introduces the skeleton of network config reconcilers for use within sled-agent. None of this is wired up yet and all the service-specific reconcilers are placeholders, but it does have the real setup for how these tasks get started and how they report status. The PR is pretty big but hopefully not too bad to review; more than half the code falls into either "tests", "status type definitions", or "placeholder/dummy reconcilers". A tentative suggestion for review order is: 1. The crate-level docs in `lib.rs`; these are written assuming #10167 is complete, not based on the current state of the crate. 2. `handle.rs`, particularly `ScrimletReconcilers` - this is the entry point for sled-agent. It will hold a `ScrimletReconcilers` in its set of long-running tasks. 3. `reconciler_task.rs` - this implements the common control flow for all of the service-specific reconcilers in the crate; handling periodic reactivation, activation when the config changes, transitioning to inert if we stop being a scrimlet because the sidecar goes away at runtime, and transitioning out of inert if it comes back. ~~The only production-affecting change here is that the `ThisSledSwitchZoneUnderlayIpAddr` type moved out of sled-agent and into this crate, so sled-agent depends on this crate just for that type.~~ Edit: As of #10340, `ThisSledSwitchZoneUnderlayIpAddr` has moved to `sled-agent-types`, so now this PR uses it from there and makes no changes to sled-agent proper.
1 parent a9bfb1f commit a0ffd3d

14 files changed

Lines changed: 2510 additions & 33 deletions

File tree

Cargo.lock

Lines changed: 45 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ members = [
147147
"sled-agent/bootstrap-agent-lockstep-api",
148148
"sled-agent/bootstrap-agent-lockstep-types",
149149
"sled-agent/config-reconciler",
150+
"sled-agent/scrimlet-reconcilers",
150151
"sled-agent/health-monitor",
151152
"sled-agent/measurements",
152153
"sled-agent/rack-setup",
@@ -333,6 +334,7 @@ default-members = [
333334
"sled-agent/bootstrap-agent-lockstep-api",
334335
"sled-agent/bootstrap-agent-lockstep-types",
335336
"sled-agent/config-reconciler",
337+
"sled-agent/scrimlet-reconcilers",
336338
"sled-agent/health-monitor",
337339
"sled-agent/measurements",
338340
"sled-agent/rack-setup",
@@ -727,7 +729,7 @@ propolis_api_types = { git = "https://github.com/oxidecomputer/propolis", rev =
727729
propolis-client = { git = "https://github.com/oxidecomputer/propolis", rev = "bc489ddf0f38f75e0c194b86cf6f0de377f68845" }
728730
propolis-mock-server = { git = "https://github.com/oxidecomputer/propolis", rev = "bc489ddf0f38f75e0c194b86cf6f0de377f68845" }
729731
# NOTE: see above!
730-
proptest = "1.7.0"
732+
proptest = "1.11.0"
731733
qorb = "0.4.1"
732734
quote = "1.0"
733735
# Some dependencies still require rand 0.8.x.
@@ -792,6 +794,7 @@ sled-agent-config-reconciler = { path = "sled-agent/config-reconciler" }
792794
sled-agent-health-monitor = { path = "sled-agent/health-monitor" }
793795
sled-agent-measurements = { path = "sled-agent/measurements" }
794796
sled-agent-rack-setup = { path = "sled-agent/rack-setup" }
797+
sled-agent-scrimlet-reconcilers = { path = "sled-agent/scrimlet-reconcilers" }
795798
sled-agent-types = { path = "sled-agent/types" }
796799
sled-agent-types-versions = { path = "sled-agent/types/versions" }
797800
sled-agent-resolvable-files = { path = "sled-agent/resolvable-files" }
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[package]
2+
name = "sled-agent-scrimlet-reconcilers"
3+
version = "0.1.0"
4+
edition.workspace = true
5+
license = "MPL-2.0"
6+
7+
[lints]
8+
workspace = true
9+
10+
[dependencies]
11+
chrono.workspace = true
12+
dpd-client.workspace = true
13+
gateway-client.workspace = true
14+
gateway-types.workspace = true
15+
mg-admin-client.workspace = true
16+
omicron-common.workspace = true
17+
reqwest.workspace = true
18+
sled-agent-types.workspace = true
19+
slog.workspace = true
20+
slog-error-chain.workspace = true
21+
thiserror.workspace = true
22+
tokio.workspace = true
23+
24+
omicron-workspace-hack.workspace = true
25+
26+
[dev-dependencies]
27+
assert_matches.workspace = true
28+
dropshot.workspace = true
29+
gateway-messages.workspace = true
30+
gateway-test-utils.workspace = true
31+
httpmock.workspace = true
32+
omicron-test-utils.workspace = true
33+
serde_json.workspace = true
34+
35+
[features]
36+
testing = []
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// This Source Code Form is subject to the terms of the Mozilla Public
2+
// License, v. 2.0. If a copy of the MPL was not distributed with this
3+
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
5+
//! Reconciler responsible for configuration of `dpd` within a scrimlet's switch
6+
//! zone.
7+
8+
use crate::handle::ScrimletReconcilersMode;
9+
use crate::reconciler_task::Reconciler;
10+
use crate::switch_zone_slot::ThisSledSwitchSlot;
11+
use dpd_client::Client;
12+
use sled_agent_types::system_networking::SystemNetworkingConfig;
13+
use slog::Logger;
14+
use std::time::Duration;
15+
16+
#[derive(Debug, Clone)]
17+
pub struct DpdReconcilerStatus {
18+
pub todo_status: (),
19+
}
20+
21+
impl slog::KV for DpdReconcilerStatus {
22+
fn serialize(
23+
&self,
24+
_record: &slog::Record<'_>,
25+
serializer: &mut dyn slog::Serializer,
26+
) -> slog::Result {
27+
serializer.emit_str("dpd-reconciler".into(), "not yet implemented")
28+
}
29+
}
30+
31+
#[derive(Debug)]
32+
pub(crate) struct DpdReconciler {
33+
_client: Client,
34+
_switch_slot: ThisSledSwitchSlot,
35+
}
36+
37+
impl Reconciler for DpdReconciler {
38+
type Status = DpdReconcilerStatus;
39+
40+
const LOGGER_COMPONENT_NAME: &'static str = "DpdReconciler";
41+
const RE_RECONCILE_INTERVAL: Duration = Duration::from_secs(30);
42+
43+
fn new(
44+
mode: ScrimletReconcilersMode,
45+
switch_slot: ThisSledSwitchSlot,
46+
parent_log: &Logger,
47+
) -> Self {
48+
Self { _client: mode.dpd_client(parent_log), _switch_slot: switch_slot }
49+
}
50+
51+
async fn do_reconciliation(
52+
&mut self,
53+
_system_networking_config: &SystemNetworkingConfig,
54+
_log: &Logger,
55+
) -> Self::Status {
56+
DpdReconcilerStatus { todo_status: () }
57+
}
58+
}

0 commit comments

Comments
 (0)