From 50fd116ead9a4884df2c94eb3c08f67ad6ceb4f1 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 3 Mar 2026 14:13:46 +0000 Subject: [PATCH] fix(k8s): include job volumes in PVC/ConfigMap/PV creation For jobs-only stacks, named_volumes_from_pod_files() returned empty because it only scanned parsed_pod_yaml_map. This caused ConfigMaps and PVCs declared in the spec to be silently skipped. - Add _all_named_volumes() helper that scans both pod and job maps - Guard update() against empty parsed_pod_yaml_map (uncaught 404) Co-Authored-By: Claude Opus 4.6 --- stack_orchestrator/deploy/k8s/cluster_info.py | 12 +++++++++--- stack_orchestrator/deploy/k8s/deploy_k8s.py | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/stack_orchestrator/deploy/k8s/cluster_info.py b/stack_orchestrator/deploy/k8s/cluster_info.py index 1f7e464e..bc46c0c0 100644 --- a/stack_orchestrator/deploy/k8s/cluster_info.py +++ b/stack_orchestrator/deploy/k8s/cluster_info.py @@ -101,6 +101,12 @@ class ClusterInfo: if opts.o.debug: print(f"Parsed job yaml map: {self.parsed_job_yaml_map}") + def _all_named_volumes(self) -> list: + """Return named volumes from both pod and job compose files.""" + volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map) + volumes.extend(named_volumes_from_pod_files(self.parsed_job_yaml_map)) + return volumes + def get_nodeports(self): nodeports = [] for pod_name in self.parsed_pod_yaml_map: @@ -264,7 +270,7 @@ class ClusterInfo: def get_pvcs(self): result = [] spec_volumes = self.spec.get_volumes() - named_volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map) + named_volumes = self._all_named_volumes() resources = self.spec.get_volume_resources() if not resources: resources = DEFAULT_VOLUME_RESOURCES @@ -308,7 +314,7 @@ class ClusterInfo: def get_configmaps(self): result = [] spec_configmaps = self.spec.get_configmaps() - named_volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map) + named_volumes = self._all_named_volumes() for cfg_map_name, cfg_map_path in spec_configmaps.items(): if cfg_map_name not in named_volumes: if opts.o.debug: @@ -344,7 +350,7 @@ class ClusterInfo: def get_pvs(self): result = [] spec_volumes = self.spec.get_volumes() - named_volumes = named_volumes_from_pod_files(self.parsed_pod_yaml_map) + named_volumes = self._all_named_volumes() resources = self.spec.get_volume_resources() if not resources: resources = DEFAULT_VOLUME_RESOURCES diff --git a/stack_orchestrator/deploy/k8s/deploy_k8s.py b/stack_orchestrator/deploy/k8s/deploy_k8s.py index 90ad7655..55513d6e 100644 --- a/stack_orchestrator/deploy/k8s/deploy_k8s.py +++ b/stack_orchestrator/deploy/k8s/deploy_k8s.py @@ -632,6 +632,10 @@ class K8sDeployer(Deployer): return log_stream_from_string(log_data) def update(self): + if not self.cluster_info.parsed_pod_yaml_map: + if opts.o.debug: + print("No pods defined, skipping update") + return self.connect_api() ref_deployment = self.cluster_info.get_deployment() if not ref_deployment or not ref_deployment.metadata: