Compare commits

...

5 Commits

Author SHA1 Message Date
ac7fd53d5e wip: rook-ceph install score
Some checks failed
Run Check Script / check (pull_request) Failing after 20s
2025-08-25 15:25:10 -04:00
5895f867cf feat: Bump harmony_composer rust version to 1.89
Some checks failed
Run Check Script / check (push) Failing after 24s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 7m52s
2025-08-23 16:27:04 -04:00
d36c574590 Merge pull request 'feat/inventory_agent' (#119) from feat/inventory_agent into master
Some checks failed
Run Check Script / check (push) Failing after 38s
Compile and package harmony_composer / package_harmony_composer (push) Successful in 5m48s
Reviewed-on: #119
2025-08-22 01:55:52 +00:00
72fb05b5cc fix(inventory_agent) : Agent now retreives correct dmidecode fields, fixed uuid generation which is unacceptable, fixed storage drive parsing, much better error handling, much more strict behavior which also leads to more complete output as missing fields will raise errors unless explicitely optional 2025-08-19 17:56:06 -04:00
6685b05cc5 wip(inventory_agent): Refactoring for better error handling in progress 2025-08-19 17:05:23 -04:00
9 changed files with 729 additions and 317 deletions

5
Cargo.lock generated
View File

@@ -105,7 +105,7 @@ dependencies = [
"futures-core",
"futures-util",
"mio 1.0.4",
"socket2",
"socket2 0.5.10",
"tokio",
"tracing",
]
@@ -167,7 +167,7 @@ dependencies = [
"serde_json",
"serde_urlencoded",
"smallvec",
"socket2",
"socket2 0.5.10",
"time",
"tracing",
"url",
@@ -2178,7 +2178,6 @@ dependencies = [
"serde",
"serde_json",
"sysinfo",
"uuid",
]
[[package]]

View File

@@ -1,4 +1,4 @@
FROM docker.io/rust:1.87.0 AS build
FROM docker.io/rust:1.89.0 AS build
WORKDIR /app
@@ -6,7 +6,7 @@ COPY . .
RUN cargo build --release --bin harmony_composer
FROM docker.io/rust:1.87.0
FROM docker.io/rust:1.89.0
WORKDIR /app

View File

@@ -1 +1,4 @@
pub mod ceph_osd_replacement_score;
pub mod ceph_remove_osd_score;
pub mod rook_ceph_helm_chart_score;
pub mod rook_ceph_cluster_helm_chart_score;
pub mod rook_ceph_install_score;

View File

@@ -0,0 +1,44 @@
use std::str::FromStr;
use non_blank_string_rs::NonBlankString;
use crate::modules::helm::chart::HelmChartScore;
pub fn rook_ceph_cluster_helm_chart(ns: &str) -> HelmChartScore {
let values = r#"
monitoring:
enabled: true
createPrometheusRules: true
cephClusterSpec:
placement:
all:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: storage-node
operator: In
values:
- "true"
dashboard:
ssl: false
prometheusEndpoint: http://prometheus-operated:9090
prometheusEndpointSSLVerify: false
toolbox:
enabled: true
"#
.to_string();
HelmChartScore {
namespace: Some(NonBlankString::from_str(ns).unwrap()),
release_name: NonBlankString::from_str("rook-ceph").unwrap(),
chart_name: NonBlankString::from_str("https://charts.rook.io/release/rook-release/rook-ceph-cluster").unwrap(),
chart_version: todo!(),
values_overrides: todo!(),
values_yaml: Some(values.to_string()),
create_namespace: todo!(),
install_only: todo!(),
repository: todo!(),
}
}

View File

@@ -0,0 +1,24 @@
use std::str::FromStr;
use non_blank_string_rs::NonBlankString;
use crate::modules::helm::chart::HelmChartScore;
pub fn rook_ceph_helm_chart(ns: &str) -> HelmChartScore {
let values = r#"
monitoring:
enabled: true
"#
.to_string();
HelmChartScore {
namespace: Some(NonBlankString::from_str(ns).unwrap()),
release_name: NonBlankString::from_str("rook-ceph").unwrap(),
chart_name: NonBlankString::from_str("https://charts.rook.io/release/rook-release/rook-ceph").unwrap(),
chart_version: todo!(),
values_overrides: todo!(),
values_yaml: Some(values.to_string()),
create_namespace: todo!(),
install_only: todo!(),
repository: todo!(),
}
}

View File

@@ -0,0 +1,81 @@
use serde::Serialize;
use crate::{
data::{Id, Version},
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
inventory::Inventory,
score::Score,
topology::{HelmCommand, Topology},
};
#[derive(Debug, Clone, Serialize)]
pub struct RookCephInstall {
namespace: String,
}
impl<T: Topology + HelmCommand> Score<T> for RookCephInstall {
fn name(&self) -> String {
"RookCephInstall".to_string()
}
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
Box::new(RookCephInstallInterpret {
score: self.score.clone(),
})
}
}
#[derive(Debug, Clone)]
pub struct RookCephInstallInterpret {
score: RookCephInstall,
}
#[async_trait]
impl<T: Topology + HelmCommand> Interpret<T> for RookCephInstallInterpret {
async fn execute(
&self,
inventory: &Inventory,
topology: &T,
) -> Result<InterpretError, Outcome> {
self.label_nodes();
self.install_rook_helm_chart(self.score.namespace);
self.install_rook_cluster_helm_chart(self.score.namespace);
//TODO I think we will need to add a capability OCClient to interact with the okd
//cli tool
self.add_oc_adm_policy(self.score.namespace);
}
fn get_name(&self) -> InterpretName {
todo!()
}
fn get_version(&self) -> Version {
todo!()
}
fn get_status(&self) -> InterpretStatus {
todo!()
}
fn get_children(&self) -> Vec<Id> {
todo!()
}
}
impl RookCephInstallInterpret {
fn label_nodes(&self) -> _ {
todo!()
}
fn install_rook_helm_chart(&self, namespace: String) -> _ {
todo!()
}
fn install_rook_cluster_helm_chart(&self, namespace: String) -> _ {
todo!()
}
fn add_oc_adm_policy(&self, namespace: String) -> _ {
todo!()
}
}

View File

@@ -10,4 +10,3 @@ serde.workspace = true
serde_json.workspace = true
log.workspace = true
env_logger.workspace = true
uuid.workspace = true

File diff suppressed because it is too large Load Diff

View File

@@ -9,8 +9,16 @@ mod hwinfo;
async fn inventory() -> impl Responder {
log::info!("Received inventory request");
let host = PhysicalHost::gather();
log::info!("Inventory data gathered successfully");
actix_web::HttpResponse::Ok().json(host)
match host {
Ok(host) => {
log::info!("Inventory data gathered successfully");
actix_web::HttpResponse::Ok().json(host)
}
Err(error) => {
log::error!("Inventory data gathering FAILED");
actix_web::HttpResponse::InternalServerError().json(error)
}
}
}
#[actix_web::main]