forked from NationTech/harmony
		
	fix: removed dead code, mapped error from grafana operator to preparation error rather than ignoring it, modified k8sprometheus score to unwrap_or_default() service monitors
This commit is contained in:
		
							parent
							
								
									c0d54a4466
								
							
						
					
					
						commit
						ce91ee0168
					
				| @ -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, | ||||
|             service_monitors: service_monitors.unwrap_or_default(), | ||||
|             prometheus_rules: vec![], | ||||
|         }; | ||||
|         } else { | ||||
|             return K8sPrometheusCRDAlertingScore { | ||||
|                 sender, | ||||
|                 receivers: receivers.unwrap_or_default(), | ||||
|                 service_monitors: vec![], | ||||
|                 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 {}", | ||||
|  | ||||
| @ -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, | ||||
|         )), | ||||
|     } | ||||
|  | ||||
| @ -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 { | ||||
|             time_interval: Some("5s".to_string()), | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user