Compare commits

...

3 Commits

Author SHA1 Message Date
43a17811cc fix formatting
Some checks failed
Run Check Script / check (pull_request) Failing after 1m49s
2025-11-14 12:53:43 -05:00
29c82db70d fix: added fields missing for haproxy after most recent update
Some checks failed
Run Check Script / check (pull_request) Failing after 49s
2025-11-12 13:21:55 -05:00
83c1cc82b6 fix(host_network): remove extra fields from bond config to prevent clashes (#186)
All checks were successful
Run Check Script / check (push) Successful in 1m36s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 8m16s
Also alias `port` to support both `port` and `ports` as per the nmstate spec.

Reviewed-on: #186
2025-11-11 14:12:56 +00:00
5 changed files with 40 additions and 6 deletions

View File

@@ -135,8 +135,6 @@ impl OpenShiftNmStateNetworkManager {
description: Some(format!("Member of bond {bond_name}")), description: Some(format!("Member of bond {bond_name}")),
r#type: nmstate::InterfaceType::Ethernet, r#type: nmstate::InterfaceType::Ethernet,
state: "up".to_string(), state: "up".to_string(),
mtu: Some(switch_port.interface.mtu),
mac_address: Some(switch_port.interface.mac_address.to_string()),
ipv4: Some(nmstate::IpStackSpec { ipv4: Some(nmstate::IpStackSpec {
enabled: Some(false), enabled: Some(false),
..Default::default() ..Default::default()
@@ -162,7 +160,7 @@ impl OpenShiftNmStateNetworkManager {
interfaces.push(nmstate::Interface { interfaces.push(nmstate::Interface {
name: bond_name.to_string(), name: bond_name.to_string(),
description: Some(format!("Network bond for host {host}")), description: Some(format!("HARMONY - Network bond for host {host}")),
r#type: nmstate::InterfaceType::Bond, r#type: nmstate::InterfaceType::Bond,
state: "up".to_string(), state: "up".to_string(),
copy_mac_from, copy_mac_from,

View File

@@ -417,6 +417,7 @@ pub struct EthernetSpec {
#[serde(rename_all = "kebab-case")] #[serde(rename_all = "kebab-case")]
pub struct BondSpec { pub struct BondSpec {
pub mode: String, pub mode: String,
#[serde(alias = "port")]
pub ports: Vec<String>, pub ports: Vec<String>,
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub options: Option<BTreeMap<String, Value>>, pub options: Option<BTreeMap<String, Value>>,

View File

@@ -1,6 +1,6 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, PartialOrd, Ord)]
pub struct MacAddress(pub [u8; 6]); pub struct MacAddress(pub [u8; 6]);
impl MacAddress { impl MacAddress {
@@ -19,6 +19,14 @@ impl From<&MacAddress> for String {
} }
} }
impl std::fmt::Debug for MacAddress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("MacAddress")
.field(&String::from(self))
.finish()
}
}
impl std::fmt::Display for MacAddress { impl std::fmt::Display for MacAddress {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(&String::from(self)) f.write_str(&String::from(self))

View File

@@ -106,11 +106,37 @@ pub struct HAProxy {
pub groups: MaybeString, pub groups: MaybeString,
pub users: MaybeString, pub users: MaybeString,
pub cpus: MaybeString, pub cpus: MaybeString,
pub resolvers: MaybeString, pub resolvers: HAProxyResolvers,
pub mailers: MaybeString, pub mailers: MaybeString,
pub maintenance: Maintenance, pub maintenance: Maintenance,
} }
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
pub struct HAProxyResolvers {
#[yaserde(rename = "resolver")]
pub resolver: Resolver,
}
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
pub struct Resolver {
pub id: String,
pub enabled: i32,
pub name: String,
pub description: MaybeString,
pub nameservers: String,
pub parse_resolv_conf: String,
pub resolve_retries: i32,
pub timeout_resolve: String,
pub timeout_retry: String,
pub accepted_payload_size: MaybeString,
pub hold_valid: MaybeString,
pub hold_obsolete: MaybeString,
pub hold_refused: MaybeString,
pub hold_nx: MaybeString,
pub hold_timeout: MaybeString,
pub hold_other: MaybeString,
}
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)] #[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
pub struct Maintenance { pub struct Maintenance {
#[yaserde(rename = "cronjobs")] #[yaserde(rename = "cronjobs")]

View File

@@ -216,7 +216,7 @@ pub struct System {
pub maximumfrags: Option<MaybeString>, pub maximumfrags: Option<MaybeString>,
pub aliasesresolveinterval: Option<MaybeString>, pub aliasesresolveinterval: Option<MaybeString>,
pub maximumtableentries: Option<MaybeString>, pub maximumtableentries: Option<MaybeString>,
pub language: String, pub language: Option<String>,
pub dnsserver: Option<MaybeString>, pub dnsserver: Option<MaybeString>,
pub dns1gw: Option<String>, pub dns1gw: Option<String>,
pub dns2gw: Option<String>, pub dns2gw: Option<String>,
@@ -1291,6 +1291,7 @@ pub struct WireguardServerItem {
pub gateway: MaybeString, pub gateway: MaybeString,
pub carp_depend_on: MaybeString, pub carp_depend_on: MaybeString,
pub peers: String, pub peers: String,
pub debug: MaybeString,
pub endpoint: MaybeString, pub endpoint: MaybeString,
pub peer_dns: MaybeString, pub peer_dns: MaybeString,
} }