Skip to content

Commit 8d7f973

Browse files
authored
[reconfigurator] example system now publishes ntp and crdb information to inventory (#10112)
Prerequisite for #10099.
1 parent fefaeea commit 8d7f973

7 files changed

Lines changed: 53 additions & 9 deletions

File tree

dev-tools/reconfigurator-cli/tests/output/cmds-example-stdout

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2138,7 +2138,9 @@ COCKROACH STATUS
21382138

21392139

21402140
NTP STATUS
2141-
No NTP zones reported timesync information
2141+
Zone 0ab3dbe9-8387-4600-b097-cb71ee91ee83: NTP reports that time is synced
2142+
Zone 18b3781d-571b-4d7c-b65d-18a452e5a64a: NTP reports that time is synced
2143+
Zone ac5bb28e-91d5-42f3-a57a-d84e1c414c17: NTP reports that time is synced
21422144

21432145
INTERNAL DNS STATUS
21442146
Zone 4692cc31-6eb6-437c-9634-9688663d06ae: Internal DNS generation @ 1

dev-tools/reconfigurator-cli/tests/output/cmds-mupdate-update-flow-stdout

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,9 @@ COCKROACH STATUS
588588

589589

590590
NTP STATUS
591-
No NTP zones reported timesync information
591+
Zone 62620961-fc4a-481e-968b-f5acbac0dc63: NTP reports that time is synced
592+
Zone 6444f8a5-6465-4f0b-a549-1993c113569c: NTP reports that time is synced
593+
Zone f10a4fb9-759f-4a65-b25e-5794ad2d07d8: NTP reports that time is synced
592594

593595
INTERNAL DNS STATUS
594596
Zone 427ec88f-f467-42fa-9bbb-66a91a36103c: Internal DNS generation @ 1

dev-tools/reconfigurator-cli/tests/output/cmds-nexus-generation-autobump-stdout

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1152,7 +1152,9 @@ COCKROACH STATUS
11521152

11531153

11541154
NTP STATUS
1155-
No NTP zones reported timesync information
1155+
Zone 62620961-fc4a-481e-968b-f5acbac0dc63: NTP reports that time is synced
1156+
Zone 6444f8a5-6465-4f0b-a549-1993c113569c: NTP reports that time is synced
1157+
Zone f10a4fb9-759f-4a65-b25e-5794ad2d07d8: NTP reports that time is synced
11561158

11571159
INTERNAL DNS STATUS
11581160
Zone 427ec88f-f467-42fa-9bbb-66a91a36103c: Internal DNS generation @ 1

dev-tools/reconfigurator-cli/tests/output/cmds-target-release-stdout

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1136,7 +1136,9 @@ COCKROACH STATUS
11361136

11371137

11381138
NTP STATUS
1139-
No NTP zones reported timesync information
1139+
Zone 62620961-fc4a-481e-968b-f5acbac0dc63: NTP reports that time is synced
1140+
Zone 6444f8a5-6465-4f0b-a549-1993c113569c: NTP reports that time is synced
1141+
Zone f10a4fb9-759f-4a65-b25e-5794ad2d07d8: NTP reports that time is synced
11401142

11411143
INTERNAL DNS STATUS
11421144
Zone 427ec88f-f467-42fa-9bbb-66a91a36103c: Internal DNS generation @ 1

dev-tools/reconfigurator-cli/tests/output/cmds-unsafe-zone-mgs-stdout

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1190,7 +1190,9 @@ COCKROACH STATUS
11901190

11911191

11921192
NTP STATUS
1193-
No NTP zones reported timesync information
1193+
Zone 62620961-fc4a-481e-968b-f5acbac0dc63: NTP reports that time is synced
1194+
Zone 6444f8a5-6465-4f0b-a549-1993c113569c: NTP reports that time is synced
1195+
Zone f10a4fb9-759f-4a65-b25e-5794ad2d07d8: NTP reports that time is synced
11941196

11951197
INTERNAL DNS STATUS
11961198
Zone 427ec88f-f467-42fa-9bbb-66a91a36103c: Internal DNS generation @ 1

nexus/inventory/src/builder.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,15 @@ impl CollectionBuilder {
719719
metrics.get_metric_unsigned(CockroachMetric::RangesUnderreplicated);
720720
status.liveness_live_nodes =
721721
metrics.get_metric_unsigned(CockroachMetric::LivenessLiveNodes);
722+
self.found_cockroach_status(node_id, status);
723+
}
724+
725+
/// Record pre-built status for a CockroachDB node
726+
pub fn found_cockroach_status(
727+
&mut self,
728+
node_id: InternalNodeId,
729+
status: CockroachStatus,
730+
) {
722731
self.cockroach_status.insert(node_id, status);
723732
}
724733

nexus/reconfigurator/planning/src/system.rs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,14 +1121,39 @@ impl SystemDescription {
11211121
).unwrap();
11221122
}
11231123

1124-
// TODO: We may want to include responses from Boundary NTP
1125-
// and CockroachDb zones here too - but neither of those are
1126-
// currently part of the example system, so their synthetic
1127-
// responses to inventory collection aren't necessary yet.
1124+
// Synthesize time-sync responses from NTP zones.
1125+
if zone.zone_type.is_ntp() {
1126+
builder
1127+
.found_ntp_timesync(
1128+
nexus_types::inventory::TimeSync {
1129+
zone_id: zone.id,
1130+
synced: true,
1131+
},
1132+
)
1133+
.unwrap();
1134+
}
11281135
}
11291136
}
11301137
}
11311138

1139+
// Synthesize CockroachDb status: every running CockroachDb zone
1140+
// reports healthy metrics. We assign sequential node IDs and report
1141+
// the total cluster size as liveness_live_nodes.
1142+
let cockroach_zone_count =
1143+
builder.ledgered_zones_of_kind(ZoneKind::CockroachDb).count();
1144+
let live_nodes = cockroach_zone_count as u64;
1145+
for i in 0..cockroach_zone_count {
1146+
builder.found_cockroach_status(
1147+
cockroach_admin_types::node::InternalNodeId::new(
1148+
(i + 1).to_string(),
1149+
),
1150+
nexus_types::inventory::CockroachStatus {
1151+
ranges_underreplicated: Some(0),
1152+
liveness_live_nodes: Some(live_nodes),
1153+
},
1154+
);
1155+
}
1156+
11321157
for membership in &self.clickhouse_keeper_cluster_membership {
11331158
builder
11341159
.found_clickhouse_keeper_cluster_membership(membership.clone());

0 commit comments

Comments
 (0)