fix(k8s): skip Deployment creation for jobs-only stacks

When a stack defines only jobs: (no pods:), the parsed_pod_yaml_map
is empty. Creating a Deployment with no containers causes a 422 error
from the k8s API. Skip Deployment creation when there are no pods.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
feature/k8s-jobs
Prathamesh Musale 2026-03-03 14:02:59 +00:00
parent f997378c04
commit 8f0ebb22fa
1 changed files with 5 additions and 0 deletions

View File

@ -263,6 +263,11 @@ class K8sDeployer(Deployer):
print(f"{cfg_rsp}")
def _create_deployment(self):
# Skip if there are no pods to deploy (e.g. jobs-only stacks)
if not self.cluster_info.parsed_pod_yaml_map:
if opts.o.debug:
print("No pods defined, skipping Deployment creation")
return
# Process compose files into a Deployment
deployment = self.cluster_info.get_deployment(
image_pull_policy=None if self.is_kind() else "Always"