From 91f4e5fe38f784697baff517cc80f081d10afad5 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Tue, 10 Mar 2026 06:26:03 +0000 Subject: [PATCH] fix(k8s): use distinct app label for job pods Job pod templates used the same app={deployment_id} label as deployment pods, causing pods_in_deployment() to return both. This made the logs command warn about multiple pods and pick the wrong one. Use app={deployment_id}-job for job pod templates so they are not matched by pods_in_deployment(). The Job metadata itself retains the original app label for stack-level queries. Co-Authored-By: Claude Opus 4.6 --- stack_orchestrator/deploy/k8s/cluster_info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stack_orchestrator/deploy/k8s/cluster_info.py b/stack_orchestrator/deploy/k8s/cluster_info.py index 88fc5d3d..e773a346 100644 --- a/stack_orchestrator/deploy/k8s/cluster_info.py +++ b/stack_orchestrator/deploy/k8s/cluster_info.py @@ -710,7 +710,9 @@ class ClusterInfo: elif job_name.endswith(".yaml"): job_name = job_name[: -len(".yaml")] - pod_labels = {"app": self.app_name, **({"app.kubernetes.io/stack": self.stack_name} if self.stack_name else {})} + # Use a distinct app label for job pods so they don't get + # picked up by pods_in_deployment() which queries app={app_name}. + pod_labels = {"app": f"{self.app_name}-job", **({"app.kubernetes.io/stack": self.stack_name} if self.stack_name else {})} template = client.V1PodTemplateSpec( metadata=client.V1ObjectMeta( labels=pod_labels