diff --git a/examples/kube-rs/src/main.rs b/examples/kube-rs/src/main.rs index a8cc948..7f228e7 100644 --- a/examples/kube-rs/src/main.rs +++ b/examples/kube-rs/src/main.rs @@ -4,13 +4,13 @@ use harmony_macros::yaml; use k8s_openapi::{ api::{ apps::v1::{Deployment, DeploymentSpec}, - core::v1::{Container, Node, Pod, PodSpec, PodTemplateSpec}, + core::v1::{Container, PodSpec, PodTemplateSpec}, }, apimachinery::pkg::apis::meta::v1::LabelSelector, }; use kube::{ - Api, Client, Config, ResourceExt, - api::{ListParams, ObjectMeta, PostParams}, + Api, Client, ResourceExt, + api::{ObjectMeta, PostParams}, }; #[tokio::main] @@ -42,8 +42,7 @@ async fn main() { // println!("found node {} status {:?}", n.name_any(), n.status.unwrap()) // } - let nginxdeployment = nginx_deployment_2(); - let nginxdeployment = nginx_deployment_serde(); + assert_eq!(nginx_deployment(), nginx_macro()); assert_eq!(nginx_deployment_2(), nginx_macro()); assert_eq!(nginx_deployment_serde(), nginx_macro()); let nginxdeployment = nginx_macro(); @@ -149,6 +148,7 @@ fn nginx_deployment_2() -> Deployment { deployment } + fn nginx_deployment() -> Deployment { let deployment = Deployment { metadata: ObjectMeta { diff --git a/examples/nanodc/src/main.rs b/examples/nanodc/src/main.rs index 8aad09a..5c8c179 100644 --- a/examples/nanodc/src/main.rs +++ b/examples/nanodc/src/main.rs @@ -1,10 +1,7 @@ use harmony::{ inventory::Inventory, maestro::Maestro, - modules::{ - dummy::{ErrorScore, PanicScore, SuccessScore}, - k8s::deployment::K8sDeploymentScore, - }, + modules::dummy::{ErrorScore, PanicScore, SuccessScore}, topology::HAClusterTopology, }; diff --git a/examples/tui/src/main.rs b/examples/tui/src/main.rs index 72f9aab..e107d96 100644 --- a/examples/tui/src/main.rs +++ b/examples/tui/src/main.rs @@ -7,7 +7,6 @@ use harmony::{ dns::DnsScore, dummy::{ErrorScore, PanicScore, SuccessScore}, load_balancer::LoadBalancerScore, - okd::load_balancer::OKDLoadBalancerScore, }, topology::{ BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, diff --git a/harmony/src/domain/interpret/mod.rs b/harmony/src/domain/interpret/mod.rs index 0812ced..789edc6 100644 --- a/harmony/src/domain/interpret/mod.rs +++ b/harmony/src/domain/interpret/mod.rs @@ -7,7 +7,6 @@ use super::{ data::{Id, Version}, executors::ExecutorError, inventory::Inventory, - topology::Topology, }; pub enum InterpretName { diff --git a/harmony/src/domain/score.rs b/harmony/src/domain/score.rs index a48548c..216fb23 100644 --- a/harmony/src/domain/score.rs +++ b/harmony/src/domain/score.rs @@ -82,7 +82,7 @@ where }; let formatted_val = self.format_value_as_string(v, indent + 1); - let mut lines = formatted_val.lines().map(|line| line.trim_start()); + let lines = formatted_val.lines().map(|line| line.trim_start()); let wrapped_lines: Vec<_> = lines .flat_map(|line| self.wrap_or_truncate(line.trim_start(), 48)) diff --git a/harmony/src/domain/topology/k8s_anywhere.rs b/harmony/src/domain/topology/k8s_anywhere.rs index b1d5390..405e46d 100644 --- a/harmony/src/domain/topology/k8s_anywhere.rs +++ b/harmony/src/domain/topology/k8s_anywhere.rs @@ -1,5 +1,3 @@ -use std::io; - use async_trait::async_trait; use inquire::Confirm; use log::{info, warn}; @@ -16,15 +14,13 @@ use crate::{ use super::{Topology, k8s::K8sClient}; struct K8sState { - client: K8sClient, - source: K8sSource, + _client: K8sClient, + _source: K8sSource, message: String, } enum K8sSource { - RemoteCluster, LocalK3d, - // TODO: Add variants for cloud providers like AwsEks, Gke, Aks } pub struct K8sAnywhereTopology { @@ -62,14 +58,14 @@ impl K8sAnywhereTopology { if k8s_anywhere_config.use_system_kubeconfig { match self.try_load_system_kubeconfig().await { - Some(client) => todo!(), + Some(_client) => todo!(), None => todo!(), } } if let Some(kubeconfig) = k8s_anywhere_config.kubeconfig { match self.try_load_kubeconfig(&kubeconfig).await { - Some(client) => todo!(), + Some(_client) => todo!(), None => todo!(), } } @@ -93,8 +89,8 @@ impl K8sAnywhereTopology { info!("Starting K8sAnywhere installation"); match self.try_install_k3d().await { Ok(client) => Ok(Some(K8sState { - client, - source: K8sSource::LocalK3d, + _client: client, + _source: K8sSource::LocalK3d, message: "Successfully installed K3D cluster and acquired client".to_string(), })), Err(_) => todo!(), diff --git a/harmony/src/modules/helm/chart.rs b/harmony/src/modules/helm/chart.rs index 08d2980..ea03765 100644 --- a/harmony/src/modules/helm/chart.rs +++ b/harmony/src/modules/helm/chart.rs @@ -8,9 +8,7 @@ use helm_wrapper_rs; use helm_wrapper_rs::blocking::{DefaultHelmExecutor, HelmExecutor}; use non_blank_string_rs::NonBlankString; use serde::Serialize; -use serde::de::DeserializeOwned; use std::collections::HashMap; -use std::path::PathBuf; #[derive(Debug, Clone, Serialize)] pub struct HelmChartScore { diff --git a/harmony/src/modules/k3d/install.rs b/harmony/src/modules/k3d/install.rs index 0e0cec8..5317996 100644 --- a/harmony/src/modules/k3d/install.rs +++ b/harmony/src/modules/k3d/install.rs @@ -38,14 +38,14 @@ impl Score for K3DInstallationScore { } #[derive(Debug)] -struct K3dInstallationInterpret {} +pub struct K3dInstallationInterpret {} #[async_trait] impl Interpret for K3dInstallationInterpret { async fn execute( &self, - inventory: &Inventory, - topology: &T, + _inventory: &Inventory, + _topology: &T, ) -> Result { todo!() } diff --git a/harmony/src/modules/okd/load_balancer.rs b/harmony/src/modules/okd/load_balancer.rs index 0345d46..eb1ed44 100644 --- a/harmony/src/modules/okd/load_balancer.rs +++ b/harmony/src/modules/okd/load_balancer.rs @@ -13,7 +13,7 @@ use crate::{ }; impl std::fmt::Display for OKDLoadBalancerScore { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { todo!() } } diff --git a/harmony/src/modules/okd/upgrade.rs b/harmony/src/modules/okd/upgrade.rs index a215c00..5115cfb 100644 --- a/harmony/src/modules/okd/upgrade.rs +++ b/harmony/src/modules/okd/upgrade.rs @@ -2,15 +2,15 @@ use crate::data::Version; #[derive(Debug, Clone)] pub struct OKDUpgradeScore { - current_version: Version, - target_version: Version, + _current_version: Version, + _target_version: Version, } impl OKDUpgradeScore { pub fn new() -> Self { Self { - current_version: Version::from("4.17.0-okd-scos.0").unwrap(), - target_version: Version::from("").unwrap(), + _current_version: Version::from("4.17.0-okd-scos.0").unwrap(), + _target_version: Version::from("").unwrap(), } } } diff --git a/harmony/src/modules/opnsense/shell.rs b/harmony/src/modules/opnsense/shell.rs index a35a43c..90be4e6 100644 --- a/harmony/src/modules/opnsense/shell.rs +++ b/harmony/src/modules/opnsense/shell.rs @@ -27,7 +27,7 @@ pub struct OPNsenseShellCommandScore { } impl Serialize for OPNsenseShellCommandScore { - fn serialize(&self, serializer: S) -> Result + fn serialize(&self, _serializer: S) -> Result where S: serde::Serializer, { diff --git a/harmony/src/modules/opnsense/upgrade.rs b/harmony/src/modules/opnsense/upgrade.rs index 45adf12..c54fabe 100644 --- a/harmony/src/modules/opnsense/upgrade.rs +++ b/harmony/src/modules/opnsense/upgrade.rs @@ -17,7 +17,7 @@ pub struct OPNSenseLaunchUpgrade { } impl Serialize for OPNSenseLaunchUpgrade { - fn serialize(&self, serializer: S) -> Result + fn serialize(&self, _serializer: S) -> Result where S: serde::Serializer, {