fix(k8s): run mount compatibility check on skip-cluster-management path too

The mount-compatibility check lived inside create_cluster(), which only
runs under --perform-cluster-management. Under the (default)
--skip-cluster-management path the check was skipped — a deployment
joining an existing cluster with an incompatible kind-config would
proceed and silently fall through to the node's overlay FS, which is
exactly the failure mode the check was designed to catch.

Rename _check_mounts_compatible → check_mounts_compatible (now public)
and call it from both paths in _setup_cluster().

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
pull/748/head
Prathamesh Musale 2026-04-20 10:08:31 +00:00
parent 6ccbb4713b
commit 1e274610d6
2 changed files with 9 additions and 2 deletions

View File

@ -26,6 +26,7 @@ from stack_orchestrator.deploy.deployer import (
DeployerException, DeployerException,
) )
from stack_orchestrator.deploy.k8s.helpers import ( from stack_orchestrator.deploy.k8s.helpers import (
check_mounts_compatible,
create_cluster, create_cluster,
destroy_cluster, destroy_cluster,
get_kind_cluster, get_kind_cluster,
@ -818,6 +819,12 @@ class K8sDeployer(Deployer):
"fresh cluster (note: destroys the existing one if " "fresh cluster (note: destroys the existing one if "
"names collide)." "names collide)."
) )
# Mount topology applies regardless of who owns cluster
# lifecycle — validate here too.
kind_config = str(
self.deployment_dir.joinpath(constants.kind_config_filename)
)
check_mounts_compatible(existing, kind_config)
self.connect_api() self.connect_api()
self._ensure_namespace() self._ensure_namespace()
if self.is_kind() and not self.skip_cluster_management: if self.is_kind() and not self.skip_cluster_management:

View File

@ -278,7 +278,7 @@ def _get_running_cluster_mounts(cluster_name: str) -> Dict[str, str]:
} }
def _check_mounts_compatible(cluster_name: str, config_file: str) -> None: def check_mounts_compatible(cluster_name: str, config_file: str) -> None:
"""Fail if the new deployment's extraMounts aren't active on the cluster. """Fail if the new deployment's extraMounts aren't active on the cluster.
Kind applies extraMounts only at cluster creation. When a deployment Kind applies extraMounts only at cluster creation. When a deployment
@ -370,7 +370,7 @@ def create_cluster(name: str, config_file: str):
existing = get_kind_cluster() existing = get_kind_cluster()
if existing: if existing:
print(f"Using existing cluster: {existing}") print(f"Using existing cluster: {existing}")
_check_mounts_compatible(existing, config_file) check_mounts_compatible(existing, config_file)
return existing return existing
_warn_if_no_umbrella(config_file) _warn_if_no_umbrella(config_file)