Align attach wording with existing-cluster mode

This commit is contained in:
andrussal 2026-03-08 15:06:38 +01:00
parent aa838ecca9
commit 1268607a68
6 changed files with 26 additions and 25 deletions

View File

@ -2,7 +2,7 @@ use async_trait::async_trait;
use crate::scenario::{Application, DynError, ExistingCluster};
/// Attached node discovered from an existing external cluster source.
/// Node discovered from an existing cluster descriptor.
#[derive(Clone, Debug)]
pub struct AttachedNode<E: Application> {
/// Optional stable identity hint used by runtime inventory dedup logic.
@ -14,7 +14,7 @@ pub struct AttachedNode<E: Application> {
/// Errors returned by attach providers while discovering attached nodes.
#[derive(Debug, thiserror::Error)]
pub enum AttachProviderError {
#[error("attach source is not supported by this provider: {attach_source:?}")]
#[error("existing cluster descriptor is not supported by this provider: {attach_source:?}")]
UnsupportedSource { attach_source: ExistingCluster },
#[error("attach discovery failed: {source}")]
Discovery {
@ -23,13 +23,13 @@ pub enum AttachProviderError {
},
}
/// Internal adapter interface for discovering pre-existing nodes.
/// Internal adapter interface for discovering nodes in an existing cluster.
///
/// This is scaffolding-only in phase 1 and is intentionally not wired into
/// deployer runtime orchestration yet.
#[async_trait]
pub trait AttachProvider<E: Application>: Send + Sync {
/// Discovers node clients for the requested attach source.
/// Discovers node clients for the requested existing cluster.
async fn discover(
&self,
source: &ExistingCluster,

View File

@ -176,12 +176,12 @@ impl<E: ComposeDeployEnv> ClusterWaitHandle<E> for ComposeAttachedClusterWait<E>
}
fn compose_wait_request(source: &ExistingCluster) -> Result<ComposeAttachRequest<'_>, DynError> {
let project = source
.compose_project()
.ok_or_else(|| DynError::from("compose cluster wait requires a compose attach source"))?;
let services = source
.compose_services()
.ok_or_else(|| DynError::from("compose cluster wait requires a compose attach source"))?;
let project = source.compose_project().ok_or_else(|| {
DynError::from("compose cluster wait requires a compose existing-cluster descriptor")
})?;
let services = source.compose_services().ok_or_else(|| {
DynError::from("compose cluster wait requires a compose existing-cluster descriptor")
})?;
Ok(ComposeAttachRequest { project, services })
}

View File

@ -73,9 +73,9 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
if matches!(scenario.cluster_mode(), ClusterMode::ExistingCluster) {
return self
.deploy_attached_only::<Caps>(scenario, source_plan)
.deploy_existing_cluster::<Caps>(scenario, source_plan)
.await
.map(|runner| (runner, attached_metadata(scenario)));
.map(|runner| (runner, existing_cluster_metadata(scenario)));
}
let deployment = scenario.deployment();
@ -138,7 +138,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
))
}
async fn deploy_attached_only<Caps>(
async fn deploy_existing_cluster<Caps>(
&self,
scenario: &Scenario<E, Caps>,
source_plan: SourceOrchestrationPlan,
@ -218,7 +218,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
let attach = scenario
.existing_cluster()
.ok_or(ComposeRunnerError::InternalInvariant {
message: "attached node control requested outside attached source mode",
message: "existing-cluster node control requested outside existing-cluster mode",
})?;
let node_control = ComposeAttachedNodeControl::try_from_existing_cluster(attach)
.map_err(|source| ComposeRunnerError::SourceOrchestration { source })?;
@ -236,7 +236,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
let attach = scenario
.existing_cluster()
.ok_or(ComposeRunnerError::InternalInvariant {
message: "compose attached cluster wait requested outside attached source mode",
message: "compose cluster wait requested outside existing-cluster mode",
})?;
let cluster_wait = ComposeAttachedClusterWait::<E>::try_new(compose_runner_host(), attach)
.map_err(|source| ComposeRunnerError::SourceOrchestration { source })?;
@ -366,7 +366,7 @@ impl<E: ComposeDeployEnv> DeploymentOrchestrator<E> {
}
}
fn attached_metadata<E, Caps>(scenario: &Scenario<E, Caps>) -> ComposeDeploymentMetadata
fn existing_cluster_metadata<E, Caps>(scenario: &Scenario<E, Caps>) -> ComposeDeploymentMetadata
where
E: ComposeDeployEnv,
Caps: Send + Sync,

View File

@ -155,7 +155,7 @@ impl<E: Application> NodeControlHandle<E> for ComposeNodeControl {
}
}
/// Node control handle for compose attached mode.
/// Node control handle for compose existing-cluster mode.
pub struct ComposeAttachedNodeControl {
pub(crate) project_name: String,
}

View File

@ -247,9 +247,9 @@ impl<E: K8sDeployEnv> ClusterWaitHandle<E> for K8sAttachedClusterWait<E> {
}
fn k8s_wait_request(source: &ExistingCluster) -> Result<K8sAttachRequest<'_>, DynError> {
let label_selector = source
.k8s_label_selector()
.ok_or_else(|| DynError::from("k8s cluster wait requires a k8s attach source"))?;
let label_selector = source.k8s_label_selector().ok_or_else(|| {
DynError::from("k8s cluster wait requires a k8s existing-cluster descriptor")
})?;
if label_selector.trim().is_empty() {
return Err(K8sAttachDiscoveryError::EmptyLabelSelector.into());

View File

@ -181,8 +181,9 @@ where
let observability = resolve_observability_inputs(scenario.capabilities())?;
if matches!(scenario.cluster_mode(), ClusterMode::ExistingCluster) {
let runner = deploy_attached_only::<E, Caps>(scenario, source_plan, observability).await?;
return Ok((runner, attached_metadata(scenario)));
let runner =
deploy_existing_cluster::<E, Caps>(scenario, source_plan, observability).await?;
return Ok((runner, existing_cluster_metadata(scenario)));
}
let deployment = build_k8s_deployment::<E, Caps>(deployer, scenario, &observability).await?;
@ -213,7 +214,7 @@ where
Ok((runner, metadata))
}
async fn deploy_attached_only<E, Caps>(
async fn deploy_existing_cluster<E, Caps>(
scenario: &Scenario<E, Caps>,
source_plan: SourceOrchestrationPlan,
observability: ObservabilityInputs,
@ -245,7 +246,7 @@ where
Ok(context.build_runner(Some(Box::new(feed_task))))
}
fn attached_metadata<E, Caps>(scenario: &Scenario<E, Caps>) -> K8sDeploymentMetadata
fn existing_cluster_metadata<E, Caps>(scenario: &Scenario<E, Caps>) -> K8sDeploymentMetadata
where
E: K8sDeployEnv,
Caps: Send + Sync,
@ -264,7 +265,7 @@ where
let attach = scenario
.existing_cluster()
.ok_or_else(|| K8sRunnerError::InternalInvariant {
message: "k8s attached cluster wait requested outside attached source mode".to_owned(),
message: "k8s cluster wait requested outside existing-cluster mode".to_owned(),
})?;
let cluster_wait = K8sAttachedClusterWait::<E>::try_new(client, attach)
.map_err(|source| K8sRunnerError::SourceOrchestration { source })?;