From ce5e5ea6ab6ff3bffb830bb5e6f23fd06d56a138 Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 25 Aug 2025 13:39:58 -0400 Subject: [PATCH] fix: added example of usage, fixed formatting --- examples/remove_rook_osd/Cargo.toml | 12 ++++++++++++ examples/remove_rook_osd/src/main.rs | 18 ++++++++++++++++++ ...ement_score.rs => ceph_remove_osd_score.rs} | 4 ++-- harmony/src/modules/storage/ceph/mod.rs | 2 +- 4 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 examples/remove_rook_osd/Cargo.toml create mode 100644 examples/remove_rook_osd/src/main.rs rename harmony/src/modules/storage/ceph/{ceph_osd_replacement_score.rs => ceph_remove_osd_score.rs} (99%) diff --git a/examples/remove_rook_osd/Cargo.toml b/examples/remove_rook_osd/Cargo.toml new file mode 100644 index 0000000..23f3365 --- /dev/null +++ b/examples/remove_rook_osd/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "example_remove_rook_osd" +edition = "2024" +version.workspace = true +readme.workspace = true +license.workspace = true + +[dependencies] +harmony = { version = "0.1.0", path = "../../harmony" } +harmony_cli = { version = "0.1.0", path = "../../harmony_cli" } +harmony_tui = { version = "0.1.0", path = "../../harmony_tui" } +tokio.workspace = true diff --git a/examples/remove_rook_osd/src/main.rs b/examples/remove_rook_osd/src/main.rs new file mode 100644 index 0000000..2794927 --- /dev/null +++ b/examples/remove_rook_osd/src/main.rs @@ -0,0 +1,18 @@ +use harmony::{ + inventory::Inventory, modules::storage::ceph::ceph_remove_osd_score::CephRemoveOsd, + topology::K8sAnywhereTopology, +}; + +#[tokio::main] +async fn main() { + let ceph_score = CephRemoveOsd { + osd_deployment_name: "rook-ceph-osd-2".to_string(), + rook_ceph_namespace: "rook-ceph".to_string(), + }; + + let topology = K8sAnywhereTopology::from_env(); + let inventory = Inventory::autoload(); + harmony_cli::run(inventory, topology, vec![Box::new(ceph_score)], None) + .await + .unwrap(); +} diff --git a/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs b/harmony/src/modules/storage/ceph/ceph_remove_osd_score.rs similarity index 99% rename from harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs rename to harmony/src/modules/storage/ceph/ceph_remove_osd_score.rs index a4b0cb0..1fc011d 100644 --- a/harmony/src/modules/storage/ceph/ceph_osd_replacement_score.rs +++ b/harmony/src/modules/storage/ceph/ceph_remove_osd_score.rs @@ -19,8 +19,8 @@ use crate::{ #[derive(Debug, Clone, Serialize)] pub struct CephRemoveOsd { - osd_deployment_name: String, - rook_ceph_namespace: String, + pub osd_deployment_name: String, + pub rook_ceph_namespace: String, } impl Score for CephRemoveOsd { diff --git a/harmony/src/modules/storage/ceph/mod.rs b/harmony/src/modules/storage/ceph/mod.rs index a993c3d..a8ea82d 100644 --- a/harmony/src/modules/storage/ceph/mod.rs +++ b/harmony/src/modules/storage/ceph/mod.rs @@ -1 +1 @@ -pub mod ceph_osd_replacement_score; +pub mod ceph_remove_osd_score;