Compare commits
5 Commits
bfca9cf163
...
feat/ceph-
| Author | SHA1 | Date | |
|---|---|---|---|
| ac7fd53d5e | |||
| 5895f867cf | |||
| d36c574590 | |||
| 72fb05b5cc | |||
| 6685b05cc5 |
5
Cargo.lock
generated
5
Cargo.lock
generated
@@ -105,7 +105,7 @@ dependencies = [
|
|||||||
"futures-core",
|
"futures-core",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"mio 1.0.4",
|
"mio 1.0.4",
|
||||||
"socket2",
|
"socket2 0.5.10",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
@@ -167,7 +167,7 @@ dependencies = [
|
|||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_urlencoded",
|
"serde_urlencoded",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"socket2",
|
"socket2 0.5.10",
|
||||||
"time",
|
"time",
|
||||||
"tracing",
|
"tracing",
|
||||||
"url",
|
"url",
|
||||||
@@ -2178,7 +2178,6 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"sysinfo",
|
"sysinfo",
|
||||||
"uuid",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM docker.io/rust:1.87.0 AS build
|
FROM docker.io/rust:1.89.0 AS build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ COPY . .
|
|||||||
|
|
||||||
RUN cargo build --release --bin harmony_composer
|
RUN cargo build --release --bin harmony_composer
|
||||||
|
|
||||||
FROM docker.io/rust:1.87.0
|
FROM docker.io/rust:1.89.0
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
81
harmony/src/modules/storage/ceph/rook_ceph_install_score.rs
Normal file
81
harmony/src/modules/storage/ceph/rook_ceph_install_score.rs
Normal file
@@ -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<T: Topology + HelmCommand> Score<T> for RookCephInstall {
|
||||||
|
fn name(&self) -> String {
|
||||||
|
"RookCephInstall".to_string()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_interpret(&self) -> Box<dyn Interpret<T>> {
|
||||||
|
Box::new(RookCephInstallInterpret {
|
||||||
|
score: self.score.clone(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct RookCephInstallInterpret {
|
||||||
|
score: RookCephInstall,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl<T: Topology + HelmCommand> Interpret<T> for RookCephInstallInterpret {
|
||||||
|
async fn execute(
|
||||||
|
&self,
|
||||||
|
inventory: &Inventory,
|
||||||
|
topology: &T,
|
||||||
|
) -> Result<InterpretError, Outcome> {
|
||||||
|
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<Id> {
|
||||||
|
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!()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,4 +10,3 @@ serde.workspace = true
|
|||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
env_logger.workspace = true
|
env_logger.workspace = true
|
||||||
uuid.workspace = true
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,16 @@ mod hwinfo;
|
|||||||
async fn inventory() -> impl Responder {
|
async fn inventory() -> impl Responder {
|
||||||
log::info!("Received inventory request");
|
log::info!("Received inventory request");
|
||||||
let host = PhysicalHost::gather();
|
let host = PhysicalHost::gather();
|
||||||
log::info!("Inventory data gathered successfully");
|
match host {
|
||||||
actix_web::HttpResponse::Ok().json(host)
|
Ok(host) => {
|
||||||
|
log::info!("Inventory data gathered successfully");
|
||||||
|
actix_web::HttpResponse::Ok().json(host)
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
log::error!("Inventory data gathering FAILED");
|
||||||
|
actix_web::HttpResponse::InternalServerError().json(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[actix_web::main]
|
#[actix_web::main]
|
||||||
|
|||||||
Reference in New Issue
Block a user