feat: Initial helm score using helm-wrapper-rs #14

Merged
taha merged 5 commits from helm-wrapper-score into master 2025-04-23 18:22:28 +00:00
4 changed files with 66 additions and 1 deletions
Showing only changes of commit 0bc17d1dc7 - Show all commits

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,
Review

Needs to be optional here so we can decide at runtime which namespace we're deploying to. For example, when we're deploying a staging stack we should be able to specify "stack-staging" or "stack-prod" or "stack-pullrequestno435"

Needs to be optional here so we can decide at runtime which namespace we're deploying to. For example, when we're deploying a staging stack we should be able to specify "stack-staging" or "stack-prod" or "stack-pullrequestno435"
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;