Compare commits
	
		
			No commits in common. "ad1aa897b1256513cefe059c615956ccfdda018a" and "9345e63a322af3bdf2845d9e70bae4374aed4f3c" have entirely different histories.
		
	
	
		
			ad1aa897b1
			...
			9345e63a32
		
	
		
| @ -4,13 +4,13 @@ use harmony_macros::yaml; | ||||
| use k8s_openapi::{ | ||||
|     api::{ | ||||
|         apps::v1::{Deployment, DeploymentSpec}, | ||||
|         core::v1::{Container, PodSpec, PodTemplateSpec}, | ||||
|         core::v1::{Container, Node, Pod, PodSpec, PodTemplateSpec}, | ||||
|     }, | ||||
|     apimachinery::pkg::apis::meta::v1::LabelSelector, | ||||
| }; | ||||
| use kube::{ | ||||
|     Api, Client, ResourceExt, | ||||
|     api::{ObjectMeta, PostParams}, | ||||
|     Api, Client, Config, ResourceExt, | ||||
|     api::{ListParams, ObjectMeta, PostParams}, | ||||
| }; | ||||
| 
 | ||||
| #[tokio::main] | ||||
| @ -42,7 +42,8 @@ async fn main() { | ||||
|     //     println!("found node {} status {:?}", n.name_any(), n.status.unwrap())
 | ||||
|     // }
 | ||||
| 
 | ||||
|     assert_eq!(nginx_deployment(), nginx_macro()); | ||||
|     let nginxdeployment = nginx_deployment_2(); | ||||
|     let nginxdeployment = nginx_deployment_serde(); | ||||
|     assert_eq!(nginx_deployment_2(), nginx_macro()); | ||||
|     assert_eq!(nginx_deployment_serde(), nginx_macro()); | ||||
|     let nginxdeployment = nginx_macro(); | ||||
| @ -148,7 +149,6 @@ fn nginx_deployment_2() -> Deployment { | ||||
| 
 | ||||
|     deployment | ||||
| } | ||||
| 
 | ||||
| fn nginx_deployment() -> Deployment { | ||||
|     let deployment = Deployment { | ||||
|         metadata: ObjectMeta { | ||||
|  | ||||
| @ -1,7 +1,10 @@ | ||||
| use harmony::{ | ||||
|     inventory::Inventory, | ||||
|     maestro::Maestro, | ||||
|     modules::dummy::{ErrorScore, PanicScore, SuccessScore}, | ||||
|     modules::{ | ||||
|         dummy::{ErrorScore, PanicScore, SuccessScore}, | ||||
|         k8s::deployment::K8sDeploymentScore, | ||||
|     }, | ||||
|     topology::HAClusterTopology, | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -7,6 +7,7 @@ use harmony::{ | ||||
|         dns::DnsScore, | ||||
|         dummy::{ErrorScore, PanicScore, SuccessScore}, | ||||
|         load_balancer::LoadBalancerScore, | ||||
|         okd::load_balancer::OKDLoadBalancerScore, | ||||
|     }, | ||||
|     topology::{ | ||||
|         BackendServer, HAClusterTopology, HealthCheck, HttpMethod, HttpStatusCode, | ||||
|  | ||||
| @ -7,6 +7,7 @@ use super::{ | ||||
|     data::{Id, Version}, | ||||
|     executors::ExecutorError, | ||||
|     inventory::Inventory, | ||||
|     topology::Topology, | ||||
| }; | ||||
| 
 | ||||
| pub enum InterpretName { | ||||
|  | ||||
| @ -82,7 +82,7 @@ where | ||||
|             }; | ||||
| 
 | ||||
|             let formatted_val = self.format_value_as_string(v, indent + 1); | ||||
|             let lines = formatted_val.lines().map(|line| line.trim_start()); | ||||
|             let mut 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)) | ||||
|  | ||||
| @ -1,3 +1,5 @@ | ||||
| use std::io; | ||||
| 
 | ||||
| use async_trait::async_trait; | ||||
| use inquire::Confirm; | ||||
| use log::{info, warn}; | ||||
| @ -14,13 +16,15 @@ 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 { | ||||
| @ -58,14 +62,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!(), | ||||
|             } | ||||
|         } | ||||
| @ -89,8 +93,8 @@ impl K8sAnywhereTopology { | ||||
|         info!("Starting K8sAnywhere installation"); | ||||
|         match self.try_install_k3d().await { | ||||
|             Ok(client) => Ok(Some(K8sState { | ||||
|                 _client: client, | ||||
|                 _source: K8sSource::LocalK3d, | ||||
|                 client, | ||||
|                 source: K8sSource::LocalK3d, | ||||
|                 message: "Successfully installed K3D cluster and acquired client".to_string(), | ||||
|             })), | ||||
|             Err(_) => todo!(), | ||||
|  | ||||
| @ -8,7 +8,9 @@ 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 { | ||||
|  | ||||
| @ -38,14 +38,14 @@ impl<T: Topology> Score<T> for K3DInstallationScore { | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug)] | ||||
| pub struct K3dInstallationInterpret {} | ||||
| struct K3dInstallationInterpret {} | ||||
| 
 | ||||
| #[async_trait] | ||||
| impl<T: Topology> Interpret<T> for K3dInstallationInterpret { | ||||
|     async fn execute( | ||||
|         &self, | ||||
|         _inventory: &Inventory, | ||||
|         _topology: &T, | ||||
|         inventory: &Inventory, | ||||
|         topology: &T, | ||||
|     ) -> Result<Outcome, InterpretError> { | ||||
|         todo!() | ||||
|     } | ||||
|  | ||||
| @ -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!() | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -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(), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -27,7 +27,7 @@ pub struct OPNsenseShellCommandScore { | ||||
| } | ||||
| 
 | ||||
| impl Serialize for OPNsenseShellCommandScore { | ||||
|     fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error> | ||||
|     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||||
|     where | ||||
|         S: serde::Serializer, | ||||
|     { | ||||
|  | ||||
| @ -17,7 +17,7 @@ pub struct OPNSenseLaunchUpgrade { | ||||
| } | ||||
| 
 | ||||
| impl Serialize for OPNSenseLaunchUpgrade { | ||||
|     fn serialize<S>(&self, _serializer: S) -> Result<S::Ok, S::Error> | ||||
|     fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> | ||||
|     where | ||||
|         S: serde::Serializer, | ||||
|     { | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user