From dc60695100a09d9cc7236bfb408ddb23eefe7439 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 3 Mar 2026 14:26:20 +0000 Subject: [PATCH] fix(k8s): copy configmap dirs for jobs-only stacks during deploy create The k8s configmap directory copying was inside the `for pod in pods:` loop. For jobs-only stacks (no pods), the loop never executes, so configmap files were never copied into the deployment directory. The ConfigMaps were created as empty objects, leaving volume mounts with no files. Move the k8s configmap copying outside the pod loop so it runs regardless of whether the stack has pods. Co-Authored-By: Claude Opus 4.6 --- .../deploy/deployment_create.py | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/stack_orchestrator/deploy/deployment_create.py b/stack_orchestrator/deploy/deployment_create.py index 0546f370..21e5ca48 100644 --- a/stack_orchestrator/deploy/deployment_create.py +++ b/stack_orchestrator/deploy/deployment_create.py @@ -985,17 +985,7 @@ def _write_deployment_files( script_paths = get_pod_script_paths(parsed_stack, pod) _copy_files_to_directory(script_paths, destination_script_dir) - if parsed_spec.is_kubernetes_deployment(): - for configmap in parsed_spec.get_configmaps(): - source_config_dir = resolve_config_dir(stack_name, configmap) - if os.path.exists(source_config_dir): - destination_config_dir = target_dir.joinpath( - "configmaps", configmap - ) - copytree( - source_config_dir, destination_config_dir, dirs_exist_ok=True - ) - else: + if not parsed_spec.is_kubernetes_deployment(): # TODO: # This is odd - looks up config dir that matches a volume name, # then copies as a mount dir? @@ -1017,6 +1007,19 @@ def _write_deployment_files( dirs_exist_ok=True, ) + # 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) + if os.path.exists(source_config_dir): + destination_config_dir = target_dir.joinpath( + "configmaps", configmap + ) + copytree( + source_config_dir, destination_config_dir, dirs_exist_ok=True + ) + # Copy the job files into the target dir jobs = get_job_list(parsed_stack) if jobs: