fix:installs helm chart

This commit is contained in:
Willem 2025-05-06 12:23:03 -04:00
parent 2d74c66fc6
commit d9921b857b
3 changed files with 15 additions and 3 deletions

View File

@ -45,6 +45,8 @@ impl MonitoringAlertingTopology {
for ns in &["monitoring", "openshift-monitoring"] {
let pods: Api<Pod> = Api::namespaced(client.clone(), ns);
//TODO hardcoding the label is a problem
//check all pods are ready
let lp = ListParams::default().labels("app.kubernetes.io/name=prometheus");
match pods.list(&lp).await {

View File

@ -31,7 +31,7 @@ additionalPrometheusRules:
namespace: Some(NonBlankString::from_str(ns).unwrap()),
release_name: NonBlankString::from_str("kube-prometheus").unwrap(),
chart_name: NonBlankString::from_str(
"https://prometheus-community.github.io/helm-charts"
"oci://registry-1.docker.io/bitnamicharts/kube-prometheus"
//use kube prometheus chart which includes grafana, prometheus, alert
//manager, etc
)

View File

@ -1,4 +1,5 @@
use async_trait::async_trait;
use log::info;
use serde::Serialize;
use crate::{
@ -14,6 +15,9 @@ use super::kube_prometheus::kube_prometheus_score;
#[derive(Debug)]
pub struct MonitoringAlertingStackScore {
//TODO add documenation to explain why its here
//keeps it open for the end user to specify which stack they want
//if it isnt default kube-prometheus
pub monitoring_stack: Vec<Box<dyn Score<MonitoringAlertingTopology>>>,
pub namespace: String,
}
@ -102,14 +106,20 @@ impl <T: Topology> Interpret<T> for MonitoringAlertingStackInterpret {
) -> Result<Outcome, InterpretError> {
let inventory = Inventory::autoload();
let topology = MonitoringAlertingTopology::new();
let mut maestro = match Maestro::initialize(inventory, topology).await {
let maestro = match Maestro::initialize(inventory, topology).await {
Ok(m) => m,
Err(e) => {
println!("failed to initialize Maestro: {}", e);
std::process::exit(1);
}
};
maestro.register_all(self.score.monitoring_stack.clone());
let scores_vec = self.score.monitoring_stack.clone();
for s in scores_vec{
info!("Running: {}", s.name());
maestro.interpret(s).await?;
}
Ok(Outcome::success(format!(
"monitoring stack installed in {} namespace",
self.score.namespace