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:
Jean-Gabriel Gill-Couture 2025-01-22 10:32:22 -05:00
parent 98c2ab169c
commit caec71f06d
5 changed files with 80 additions and 0 deletions

View 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!()
}
}

View File

@ -0,0 +1,3 @@
pub mod Resource;

View File

@ -4,3 +4,4 @@ pub mod okd;
pub mod load_balancer;
pub mod tftp;
pub mod http;
pub mod k8s;

View File

@ -3,4 +3,5 @@ pub mod dns;
pub mod load_balancer;
pub mod bootstrap_load_balancer;
pub mod bootstrap_dhcp;
pub mod upgrade;

View 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!()
// }
// }