diff --git a/operator/src/monitoring/opentelemetry.rs b/operator/src/monitoring/opentelemetry.rs index 020c9dd..e6a0b73 100644 --- a/operator/src/monitoring/opentelemetry.rs +++ b/operator/src/monitoring/opentelemetry.rs @@ -9,7 +9,7 @@ use k8s_openapi::{ PodSpec, PodTemplateSpec, ResourceRequirements, ServicePort, ServiceSpec, Volume, VolumeMount, }, - rbac::v1::{PolicyRule, RoleRef, Subject, Role, RoleBinding}, + rbac::v1::{PolicyRule, Role, RoleBinding, RoleRef, Subject}, }, apimachinery::pkg::{ api::resource::Quantity, @@ -27,7 +27,7 @@ use crate::{ resource_limits::ResourceLimitsConfig, }, utils::{ - apply_account, apply_namespaced_role, apply_namespaced_role_binding, apply_config_map, + apply_account, apply_config_map, apply_namespaced_role, apply_namespaced_role_binding, apply_service, apply_stateful_set, Clock, Context, }, }; @@ -59,7 +59,8 @@ pub async fn apply( orefs.to_vec(), OTEL_ROLE_BINDING, role_binding(ns), - ).await?; + ) + .await?; apply_config_map( cx.clone(), ns, @@ -257,7 +258,6 @@ fn stateful_set_spec(config: &OtelConfig) -> StatefulSetSpec { } } - fn config_map_data() -> BTreeMap { let config_str = include_str!("./otel-config.yaml"); // Adjust the path as necessary BTreeMap::from_iter(vec![("otel-config.yaml".to_owned(), config_str.to_owned())]) diff --git a/operator/src/monitoring/prometheus.rs b/operator/src/monitoring/prometheus.rs index 9ad5b44..6c4e939 100644 --- a/operator/src/monitoring/prometheus.rs +++ b/operator/src/monitoring/prometheus.rs @@ -4,12 +4,14 @@ use k8s_openapi::{ api::{ apps::v1::StatefulSetSpec, core::v1::{ - ConfigMapVolumeSource, Container, ContainerPort, PodSpec, PodTemplateSpec, ResourceRequirements, ServicePort, ServiceSpec, Volume, VolumeMount + ConfigMapVolumeSource, Container, ContainerPort, PodSpec, PodTemplateSpec, + ResourceRequirements, ServicePort, ServiceSpec, Volume, VolumeMount, }, }, apimachinery::pkg::{ api::resource::Quantity, - apis::meta::v1::{LabelSelector, ObjectMeta, OwnerReference}, util::intstr::IntOrString, + apis::meta::v1::{LabelSelector, ObjectMeta, OwnerReference}, + util::intstr::IntOrString, }, }; use rand::RngCore; @@ -44,13 +46,13 @@ pub async fn apply( ) .await?; apply_service( - cx.clone(), - ns, - orefs.to_vec(), - PROM_SERVICE_NAME, - service_spec(), -) -.await?; + cx.clone(), + ns, + orefs.to_vec(), + PROM_SERVICE_NAME, + service_spec(), + ) + .await?; apply_stateful_set( cx.clone(), ns, @@ -88,15 +90,13 @@ fn resource_requirements(dev_mode: bool) -> ResourceRequirements { fn service_spec() -> ServiceSpec { ServiceSpec { - ports: Some(vec![ - ServicePort { - name: Some("prometheus".to_owned()), - port: 9090, - protocol: Some("TCP".to_owned()), - target_port: Some(IntOrString::Int(9090)), - ..Default::default() - }, - ]), + ports: Some(vec![ServicePort { + name: Some("prometheus".to_owned()), + port: 9090, + protocol: Some("TCP".to_owned()), + target_port: Some(IntOrString::Int(9090)), + ..Default::default() + }]), selector: selector_labels(PROM_APP), type_: Some("ClusterIP".to_owned()), ..Default::default() @@ -159,8 +159,5 @@ fn stateful_set_spec(dev_mode: bool) -> StatefulSetSpec { fn config_map_data() -> BTreeMap { let config_str = include_str!("./prom-config.yaml"); - BTreeMap::from_iter(vec![( - "prom-config.yaml".to_owned(), - config_str.to_owned(), - )]) + BTreeMap::from_iter(vec![("prom-config.yaml".to_owned(), config_str.to_owned())]) } diff --git a/operator/src/utils/mod.rs b/operator/src/utils/mod.rs index 2f1c44d..8f4db96 100644 --- a/operator/src/utils/mod.rs +++ b/operator/src/utils/mod.rs @@ -390,4 +390,3 @@ pub fn override_and_sort_env_vars( // Sort env vars so we can have stable tests env.sort_unstable_by(|a, b| a.name.cmp(&b.name)); } -