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: