feat/impl_installable_crd_prometheus #170

Open
wjro wants to merge 9 commits from feat/impl_installable_crd_prometheus into master
3 changed files with 10 additions and 19 deletions
Showing only changes of commit ce91ee0168 - Show all commits

View File

@ -585,21 +585,12 @@ impl K8sAnywhereTopology {
receivers: Option<Vec<Box<dyn AlertReceiver<CRDPrometheus>>>>,
service_monitors: Option<Vec<ServiceMonitor>>,
) -> K8sPrometheusCRDAlertingScore {
if let Some(sm) = service_monitors {
return K8sPrometheusCRDAlertingScore {
sender,
receivers: receivers.unwrap_or_default(),
service_monitors: sm,
prometheus_rules: vec![],
};
} else {
return K8sPrometheusCRDAlertingScore {
sender,
receivers: receivers.unwrap_or_default(),
service_monitors: vec![],
prometheus_rules: vec![],
};
}
return K8sPrometheusCRDAlertingScore {
wjro marked this conversation as resolved Outdated

Small detail, but we could also use service_monitors: service_monitors.unwrap_or_default() here:

            return K8sPrometheusCRDAlertingScore {
                sender,
                receivers: receivers.unwrap_or_default(),
                service_monitors: service_monitors.unwrap_or_default(),
                prometheus_rules: vec![],
            };
Small detail, but we could also use `service_monitors: service_monitors.unwrap_or_default()` here: ```rs return K8sPrometheusCRDAlertingScore { sender, receivers: receivers.unwrap_or_default(), service_monitors: service_monitors.unwrap_or_default(), prometheus_rules: vec![], }; ```
sender,
receivers: receivers.unwrap_or_default(),
service_monitors: service_monitors.unwrap_or_default(),
prometheus_rules: vec![],
};
}
async fn openshift_ingress_operator_available(&self) -> Result<(), PreparationError> {
@ -882,7 +873,8 @@ impl K8sAnywhereTopology {
}
let _grafana_operator_score = grafana_helm_chart_score(namespace, namespace_scope)
.interpret(inventory, self)
.await;
.await
.map_err(|e| PreparationError::new(e.to_string()));
Ok(PreparationOutcome::Success {
details: format!(
"Successfully installed grafana operator in ns {}",

View File

@ -1,3 +1,4 @@
use harmony_macros::hurl;
use non_blank_string_rs::NonBlankString;
use std::{collections::HashMap, str::FromStr};
@ -20,7 +21,7 @@ pub fn grafana_helm_chart_score(ns: &str, namespace_scope: bool) -> HelmChartSco
install_only: true,
repository: Some(HelmRepository::new(
"grafana".to_string(),
url::Url::parse("https://grafana.github.io/helm-charts").unwrap(),
hurl!("https://grafana.github.io/helm-charts"),
true,
)),
}

View File

@ -467,8 +467,6 @@ impl K8sPrometheusCRDAlertingInterpret {
match_labels: label.clone(),
match_expressions: vec![],
};
// let mut json_data = BTreeMap::new();
// json_data.insert("timeInterval".to_string(), "5s".to_string());
let namespace = self.sender.namespace.clone();
let json_data = GrafanaDatasourceJsonData {
wjro marked this conversation as resolved
Review

dead code?

dead code?
time_interval: Some("5s".to_string()),