From 577576fd6975115375b672f1963f4e8d7f502056 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Wed, 11 Mar 2026 06:01:16 +0000 Subject: [PATCH] Add app label to Deployment metadata for label-based cleanup Deployments were the only resource type missing the `app` label on their metadata. Services, ConfigMaps, PVCs, and Jobs all had it. Without it, _delete_resources_by_label() in down() couldn't find Deployments when cleaning up in a shared namespace. Co-Authored-By: Claude Opus 4.6 --- stack_orchestrator/deploy/k8s/cluster_info.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stack_orchestrator/deploy/k8s/cluster_info.py b/stack_orchestrator/deploy/k8s/cluster_info.py index 1f6d14f2..d1a9e72d 100644 --- a/stack_orchestrator/deploy/k8s/cluster_info.py +++ b/stack_orchestrator/deploy/k8s/cluster_info.py @@ -687,7 +687,10 @@ class ClusterInfo: deployment = client.V1Deployment( api_version="apps/v1", kind="Deployment", - metadata=client.V1ObjectMeta(name=f"{self.app_name}-deployment"), + metadata=client.V1ObjectMeta( + name=f"{self.app_name}-deployment", + labels={"app": self.app_name, **({"app.kubernetes.io/stack": self.stack_name} if self.stack_name else {})}, + ), spec=spec, ) return deployment