diff --git a/harmony/src/domain/topology/k8s.rs b/harmony/src/domain/topology/k8s.rs index 91a310c..0c334d5 100644 --- a/harmony/src/domain/topology/k8s.rs +++ b/harmony/src/domain/topology/k8s.rs @@ -3,10 +3,7 @@ use std::time::Duration; use derive_new::new; use k8s_openapi::{ ClusterResourceScope, NamespaceResourceScope, - api::{ - apps::v1::Deployment, - core::v1::Pod, - }, + api::{apps::v1::Deployment, core::v1::Pod}, }; use kube::{ Client, Config, Error, Resource, @@ -172,10 +169,11 @@ impl K8sClient { if let Some(p) = pod && let Some(status) = p.status - && let Some(phase) = status.phase - && phase.to_lowercase() == "running" { - return Ok(()); - } + && let Some(phase) = status.phase + && phase.to_lowercase() == "running" + { + return Ok(()); + } if elapsed >= timeout_secs { return Err(Error::Discovery(DiscoveryError::MissingResource(format!( diff --git a/harmony/src/infra/opnsense/load_balancer.rs b/harmony/src/infra/opnsense/load_balancer.rs index fb625a5..8a408f1 100644 --- a/harmony/src/infra/opnsense/load_balancer.rs +++ b/harmony/src/infra/opnsense/load_balancer.rs @@ -183,15 +183,12 @@ pub(crate) fn get_health_check_for_backend( match uppercase { "TCP" => { if let Some(checkport) = haproxy_health_check.checkport.content.as_ref() - && !checkport.is_empty() { - return Some(HealthCheck::TCP(Some(checkport.parse().unwrap_or_else( - |_| { - panic!( - "HAProxy check port should be a valid port number, got {checkport}" - ) - }, - )))); - } + && !checkport.is_empty() + { + return Some(HealthCheck::TCP(Some(checkport.parse().unwrap_or_else( + |_| panic!("HAProxy check port should be a valid port number, got {checkport}"), + )))); + } Some(HealthCheck::TCP(None)) } "HTTP" => { diff --git a/harmony/src/modules/application/features/helm_argocd_score.rs b/harmony/src/modules/application/features/helm_argocd_score.rs index 7caefec..3f70cd7 100644 --- a/harmony/src/modules/application/features/helm_argocd_score.rs +++ b/harmony/src/modules/application/features/helm_argocd_score.rs @@ -10,10 +10,7 @@ use crate::{ inventory::Inventory, modules::helm::chart::{HelmChartScore, HelmRepository}, score::Score, - topology::{ - HelmCommand, K8sclient, Topology, ingress::Ingress, - k8s::K8sClient, - }, + topology::{HelmCommand, K8sclient, Topology, ingress::Ingress, k8s::K8sClient}, }; use harmony_types::id::Id; diff --git a/harmony/src/modules/application/rust.rs b/harmony/src/modules/application/rust.rs index 4874798..5ec1d57 100644 --- a/harmony/src/modules/application/rust.rs +++ b/harmony/src/modules/application/rust.rs @@ -194,10 +194,10 @@ impl RustWebapp { Some(body_full(tar_data.into())), ); - while let Some(mut msg) = image_build_stream.next().await { + while let Some(msg) = image_build_stream.next().await { trace!("Got bollard msg {msg:?}"); match msg { - Ok(mut msg) => { + Ok(msg) => { if let Some(progress) = msg.progress_detail { info!( "Build progress {}/{}", @@ -511,25 +511,23 @@ ingress: fs::write(chart_dir.join("values.yaml"), values_yaml)?; // Create templates/_helpers.tpl - let helpers_tpl = format!( - r#" -{{{{/* + let helpers_tpl = r#" +{{/* Expand the name of the chart. -*/}}}} -{{{{- define "chart.name" -}}}} -{{{{- default .Chart.Name $.Values.nameOverride | trunc 63 | trimSuffix "-" }}}} -{{{{- end }}}} +*/}} +{{- define "chart.name" -}} +{{- default .Chart.Name $.Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end }} -{{{{/* +{{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}}}} -{{{{- define "chart.fullname" -}}}} -{{{{- $name := default .Chart.Name $.Values.nameOverride }}}} -{{{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}}} -{{{{- end }}}} -"# - ); +*/}} +{{- define "chart.fullname" -}} +{{- $name := default .Chart.Name $.Values.nameOverride }} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} +{{- end }} +"#.to_string(); fs::write(templates_dir.join("_helpers.tpl"), helpers_tpl)?; // Create templates/service.yaml diff --git a/harmony/src/modules/helm/command.rs b/harmony/src/modules/helm/command.rs index 98198de..175f8f5 100644 --- a/harmony/src/modules/helm/command.rs +++ b/harmony/src/modules/helm/command.rs @@ -107,9 +107,10 @@ impl HelmCommandExecutor { pub fn run_command(mut self, mut args: Vec) -> Result { if let Some(d) = self.debug - && d { - args.push("--debug".to_string()); - } + && d + { + args.push("--debug".to_string()); + } let path = if let Some(p) = self.path { p @@ -233,24 +234,28 @@ impl HelmChart { } if let Some(crd) = self.include_crds - && crd { - args.push("--include-crds".to_string()); - } + && crd + { + args.push("--include-crds".to_string()); + } if let Some(st) = self.skip_tests - && st { - args.push("--skip-tests".to_string()); - } + && st + { + args.push("--skip-tests".to_string()); + } if let Some(sh) = self.skip_hooks - && sh { - args.push("--no-hooks".to_string()); - } + && sh + { + args.push("--no-hooks".to_string()); + } if let Some(d) = self.debug - && d { - args.push("--debug".to_string()); - } + && d + { + args.push("--debug".to_string()); + } args } diff --git a/harmony/src/modules/monitoring/kube_prometheus/crd/rhob_monitoring_stack.rs b/harmony/src/modules/monitoring/kube_prometheus/crd/rhob_monitoring_stack.rs index 2b38ca4..be9ccc0 100644 --- a/harmony/src/modules/monitoring/kube_prometheus/crd/rhob_monitoring_stack.rs +++ b/harmony/src/modules/monitoring/kube_prometheus/crd/rhob_monitoring_stack.rs @@ -1,4 +1,3 @@ - use kube::CustomResource; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; diff --git a/harmony/src/modules/okd/bootstrap_02_bootstrap.rs b/harmony/src/modules/okd/bootstrap_02_bootstrap.rs index 2699b9f..6696c8b 100644 --- a/harmony/src/modules/okd/bootstrap_02_bootstrap.rs +++ b/harmony/src/modules/okd/bootstrap_02_bootstrap.rs @@ -104,7 +104,9 @@ impl OKDSetup02BootstrapInterpret { InterpretError::new(format!("Failed to create okd installation directory : {e}")) })?; if !exit_status.success() { - return Err(InterpretError::new("Failed to create okd installation directory".to_string())); + return Err(InterpretError::new( + "Failed to create okd installation directory".to_string(), + )); } else { info!( "Created OKD installation directory {}", diff --git a/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs b/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs index 79ff3ad..7474e53 100644 --- a/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs +++ b/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs @@ -183,12 +183,13 @@ impl CephRemoveOsdInterpret { if let Some(deployment) = dep && let Some(status) = deployment.status - && status.replicas.unwrap_or(1) == 0 && status.ready_replicas.unwrap_or(1) == 0 - { - return Ok(Outcome::success( - "Deployment successfully scaled down.".to_string(), - )); - } + && status.replicas.unwrap_or(1) == 0 + && status.ready_replicas.unwrap_or(1) == 0 + { + return Ok(Outcome::success( + "Deployment successfully scaled down.".to_string(), + )); + } if start.elapsed() > timeout { return Err(InterpretError::new(format!(