From 1e274610d6bf1d2cfcd3b0994b61b2b096ce502c Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 20 Apr 2026 10:08:31 +0000 Subject: [PATCH] fix(k8s): run mount compatibility check on skip-cluster-management path too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- stack_orchestrator/deploy/k8s/deploy_k8s.py | 7 +++++++ stack_orchestrator/deploy/k8s/helpers.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/stack_orchestrator/deploy/k8s/deploy_k8s.py b/stack_orchestrator/deploy/k8s/deploy_k8s.py index 48bd7771..9f187dd0 100644 --- a/stack_orchestrator/deploy/k8s/deploy_k8s.py +++ b/stack_orchestrator/deploy/k8s/deploy_k8s.py @@ -26,6 +26,7 @@ from stack_orchestrator.deploy.deployer import ( DeployerException, ) from stack_orchestrator.deploy.k8s.helpers import ( + check_mounts_compatible, create_cluster, destroy_cluster, get_kind_cluster, @@ -818,6 +819,12 @@ class K8sDeployer(Deployer): "fresh cluster (note: destroys the existing one if " "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._ensure_namespace() if self.is_kind() and not self.skip_cluster_management: diff --git a/stack_orchestrator/deploy/k8s/helpers.py b/stack_orchestrator/deploy/k8s/helpers.py index 1864bbf1..03aa5ed7 100644 --- a/stack_orchestrator/deploy/k8s/helpers.py +++ b/stack_orchestrator/deploy/k8s/helpers.py @@ -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. 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() if existing: print(f"Using existing cluster: {existing}") - _check_mounts_compatible(existing, config_file) + check_mounts_compatible(existing, config_file) return existing _warn_if_no_umbrella(config_file)