Merge remote-tracking branch 'origin/doc/pxe_test_setup' into doc/pxe_test_setup
Some checks failed
Run Check Script / check (pull_request) Failing after 34s

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-08-29 01:15:00 -04:00
commit 0876f4e4f0
10 changed files with 81 additions and 57 deletions

63
Cargo.lock generated
View File

@ -1738,8 +1738,11 @@ dependencies = [
"harmony",
"harmony_cli",
"harmony_macros",
"harmony_secret",
"harmony_secret_derive",
"harmony_types",
"log",
"serde",
"tokio",
"url",
]
@ -2180,9 +2183,9 @@ dependencies = [
"env_logger",
"fqdn",
"futures-util",
"harmony-secret-derive",
"harmony_inventory_agent",
"harmony_macros",
"harmony_secret_derive",
"harmony_types",
"helm-wrapper-rs",
"hex",
@ -2222,35 +2225,6 @@ dependencies = [
"uuid",
]
[[package]]
name = "harmony-secret"
version = "0.1.0"
dependencies = [
"async-trait",
"directories",
"harmony-secret-derive",
"http 1.3.1",
"infisical",
"lazy_static",
"log",
"pretty_assertions",
"serde",
"serde_json",
"tempfile",
"thiserror 2.0.14",
"tokio",
]
[[package]]
name = "harmony-secret-derive"
version = "0.1.0"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.105",
]
[[package]]
name = "harmony_cli"
version = "0.1.0"
@ -2318,6 +2292,35 @@ dependencies = [
"syn 2.0.105",
]
[[package]]
name = "harmony_secret"
version = "0.1.0"
dependencies = [
"async-trait",
"directories",
"harmony_secret_derive",
"http 1.3.1",
"infisical",
"lazy_static",
"log",
"pretty_assertions",
"serde",
"serde_json",
"tempfile",
"thiserror 2.0.14",
"tokio",
]
[[package]]
name = "harmony_secret_derive"
version = "0.1.0"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.105",
]
[[package]]
name = "harmony_tui"
version = "0.1.0"

View File

@ -10,6 +10,8 @@ publish = false
harmony = { path = "../../harmony" }
harmony_cli = { path = "../../harmony_cli" }
harmony_types = { path = "../../harmony_types" }
harmony_secret = { path = "../../harmony_secret" }
harmony_secret_derive = { path = "../../harmony_secret_derive" }
cidr = { workspace = true }
tokio = { workspace = true }
harmony_macros = { path = "../../harmony_macros" }
@ -17,3 +19,4 @@ log = { workspace = true }
env_logger = { workspace = true }
url = { workspace = true }
askama = "0.14.0"
serde.workspace = true

View File

@ -22,7 +22,7 @@ async fn main() {
let cluster_pubkey_filename = "cluster_ssh_key.pub";
let harmony_inventory_agent = "harmony_inventory_agent";
// TODO this should be a single IPXEScore instead of having the user do this step by step
// TODO: this should be a single IPXEScore instead of having the user do this step by step
let scores: Vec<Box<dyn Score<HAClusterTopology>>> = vec![
Box::new(DhcpScore {
host_binding: vec![],

View File

@ -8,6 +8,14 @@ use harmony::{
topology::{HAClusterTopology, LogicalHost, UnmanagedRouter},
};
use harmony_macros::{ip, ipv4};
use harmony_secret::{Secret, SecretManager};
use serde::{Deserialize, Serialize};
#[derive(Secret, Serialize, Deserialize, Debug, PartialEq)]
struct OPNSenseFirewallConfig {
username: String,
password: String,
}
pub async fn get_topology() -> HAClusterTopology {
let firewall = harmony::topology::LogicalHost {
@ -15,8 +23,17 @@ pub async fn get_topology() -> HAClusterTopology {
name: String::from("opnsense-1"),
};
let config = SecretManager::get::<OPNSenseFirewallConfig>().await;
let config = config.unwrap();
let opnsense = Arc::new(
harmony::infra::opnsense::OPNSenseFirewall::new(firewall, None, "root", "opnsense").await,
harmony::infra::opnsense::OPNSenseFirewall::new(
firewall,
None,
&config.username,
&config.password,
)
.await,
);
let lan_subnet = ipv4!("192.168.1.0");
let gateway_ipv4 = ipv4!("192.168.1.1");

View File

@ -67,8 +67,8 @@ bollard.workspace = true
tar.workspace = true
base64.workspace = true
once_cell = "1.21.3"
harmony-secret-derive = { path = "../harmony_secret_derive" }
harmony_inventory_agent = { path = "../harmony_inventory_agent" }
harmony_secret_derive = { version = "0.1.0", path = "../harmony_secret_derive" }
[dev-dependencies]
pretty_assertions.workspace = true

View File

@ -47,6 +47,7 @@ impl<T: Topology> Interpret<T> for DiscoverInventoryAgentInterpret {
self.score.discovery_timeout,
on_discover_event,
);
todo!()
}
fn get_name(&self) -> InterpretName {

View File

@ -1,12 +1,12 @@
[package]
name = "harmony-secret"
name = "harmony_secret"
edition = "2024"
version.workspace = true
readme.workspace = true
license.workspace = true
[dependencies]
harmony-secret-derive = { version = "0.1.0", path = "../harmony_secret_derive" }
harmony_secret_derive = { version = "0.1.0", path = "../harmony_secret_derive" }
serde = { version = "1.0.209", features = ["derive", "rc"] }
serde_json = "1.0.127"
thiserror.workspace = true

View File

@ -1,5 +1,5 @@
[package]
name = "harmony-secret-derive"
name = "harmony_secret_derive"
version = "0.1.0"
edition = "2024"

View File

@ -10,10 +10,10 @@ pub fn derive_secret(input: TokenStream) -> TokenStream {
// The key for the secret will be the stringified name of the struct itself.
// e.g., `struct OKDClusterSecret` becomes key `"OKDClusterSecret"`.
let key = struct_ident.to_string();
let key = struct_ident.to_string(); // TODO: Utiliser path complet de la struct
// Find the path to the `harmony_secret` crate.
let secret_crate_path = match crate_name("harmony-secret") {
let secret_crate_path = match crate_name("harmony_secret") {
Ok(FoundCrate::Itself) => quote!(crate),
Ok(FoundCrate::Name(name)) => {
let ident = Ident::new(&name, proc_macro2::Span::call_site());

View File

@ -59,25 +59,25 @@ pub struct Dhcp {
#[yaserde(rename = "dhcp_ranges")]
pub struct DhcpRange {
#[yaserde(attribute = true)]
pub uuid: String,
pub interface: String,
pub set_tag: MaybeString,
pub start_addr: String,
pub end_addr: String,
pub subnet_mask: MaybeString,
pub constructor: MaybeString,
pub mode: MaybeString,
pub prefix_len: MaybeString,
pub lease_time: MaybeString,
pub domain_type: String,
pub domain: MaybeString,
pub nosync: u8,
pub ra_mode: MaybeString,
pub ra_priority: MaybeString,
pub ra_mtu: MaybeString,
pub ra_interval: MaybeString,
pub ra_router_lifetime: MaybeString,
pub description: MaybeString,
pub uuid: Option<String>,
pub interface: Option<String>,
pub set_tag: Option<MaybeString>,
pub start_addr: Option<String>,
pub end_addr: Option<String>,
pub subnet_mask: Option<MaybeString>,
pub constructor: Option<MaybeString>,
pub mode: Option<MaybeString>,
pub prefix_len: Option<MaybeString>,
pub lease_time: Option<MaybeString>,
pub domain_type: Option<String>,
pub domain: Option<MaybeString>,
pub nosync: Option<u8>,
pub ra_mode: Option<MaybeString>,
pub ra_priority: Option<MaybeString>,
pub ra_mtu: Option<MaybeString>,
pub ra_interval: Option<MaybeString>,
pub ra_router_lifetime: Option<MaybeString>,
pub description: Option<MaybeString>,
}
// Represents a single <dhcp_boot> element.