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)