Merge branch 'feat/dnsmasqDhcpStatic' of https://git.nationtech.io/NationTech/harmony into feat/dnsmasqDhcpStatic
Some checks failed
Run Check Script / check (pull_request) Failing after 17s

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-09-04 23:34:27 -04:00
commit ecc461a33f
7 changed files with 27 additions and 8 deletions

View File

@ -8,7 +8,7 @@ use harmony::{
load_balancer::LoadBalancerScore, load_balancer::LoadBalancerScore,
}, },
topology::{ topology::{
BackendServer, DummyInfra, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancerService, BackendServer, DummyInfra, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancerService, SSL,
}, },
}; };
use harmony_macros::ipv4; use harmony_macros::ipv4;
@ -47,6 +47,7 @@ fn build_large_score() -> LoadBalancerScore {
.to_string(), .to_string(),
HttpMethod::GET, HttpMethod::GET,
HttpStatusCode::Success2xx, HttpStatusCode::Success2xx,
SSL::Disabled,
)), )),
}; };
LoadBalancerScore { LoadBalancerScore {

View File

@ -102,8 +102,17 @@ pub enum HttpStatusCode {
ServerError5xx, ServerError5xx,
} }
#[derive(Debug, Clone, PartialEq, Serialize)]
pub enum SSL {
SSL,
Disabled,
Default,
SNI,
}
#[derive(Debug, Clone, PartialEq, Serialize)] #[derive(Debug, Clone, PartialEq, Serialize)]
pub enum HealthCheck { pub enum HealthCheck {
HTTP(String, HttpMethod, HttpStatusCode), HTTP(String, HttpMethod, HttpStatusCode, SSL),
TCP(Option<u16>), TCP(Option<u16>),
} }

View File

@ -1,6 +1,6 @@
use async_trait::async_trait; use async_trait::async_trait;
use log::{debug, info, warn}; use log::{debug, info, warn};
use opnsense_config_xml::{Frontend, HAProxy, HAProxyBackend, HAProxyHealthCheck, HAProxyServer}; use opnsense_config_xml::{Frontend, HAProxy, HAProxyBackend, HAProxyHealthCheck, HAProxyServer, MaybeString};
use uuid::Uuid; use uuid::Uuid;
use crate::{ use crate::{
@ -241,7 +241,13 @@ pub(crate) fn harmony_load_balancer_service_to_haproxy_xml(
// frontend points to backend // frontend points to backend
let healthcheck = if let Some(health_check) = &service.health_check { let healthcheck = if let Some(health_check) = &service.health_check {
match health_check { match health_check {
HealthCheck::HTTP(path, http_method, _http_status_code) => { HealthCheck::HTTP(path, http_method, _http_status_code, ssl) => {
let ssl: MaybeString = match ssl {
crate::topology::SSL::SSL => "ssl".into(),
crate::topology::SSL::SNI => "sslni".into(),
crate::topology::SSL::Disabled => "nossl".into(),
crate::topology::SSL::Default => "".into(),
};
let haproxy_check = HAProxyHealthCheck { let haproxy_check = HAProxyHealthCheck {
name: format!("HTTP_{http_method}_{path}"), name: format!("HTTP_{http_method}_{path}"),
uuid: Uuid::new_v4().to_string(), uuid: Uuid::new_v4().to_string(),
@ -249,6 +255,7 @@ pub(crate) fn harmony_load_balancer_service_to_haproxy_xml(
health_check_type: "http".to_string(), health_check_type: "http".to_string(),
http_uri: path.clone().into(), http_uri: path.clone().into(),
interval: "2s".to_string(), interval: "2s".to_string(),
ssl,
..Default::default() ..Default::default()
}; };

View File

@ -8,7 +8,7 @@ use crate::{
score::Score, score::Score,
topology::{ topology::{
BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancer, BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancer,
LoadBalancerService, Topology, LoadBalancerService, Topology, SSL,
}, },
}; };
@ -44,6 +44,7 @@ impl OKDBootstrapLoadBalancerScore {
"/readyz".to_string(), "/readyz".to_string(),
HttpMethod::GET, HttpMethod::GET,
HttpStatusCode::Success2xx, HttpStatusCode::Success2xx,
SSL::SSL
)), )),
}, },
]; ];

View File

@ -28,7 +28,7 @@ impl<T: Topology + DhcpServer + TftpServer + HttpServer + Router> Score<T> for O
} }
fn name(&self) -> String { fn name(&self) -> String {
"OKDIpxeScore".to_string() "OKDipxeScore".to_string()
} }
} }

View File

@ -8,7 +8,7 @@ use crate::{
score::Score, score::Score,
topology::{ topology::{
BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancer, BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, LoadBalancer,
LoadBalancerService, Topology, LoadBalancerService, Topology, SSL,
}, },
}; };
@ -62,6 +62,7 @@ impl OKDLoadBalancerScore {
"/readyz".to_string(), "/readyz".to_string(),
HttpMethod::GET, HttpMethod::GET,
HttpStatusCode::Success2xx, HttpStatusCode::Success2xx,
SSL::SSL,
)), )),
}, },
]; ];

View File

@ -296,7 +296,7 @@ dhcp-boot=tag:efi,tag:!ipxe,{efi_filename}{tftp_str}
dhcp-boot=tag:ipxe,{ipxe_filename}{tftp_str} dhcp-boot=tag:ipxe,{ipxe_filename}{tftp_str}
# Provide undionly to legacy bios clients # Provide undionly to legacy bios clients
dhcp-boot=tag:bios,{bios_filename}{tftp_str} dhcp-boot=tag:bios,tag:!ipxe,{bios_filename}{tftp_str}
" "
); );
info!("Writing configuration file to {DNS_MASQ_PXE_CONFIG_FILE}"); info!("Writing configuration file to {DNS_MASQ_PXE_CONFIG_FILE}");