From 0bc17d1dc769a76f9a09a473737370c893b09cfa Mon Sep 17 00:00:00 2001 From: Taha Hawa Date: Tue, 22 Apr 2025 17:16:17 -0400 Subject: [PATCH] Quick WIP for Helm score --- harmony/Cargo.toml | 2 +- harmony/src/modules/helm/mod.rs | 1 + harmony/src/modules/helm/resource.rs | 63 ++++++++++++++++++++++++++++ harmony/src/modules/mod.rs | 1 + 4 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 harmony/src/modules/helm/mod.rs create mode 100644 harmony/src/modules/helm/resource.rs diff --git a/harmony/Cargo.toml b/harmony/Cargo.toml index a5d53d1..8b26edb 100644 --- a/harmony/Cargo.toml +++ b/harmony/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true [dependencies] libredfish = "0.1.1" -reqwest = {version = "0.11", features = ["blocking", "json"] } +reqwest = { version = "0.11", features = ["blocking", "json"] } russh = "0.45.0" rust-ipmi = "0.1.1" semver = "1.0.23" diff --git a/harmony/src/modules/helm/mod.rs b/harmony/src/modules/helm/mod.rs new file mode 100644 index 0000000..dd231cb --- /dev/null +++ b/harmony/src/modules/helm/mod.rs @@ -0,0 +1 @@ +pub mod resource; \ No newline at end of file diff --git a/harmony/src/modules/helm/resource.rs b/harmony/src/modules/helm/resource.rs new file mode 100644 index 0000000..b23c4a4 --- /dev/null +++ b/harmony/src/modules/helm/resource.rs @@ -0,0 +1,63 @@ +use crate::data::{Id, Version}; +use crate::interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome}; +use crate::inventory::Inventory; +use crate::score::Score; +use crate::topology::Topology; +use async_trait::async_trait; +use helm_wrapper_rs; +use serde::Serialize; + +#[derive(Debug, Clone, Serialize)] +pub struct HelmResourceScore { + pub namespace: String, + pub release_name: String, + pub chart_name: String, + pub chart_version: String, + pub values_overrides: String, + pub values_file: String, + pub helm_options: String, +} + +impl + Score for HelmResourceScore +{ + fn create_interpret(&self) -> Box> { + todo!() + } + + fn name(&self) -> String { + format!("{}, {}", self.release_name, self.chart_name) + } +} + +#[derive(Debug, Serialize)] +pub struct HelmResourceInterpret { + pub score: HelmResourceScore, +} + +#[async_trait] +impl Interpret + for HelmResourceInterpret +{ + async fn execute( + &self, + _inventory: &Inventory, + topology: &T, + ) -> Result { + Ok(Outcome::success( + "Successfully applied resource".to_string(), + )) + } + fn get_name(&self) -> InterpretName { + todo!() + } + fn get_version(&self) -> Version { + todo!() + } + fn get_status(&self) -> InterpretStatus { + todo!() + } + fn get_children(&self) -> Vec { + todo!() + } +} diff --git a/harmony/src/modules/mod.rs b/harmony/src/modules/mod.rs index 19d88d7..a578ada 100644 --- a/harmony/src/modules/mod.rs +++ b/harmony/src/modules/mod.rs @@ -1,6 +1,7 @@ pub mod dhcp; pub mod dns; pub mod dummy; +pub mod helm; pub mod http; pub mod k3d; pub mod k8s;