diff --git a/harmony/src/modules/application/features/continuous_delivery.rs b/harmony/src/modules/application/features/continuous_delivery.rs new file mode 100644 index 0000000..4cd2946 --- /dev/null +++ b/harmony/src/modules/application/features/continuous_delivery.rs @@ -0,0 +1,37 @@ +/// ContinuousDelivery in Harmony provides this functionality : +/// +/// - **Package** the application +/// - **Push** to an artifact registry +/// - **Deploy** to a testing environment +/// - **Deploy** to a production environment +/// +/// It is intended to be used as an application feature passed down to an ApplicationInterpret. For +/// example : +/// +/// ```rust +/// let app = RustApplicationScore { +/// name: "My Rust App".to_string(), +/// features: vec![ContinuousDelivery::default()], +/// }; +/// ``` +/// +/// *Note :* +/// +/// By default, the Harmony Opinionated Pipeline is built using these technologies : +/// +/// - Gitea Action (executes pipeline steps) +/// - Docker to build an OCI container image +/// - Helm chart to package Kubernetes resources +/// - Harbor as artifact registru +/// - ArgoCD to install/upgrade/rollback/inspect k8s resources +/// - Kubernetes for runtime orchestration +#[derive(Debug, Default)] +pub struct ContinuousDelivery {} + +#[async_trait] +impl ApplicationFeature for ContinuousDelivery { + async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { + info!("Installing ContinuousDelivery feature"); + todo!() + } +} diff --git a/harmony/src/modules/application/features/endpoint.rs b/harmony/src/modules/application/features/endpoint.rs index b743e8a..f4940ed 100644 --- a/harmony/src/modules/application/features/endpoint.rs +++ b/harmony/src/modules/application/features/endpoint.rs @@ -1,7 +1,10 @@ use async_trait::async_trait; use log::info; -use crate::{modules::application::{Application, ApplicationFeature}, topology::{K8sclient, Topology}}; +use crate::{ + modules::application::ApplicationFeature, + topology::{K8sclient, Topology}, +}; #[derive(Debug)] pub struct PublicEndpoint { @@ -25,17 +28,12 @@ impl Default for PublicEndpoint { /// For now we only suport K8s ingress, but we will support more stuff at some point #[async_trait] -impl ApplicationFeature for PublicEndpoint { +impl ApplicationFeature for PublicEndpoint { async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { - info!("Making sure public endpoint is installed for port {}", self.application_port); - todo!() - } - - async fn is_installed(&self) -> Result { - todo!() - } - - async fn uninstall(&self) -> Result<(), String> { + info!( + "Making sure public endpoint is installed for port {}", + self.application_port + ); todo!() } } diff --git a/harmony/src/modules/application/features/mod.rs b/harmony/src/modules/application/features/mod.rs index 792946c..e58a814 100644 --- a/harmony/src/modules/application/features/mod.rs +++ b/harmony/src/modules/application/features/mod.rs @@ -1,102 +1,6 @@ mod endpoint; -use async_trait::async_trait; pub use endpoint::*; -use log::info; - -use crate::topology::{HelmCommand, Topology}; - -use super::ApplicationFeature; - -#[derive(Debug, Default)] -pub struct SoftwareQualityChecks {} - -#[async_trait] -impl ApplicationFeature for SoftwareQualityChecks { - // Either allow ApplicationFeature to self-install, which means passing Topology and Inventory - // here. This would be a very easy thing to be done reliably by the ApplicationInterpret. - // However, I feel like this would probably better be a list of Scores (or some sort of - // executable) to be orchestrated by the maestro. We will soon have to manage more complex - // lifecycles, dependencies, parallelism, etc. - // - // - // Or change the ApplicationFeature trait to a Score trait. - // - // For now I'll go with the first option - async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { - info!("Ensuring SoftwareQualityChecks are installed for application"); - todo!() - } - - async fn is_installed(&self) -> Result { - todo!() - } - - async fn uninstall(&self) -> Result<(), String> { - todo!() - } -} - -/// ContinuousDelivery in Harmony provides this functionality : -/// -/// - **Package** the application -/// - **Push** to an artifact registry -/// - **Deploy** to a testing environment -/// - **Deploy** to a production environment -/// -/// It is intended to be used as an application feature passed down to an ApplicationInterpret. For -/// example : -/// -/// ```rust -/// let app = RustApplicationScore { -/// name: "My Rust App".to_string(), -/// features: vec![ContinuousDelivery::default()], -/// }; -/// ``` -/// -/// *Note :* -/// -/// By default, the Harmony Opinionated Pipeline is built using these technologies : -/// -/// - Gitea Action (executes pipeline steps) -/// - Docker to build an OCI container image -/// - Helm chart to package Kubernetes resources -/// - Harbor as artifact registru -/// - ArgoCD to install/upgrade/rollback/inspect k8s resources -/// - Kubernetes for runtime orchestration -#[derive(Debug, Default)] -pub struct ContinuousDelivery {} - -#[async_trait] -impl ApplicationFeature for ContinuousDelivery { - async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { - info!("Installing ContinuousDelivery feature"); - todo!() - } - - async fn is_installed(&self) -> Result { - todo!() - } - - async fn uninstall(&self) -> Result<(), String> { - todo!() - } -} - -#[derive(Debug, Default)] -pub struct Monitoring {} - -#[async_trait] -impl ApplicationFeature for Monitoring { - async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { - info!("Ensuring monitoring is available for application"); - todo!("create and execute k8s prometheus score, depends on Will's work") - } - - async fn is_installed(&self) -> Result { - todo!() - } - - async fn uninstall(&self) -> Result<(), String> { - todo!() - } -} +mod monitoring; +pub use monitoring::*; +mod continuous_delivery; +pub use endpoint::*; diff --git a/harmony/src/modules/application/features/monitoring.rs b/harmony/src/modules/application/features/monitoring.rs new file mode 100644 index 0000000..dccfa88 --- /dev/null +++ b/harmony/src/modules/application/features/monitoring.rs @@ -0,0 +1,10 @@ +#[derive(Debug, Default)] +pub struct Monitoring {} + +#[async_trait] +impl ApplicationFeature for Monitoring { + async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { + info!("Ensuring monitoring is available for application"); + todo!("create and execute k8s prometheus score, depends on Will's work") + } +} diff --git a/harmony/src/modules/application/mod.rs b/harmony/src/modules/application/mod.rs index f428ce1..1d9b8b0 100644 --- a/harmony/src/modules/application/mod.rs +++ b/harmony/src/modules/application/mod.rs @@ -70,8 +70,6 @@ trait Application {} #[async_trait] pub trait ApplicationFeature: std::fmt::Debug + Send + Sync { async fn ensure_installed(&self, topology: &T) -> Result<(), String>; - async fn is_installed(&self) -> Result; - async fn uninstall(&self) -> Result<(), String>; } impl Serialize for Box> { @@ -97,12 +95,4 @@ impl ApplicationFeature for BackupFeature { async fn ensure_installed(&self, _topology: &T) -> Result<(), String> { todo!() } - - async fn is_installed(&self) -> Result { - todo!() - } - - async fn uninstall(&self) -> Result<(), String> { - todo!() - } }