Quick WIP for Helm score

This commit is contained in:
Taha Hawa 2025-04-22 17:16:17 -04:00
parent 8f470278a7
commit 0bc17d1dc7
4 changed files with 66 additions and 1 deletions

View File

@ -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"

View File

@ -0,0 +1 @@
pub mod resource;

View File

@ -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<T: Topology + std::fmt::Debug + Sync + Default + serde::Serialize + 'static + Send + Clone>
Score<T> for HelmResourceScore
{
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
todo!()
}
fn name(&self) -> String {
format!("{}, {}", self.release_name, self.chart_name)
}
}
#[derive(Debug, Serialize)]
pub struct HelmResourceInterpret {
pub score: HelmResourceScore,
}
#[async_trait]
impl<T: Topology + Clone + std::fmt::Debug + serde::Serialize + Default + Send + Sync> Interpret<T>
for HelmResourceInterpret
{
async fn execute(
&self,
_inventory: &Inventory,
topology: &T,
) -> Result<Outcome, InterpretError> {
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<Id> {
todo!()
}
}

View File

@ -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;