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: