This commit is contained in:
parent
e7917843bc
commit
624e4330bb
@ -6,6 +6,7 @@ use log::{info, warn};
|
|||||||
use tokio::sync::OnceCell;
|
use tokio::sync::OnceCell;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
executors::ExecutorError,
|
||||||
interpret::{InterpretError, Outcome},
|
interpret::{InterpretError, Outcome},
|
||||||
inventory::Inventory,
|
inventory::Inventory,
|
||||||
maestro::Maestro,
|
maestro::Maestro,
|
||||||
@ -13,7 +14,11 @@ use crate::{
|
|||||||
topology::LocalhostTopology,
|
topology::LocalhostTopology,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{HelmCommand, K8sclient, Topology, k8s::K8sClient};
|
use super::{
|
||||||
|
HelmCommand, K8sclient, Topology,
|
||||||
|
k8s::K8sClient,
|
||||||
|
tenant::{ResourceLimits, TenantConfig, TenantManager, TenantNetworkPolicy},
|
||||||
|
};
|
||||||
|
|
||||||
struct K8sState {
|
struct K8sState {
|
||||||
client: Arc<K8sClient>,
|
client: Arc<K8sClient>,
|
||||||
@ -21,6 +26,7 @@ struct K8sState {
|
|||||||
message: String,
|
message: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
enum K8sSource {
|
enum K8sSource {
|
||||||
LocalK3d,
|
LocalK3d,
|
||||||
Kubeconfig,
|
Kubeconfig,
|
||||||
@ -209,3 +215,81 @@ impl Topology for K8sAnywhereTopology {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl HelmCommand for K8sAnywhereTopology {}
|
impl HelmCommand for K8sAnywhereTopology {}
|
||||||
|
|
||||||
|
impl TenantManager for K8sAnywhereTopology {
|
||||||
|
fn provision_tenant<'life0, 'life1, 'async_trait>(
|
||||||
|
&'life0 self,
|
||||||
|
config: &'life1 TenantConfig,
|
||||||
|
) -> ::core::pin::Pin<
|
||||||
|
Box<
|
||||||
|
dyn ::core::future::Future<Output = Result<(), ExecutorError>>
|
||||||
|
+ ::core::marker::Send
|
||||||
|
+ 'async_trait,
|
||||||
|
>,
|
||||||
|
>
|
||||||
|
where
|
||||||
|
'life0: 'async_trait,
|
||||||
|
'life1: 'async_trait,
|
||||||
|
Self: 'async_trait,
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_tenant_resource_limits<'life0, 'life1, 'life2, 'async_trait>(
|
||||||
|
&'life0 self,
|
||||||
|
tenant_name: &'life1 str,
|
||||||
|
new_limits: &'life2 ResourceLimits,
|
||||||
|
) -> ::core::pin::Pin<
|
||||||
|
Box<
|
||||||
|
dyn ::core::future::Future<Output = Result<(), ExecutorError>>
|
||||||
|
+ ::core::marker::Send
|
||||||
|
+ 'async_trait,
|
||||||
|
>,
|
||||||
|
>
|
||||||
|
where
|
||||||
|
'life0: 'async_trait,
|
||||||
|
'life1: 'async_trait,
|
||||||
|
'life2: 'async_trait,
|
||||||
|
Self: 'async_trait,
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update_tenant_network_policy<'life0, 'life1, 'life2, 'async_trait>(
|
||||||
|
&'life0 self,
|
||||||
|
tenant_name: &'life1 str,
|
||||||
|
new_policy: &'life2 TenantNetworkPolicy,
|
||||||
|
) -> ::core::pin::Pin<
|
||||||
|
Box<
|
||||||
|
dyn ::core::future::Future<Output = Result<(), ExecutorError>>
|
||||||
|
+ ::core::marker::Send
|
||||||
|
+ 'async_trait,
|
||||||
|
>,
|
||||||
|
>
|
||||||
|
where
|
||||||
|
'life0: 'async_trait,
|
||||||
|
'life1: 'async_trait,
|
||||||
|
'life2: 'async_trait,
|
||||||
|
Self: 'async_trait,
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn deprovision_tenant<'life0, 'life1, 'async_trait>(
|
||||||
|
&'life0 self,
|
||||||
|
tenant_name: &'life1 str,
|
||||||
|
) -> ::core::pin::Pin<
|
||||||
|
Box<
|
||||||
|
dyn ::core::future::Future<Output = Result<(), ExecutorError>>
|
||||||
|
+ ::core::marker::Send
|
||||||
|
+ 'async_trait,
|
||||||
|
>,
|
||||||
|
>
|
||||||
|
where
|
||||||
|
'life0: 'async_trait,
|
||||||
|
'life1: 'async_trait,
|
||||||
|
Self: 'async_trait,
|
||||||
|
{
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use async_trait::async_trait;
|
|||||||
use crate::executors::ExecutorError;
|
use crate::executors::ExecutorError;
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait TenantManager: Send + Sync + std::fmt::Debug {
|
pub trait TenantManager {
|
||||||
/// Provisions a new tenant based on the provided configuration.
|
/// Provisions a new tenant based on the provided configuration.
|
||||||
/// This operation should be idempotent; if a tenant with the same `config.name`
|
/// This operation should be idempotent; if a tenant with the same `config.name`
|
||||||
/// already exists and matches the config, it will succeed without changes.
|
/// already exists and matches the config, it will succeed without changes.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user