diff --git a/harmony/src/modules/storage/ceph/mod.rs b/harmony/src/modules/storage/ceph/mod.rs index a993c3d..546a775 100644 --- a/harmony/src/modules/storage/ceph/mod.rs +++ b/harmony/src/modules/storage/ceph/mod.rs @@ -1 +1,4 @@ -pub mod ceph_osd_replacement_score; +pub mod ceph_remove_osd_score; +pub mod rook_ceph_helm_chart_score; +pub mod rook_ceph_cluster_helm_chart_score; +pub mod rook_ceph_install_score; diff --git a/harmony/src/modules/storage/ceph/rook_ceph_cluster_helm_chart_score.rs b/harmony/src/modules/storage/ceph/rook_ceph_cluster_helm_chart_score.rs new file mode 100644 index 0000000..8ac4970 --- /dev/null +++ b/harmony/src/modules/storage/ceph/rook_ceph_cluster_helm_chart_score.rs @@ -0,0 +1,44 @@ + +use std::str::FromStr; + +use non_blank_string_rs::NonBlankString; + +use crate::modules::helm::chart::HelmChartScore; + +pub fn rook_ceph_cluster_helm_chart(ns: &str) -> HelmChartScore { + let values = r#" +monitoring: + enabled: true + createPrometheusRules: true +cephClusterSpec: + placement: + all: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: storage-node + operator: In + values: + - "true" +dashboard: + ssl: false + prometheusEndpoint: http://prometheus-operated:9090 + prometheusEndpointSSLVerify: false +toolbox: + enabled: true + + "# + .to_string(); + HelmChartScore { + namespace: Some(NonBlankString::from_str(ns).unwrap()), + release_name: NonBlankString::from_str("rook-ceph").unwrap(), + chart_name: NonBlankString::from_str("https://charts.rook.io/release/rook-release/rook-ceph-cluster").unwrap(), + chart_version: todo!(), + values_overrides: todo!(), + values_yaml: Some(values.to_string()), + create_namespace: todo!(), + install_only: todo!(), + repository: todo!(), + } +} diff --git a/harmony/src/modules/storage/ceph/rook_ceph_helm_chart_score.rs b/harmony/src/modules/storage/ceph/rook_ceph_helm_chart_score.rs new file mode 100644 index 0000000..9256045 --- /dev/null +++ b/harmony/src/modules/storage/ceph/rook_ceph_helm_chart_score.rs @@ -0,0 +1,24 @@ +use std::str::FromStr; + +use non_blank_string_rs::NonBlankString; + +use crate::modules::helm::chart::HelmChartScore; + +pub fn rook_ceph_helm_chart(ns: &str) -> HelmChartScore { + let values = r#" +monitoring: + enabled: true + "# + .to_string(); + HelmChartScore { + namespace: Some(NonBlankString::from_str(ns).unwrap()), + release_name: NonBlankString::from_str("rook-ceph").unwrap(), + chart_name: NonBlankString::from_str("https://charts.rook.io/release/rook-release/rook-ceph").unwrap(), + chart_version: todo!(), + values_overrides: todo!(), + values_yaml: Some(values.to_string()), + create_namespace: todo!(), + install_only: todo!(), + repository: todo!(), + } +} diff --git a/harmony/src/modules/storage/ceph/rook_ceph_install_score.rs b/harmony/src/modules/storage/ceph/rook_ceph_install_score.rs new file mode 100644 index 0000000..fbb7f03 --- /dev/null +++ b/harmony/src/modules/storage/ceph/rook_ceph_install_score.rs @@ -0,0 +1,81 @@ +use serde::Serialize; + +use crate::{ + data::{Id, Version}, + interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome}, + inventory::Inventory, + score::Score, + topology::{HelmCommand, Topology}, +}; + +#[derive(Debug, Clone, Serialize)] +pub struct RookCephInstall { + namespace: String, +} + +impl Score for RookCephInstall { + fn name(&self) -> String { + "RookCephInstall".to_string() + } + + fn create_interpret(&self) -> Box> { + Box::new(RookCephInstallInterpret { + score: self.score.clone(), + }) + } +} + +#[derive(Debug, Clone)] +pub struct RookCephInstallInterpret { + score: RookCephInstall, +} + +#[async_trait] +impl Interpret for RookCephInstallInterpret { + async fn execute( + &self, + inventory: &Inventory, + topology: &T, + ) -> Result { + self.label_nodes(); + self.install_rook_helm_chart(self.score.namespace); + self.install_rook_cluster_helm_chart(self.score.namespace); + //TODO I think we will need to add a capability OCClient to interact with the okd + //cli tool + self.add_oc_adm_policy(self.score.namespace); + } + + fn get_name(&self) -> InterpretName { + todo!() + } + + fn get_version(&self) -> Version { + todo!() + } + + fn get_status(&self) -> InterpretStatus { + todo!() + } + + fn get_children(&self) -> Vec { + todo!() + } +} + +impl RookCephInstallInterpret { + fn label_nodes(&self) -> _ { + todo!() + } + + fn install_rook_helm_chart(&self, namespace: String) -> _ { + todo!() + } + + fn install_rook_cluster_helm_chart(&self, namespace: String) -> _ { + todo!() + } + + fn add_oc_adm_policy(&self, namespace: String) -> _ { + todo!() + } +}