Files
harmony/examples/sttest/src/main.rs
Sylvain Tremblay a906a51ef6 refactor(okd): rename AddOkdNodeScore to OKDAddNodeScore
Aligns with the rest of the OKD score namespace (OKDSetup01InventoryScore,
OKDBootstrap02…, OKDLoadBalancerScore, …). The Add prefix made this one
the odd name out. Renames the companion interpret (AddOkdNodeInterpret →
OKDAddNodeInterpret), the Score::name() debug string, and the
InterpretName::Custom tag for symmetry. AddNodeRole stays as-is (not a
Score, and its prefix still reads fine).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:41:40 -04:00

63 lines
2.1 KiB
Rust

mod topology;
use crate::topology::{get_inventory, get_topology};
use harmony::{
config::secret::SshKeyPair,
data::{FileContent, FilePath},
modules::{
inventory::HarmonyDiscoveryStrategy,
okd::{
add_node::{AddNodeRole, OKDAddNodeScore},
installation::OKDInstallationPipeline,
ipxe::OKDIpxeScore,
},
},
score::Score,
topology::HAClusterTopology,
};
use harmony_macros::cidrv4;
use harmony_secret::SecretManager;
#[tokio::main]
async fn main() {
harmony_cli::cli_logger::init();
let inventory = get_inventory();
let topology = get_topology().await;
let ssh_key = SecretManager::get_or_prompt::<SshKeyPair>().await.unwrap();
// Discovery runs as a CIDR scan across the sttest LAN on the
// harmony_inventory_agent's default port. Shared between the install
// pipeline and the trailing add-node score so they probe the same way.
let discovery_strategy = HarmonyDiscoveryStrategy::SUBNET {
cidr: cidrv4!("192.168.40.0/24"),
port: 25000,
};
let mut scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![Box::new(OKDIpxeScore {
kickstart_filename: "inventory.kickstart".to_string(),
harmony_inventory_agent: "harmony_inventory_agent".to_string(),
cluster_pubkey: FileContent {
path: FilePath::Relative("cluster_ssh_key.pub".to_string()),
content: ssh_key.public,
},
})];
scores.append(&mut OKDInstallationPipeline::get_all_scores(discovery_strategy.clone()).await);
// After the cluster is up, exercise the Day-2 add-node flow by adding a
// fourth control plane (cp3). This only publishes the ignition + byMAC +
// DHCP artifacts — etcd membership, API serving-cert rotation, and CSR
// approval for the new CP are still manual follow-ups per the score's
// success footer.
scores.push(Box::new(OKDAddNodeScore {
role: AddNodeRole::ControlPlane,
discovery_strategy,
}));
harmony_cli::run(inventory, topology, scores, None)
.await
.unwrap();
}