fix: comments from pr
All checks were successful
Run Check Script / check (pull_request) Successful in 5s
All checks were successful
Run Check Script / check (pull_request) Successful in 5s
This commit is contained in:
parent
e857efa92f
commit
f2a350fae6
@ -31,21 +31,21 @@ impl KubePrometheusConfig {
|
||||
Self {
|
||||
namespace: None,
|
||||
default_rules: true,
|
||||
windows_monitoring: true,
|
||||
windows_monitoring: false,
|
||||
alert_manager: true,
|
||||
grafana: true,
|
||||
node_exporter: true,
|
||||
node_exporter: false,
|
||||
prometheus: true,
|
||||
kubernetes_service_monitors: true,
|
||||
kubernetes_api_server: true,
|
||||
kubernetes_api_server: false,
|
||||
kubelet: true,
|
||||
kube_controller_manager: true,
|
||||
kube_etcd: true,
|
||||
kube_proxy: true,
|
||||
kube_controller_manager: false,
|
||||
kube_etcd: false,
|
||||
kube_proxy: false,
|
||||
kube_state_metrics: true,
|
||||
prometheus_operator: true,
|
||||
core_dns: true,
|
||||
kube_scheduler: true,
|
||||
core_dns: false,
|
||||
kube_scheduler: false,
|
||||
alert_receiver_configs: vec![],
|
||||
alert_rules: vec![],
|
||||
}
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
pub mod config;
|
||||
pub mod kube_prometheus_helm_chart;
|
||||
pub mod types;
|
||||
|
||||
@ -1,142 +0,0 @@
|
||||
// // in your build_score function...
|
||||
//
|
||||
// // --- Step 1: Define the structs that match the ENTIRE values.yaml structure ---
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct FullValues {
|
||||
// // Top-level keys for each component
|
||||
// prometheus: Prometheus,
|
||||
// grafana: Grafana,
|
||||
// alertmanager: Alertmanager,
|
||||
// kube_state_metrics: KubeStateMetrics,
|
||||
// prometheus_operator: PrometheusOperator,
|
||||
// // Add other components like nodeExporter if you enable them
|
||||
//
|
||||
// // Key for your custom rules
|
||||
// additional_prometheus_rules_map: AlertManagerAdditionalPromRules,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct Prometheus {
|
||||
// enabled: bool,
|
||||
// prometheus_spec: PrometheusSpec,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct PrometheusSpec {
|
||||
// resources: K8sResources,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct Grafana {
|
||||
// enabled: bool,
|
||||
// resources: K8sResources,
|
||||
// sidecar: GrafanaSidecar,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct GrafanaSidecar {
|
||||
// resources: K8sResources,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct Alertmanager {
|
||||
// enabled: bool,
|
||||
// config: AlertManagerConfig, // Your existing struct for this
|
||||
// alert_manager_spec: AlertManagerSpec,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// #[serde(rename_all = "camelCase")]
|
||||
// struct AlertManagerSpec {
|
||||
// resources: K8sResources,
|
||||
// // You will need to add a `config_reloader` field here for its resources
|
||||
// }
|
||||
//
|
||||
// // Define KubeStateMetrics, PrometheusOperator, etc. in the same way
|
||||
// // ...
|
||||
//
|
||||
// // Your K8sResources struct (flat, with strings)
|
||||
// #[derive(Serialize, Debug)]
|
||||
// struct K8sResources {
|
||||
// requests: ResourceValues,
|
||||
// limits: ResourceValues,
|
||||
// }
|
||||
//
|
||||
// #[derive(Serialize, Debug)]
|
||||
// struct ResourceValues {
|
||||
// cpu: String,
|
||||
// memory: String,
|
||||
// }
|
||||
//
|
||||
//
|
||||
// // --- Step 2: Populate the single, unified struct ---
|
||||
//
|
||||
// // Prepare your alertmanager config
|
||||
// let mut alert_manager_channel_config = build_your_alert_manager_config(); // Your existing logic
|
||||
//
|
||||
// // Prepare your custom rules
|
||||
// let merged_rules = build_your_prometheus_rules(); // Your existing logic
|
||||
//
|
||||
// // Define the resource profiles
|
||||
// let heavy_res = K8sResources { /* ... */ };
|
||||
// let medium_res = K8sResources { /* ... */ };
|
||||
// let light_res = K8sResources { /* ... */ };
|
||||
//
|
||||
// // Create the single source of truth for your values
|
||||
// let full_values = FullValues {
|
||||
// prometheus: Prometheus {
|
||||
// enabled: config.prometheus,
|
||||
// prometheus_spec: PrometheusSpec {
|
||||
// resources: heavy_res,
|
||||
// },
|
||||
// },
|
||||
// grafana: Grafana {
|
||||
// enabled: config.grafana,
|
||||
// resources: medium_res,
|
||||
// sidecar: GrafanaSidecar {
|
||||
// resources: light_res,
|
||||
// },
|
||||
// },
|
||||
// alertmanager: Alertmanager {
|
||||
// enabled: config.alert_manager,
|
||||
// config: alert_manager_channel_config,
|
||||
// alert_manager_spec: AlertManagerSpec {
|
||||
// resources: light_res,
|
||||
// // You'd add the config_reloader resources here
|
||||
// },
|
||||
// },
|
||||
// kube_state_metrics: KubeStateMetrics {
|
||||
// enabled: config.kube_state_metrics,
|
||||
// resources: medium_res,
|
||||
// },
|
||||
// prometheus_operator: PrometheusOperator {
|
||||
// enabled: config.prometheus_operator,
|
||||
// resources: light_res,
|
||||
// // ... and so on for its sidecars
|
||||
// },
|
||||
// additional_prometheus_rules_map: merged_rules,
|
||||
// };
|
||||
//
|
||||
//
|
||||
// // --- Step 3: Serialize the single struct ONCE ---
|
||||
//
|
||||
// let final_values_yaml = serde_yaml::to_string(&full_values)
|
||||
// .expect("Failed to serialize final values YAML");
|
||||
//
|
||||
// debug!("full values.yaml: \n {:#}", final_values_yaml);
|
||||
//
|
||||
//
|
||||
// // --- Step 4: Use the final string in your Helm score ---
|
||||
//
|
||||
// HelmChartScore {
|
||||
// // ...
|
||||
// values_yaml: Some(final_values_yaml),
|
||||
// // ...
|
||||
// }
|
||||
@ -1,7 +1,7 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
use async_trait::async_trait;
|
||||
use log::debug;
|
||||
use log::{debug, error};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{
|
||||
@ -67,6 +67,7 @@ impl Prometheus {
|
||||
.get_tenant_config()
|
||||
.map(|cfg| cfg.name.clone())
|
||||
.unwrap_or_else(|| "monitoring".to_string());
|
||||
error!("This must be refactored, see comments in pr #74");
|
||||
debug!("NS: {}", ns);
|
||||
self.config.lock().unwrap().namespace = Some(ns);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user