monitoring-alerting #30
@ -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 {
|
||||
|
@ -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
|
||||
)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user
Why does the
MonitoringAlertingStackScore
need aVec<Box<dyn Score<MonitoringAlertingTopology>>>
? It seems like it's never used for anything.A score's variables should be what is needed to set it up, i.e. any values, rules, etc you want to pass in for the interpret to use to spin up the score