From 0bdba4e8225be01ba1eda779b754eab76d12c943 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 14 Apr 2026 05:20:31 +0000 Subject: [PATCH] Fix configmap source path resolution from spec values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Spec configmaps with explicit paths (e.g. "stack-orchestrator/compose/maintenance") were ignored — only the key name was used to look up under config/. Now resolves the spec value relative to the stack root when provided. Values starting with ./ (auto-discovered by deploy init) still use the existing config/ directory convention. Co-Authored-By: Claude Opus 4.6 (1M context) --- stack_orchestrator/deploy/deployment_create.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/stack_orchestrator/deploy/deployment_create.py b/stack_orchestrator/deploy/deployment_create.py index 65dbd5b5..5dd8bcef 100644 --- a/stack_orchestrator/deploy/deployment_create.py +++ b/stack_orchestrator/deploy/deployment_create.py @@ -1110,10 +1110,20 @@ def _write_deployment_files( # Copy configmap directories for k8s deployments (outside the pod loop # so this works for jobs-only stacks too) if parsed_spec.is_kubernetes_deployment(): - for configmap in parsed_spec.get_configmaps(): - source_config_dir = resolve_config_dir(stack_name, configmap) + configmaps = parsed_spec.get_configmaps() + for configmap_name, configmap_path in configmaps.items(): + # Spec values starting with ./ are deployment-dir destination + # paths (written by deploy init for auto-discovered configmaps). + # Other values are source paths relative to the stack root + # (user-defined in spec.yml). Fall back to the config/ dir + # convention if no value is provided. + if configmap_path and not str(configmap_path).startswith("./"): + stack_root = Path(get_stack_path(stack_name)).parent.parent + source_config_dir = stack_root / configmap_path + else: + source_config_dir = resolve_config_dir(stack_name, configmap_name) if os.path.exists(source_config_dir): - destination_config_dir = target_dir.joinpath("configmaps", configmap) + destination_config_dir = target_dir.joinpath("configmaps", configmap_name) copytree(source_config_dir, destination_config_dir, dirs_exist_ok=True) # Copy the job files into the target dir