feat(k8s): add initial Resource module structure
Introduce the initial structure for the Kubernetes (K8s) resource module, including `K8sResourceScore` and `K8sResourceInterpret`. Additionally, update the module paths to include the new K8s module.
This commit is contained in:
parent
98c2ab169c
commit
caec71f06d
42
harmony-rs/harmony/src/modules/k8s/Resource.rs
Normal file
42
harmony-rs/harmony/src/modules/k8s/Resource.rs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
use async_trait::async_trait;
|
||||||
|
|
||||||
|
use crate::{data::{Id, Version}, interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome}, inventory::Inventory, score::Score, topology::HAClusterTopology};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct K8sResourceScore {}
|
||||||
|
|
||||||
|
impl Score for K8sResourceScore {
|
||||||
|
type InterpretType = K8sResourceInterpret;
|
||||||
|
|
||||||
|
fn create_interpret(self) -> Self::InterpretType {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct K8sResourceInterpret {
|
||||||
|
score: K8sResourceScore,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[async_trait]
|
||||||
|
impl Interpret for K8sResourceInterpret {
|
||||||
|
async fn execute(
|
||||||
|
&self,
|
||||||
|
inventory: &Inventory,
|
||||||
|
topology: &HAClusterTopology,
|
||||||
|
) -> Result<Outcome, InterpretError> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
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!()
|
||||||
|
}
|
||||||
|
}
|
3
harmony-rs/harmony/src/modules/k8s/mod.rs
Normal file
3
harmony-rs/harmony/src/modules/k8s/mod.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
pub mod Resource;
|
||||||
|
|
@ -4,3 +4,4 @@ pub mod okd;
|
|||||||
pub mod load_balancer;
|
pub mod load_balancer;
|
||||||
pub mod tftp;
|
pub mod tftp;
|
||||||
pub mod http;
|
pub mod http;
|
||||||
|
pub mod k8s;
|
||||||
|
@ -3,4 +3,5 @@ pub mod dns;
|
|||||||
pub mod load_balancer;
|
pub mod load_balancer;
|
||||||
pub mod bootstrap_load_balancer;
|
pub mod bootstrap_load_balancer;
|
||||||
pub mod bootstrap_dhcp;
|
pub mod bootstrap_dhcp;
|
||||||
|
pub mod upgrade;
|
||||||
|
|
||||||
|
33
harmony-rs/harmony/src/modules/okd/upgrade.rs
Normal file
33
harmony-rs/harmony/src/modules/okd/upgrade.rs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
use crate::{data::Version, score::Score};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct OKDUpgradeScore {
|
||||||
|
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(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// impl Score for OKDUpgradeScore {
|
||||||
|
// type InterpretType;
|
||||||
|
//
|
||||||
|
// fn create_interpret(self) -> Self::InterpretType {
|
||||||
|
// // Should this be a specialized interpret for OKD upgrades or rather a set of interprets
|
||||||
|
// // such as :
|
||||||
|
// //
|
||||||
|
// // MultiStageInterpret :
|
||||||
|
// // stages : vec![
|
||||||
|
// // vec![CheckOperatorsUpgraded, CheckClusterHealthy, CheckOtherPrecondition],
|
||||||
|
// // vec![PerformUpgrade],
|
||||||
|
// // vec![VerifyUpgrade, CheckClusterHealth],
|
||||||
|
// // ]
|
||||||
|
// todo!()
|
||||||
|
// }
|
||||||
|
// }
|
Loading…
Reference in New Issue
Block a user