Skip to content

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
3benbox committed Jul 3, 2024
1 parent ba09e75 commit 725cc5b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
8 changes: 4 additions & 4 deletions operator/src/monitoring/opentelemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
},
};
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -257,7 +258,6 @@ fn stateful_set_spec(config: &OtelConfig) -> StatefulSetSpec {
}
}


fn config_map_data() -> BTreeMap<String, String> {
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())])
Expand Down
41 changes: 19 additions & 22 deletions operator/src/monitoring/prometheus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -159,8 +159,5 @@ fn stateful_set_spec(dev_mode: bool) -> StatefulSetSpec {
fn config_map_data() -> BTreeMap<String, String> {
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())])
}
1 change: 0 additions & 1 deletion operator/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

0 comments on commit 725cc5b

Please sign in to comment.