amoghrajesh commented on code in PR #62129:
URL: https://github.com/apache/airflow/pull/62129#discussion_r2851121757


##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/cli/kubernetes_command.py:
##########
@@ -199,3 +199,16 @@ def _delete_pod(name, namespace):
     print(f'Deleting POD "{name}" from "{namespace}" namespace')
     api_response = kube_client.delete_namespaced_pod(name=name, 
namespace=namespace, body=delete_options)
     print(api_response)
+    _delete_workload_secret(name, namespace)
+
+
+def _delete_workload_secret(pod_name, namespace):
+    """Delete the workload secret associated with a pod if it exists."""
+    kube_client = get_kube_client()
+    secret_name = f"airflow-workload-{pod_name}"
+    try:
+        kube_client.delete_namespaced_secret(name=secret_name, 
namespace=namespace)
+        print(f'Deleted workload secret "{secret_name}" from "{namespace}" 
namespace')
+    except ApiException as e:
+        if str(e.status) != "404":

Review Comment:
   Handled here: 0fa0a3aec9e123fd618ae821866ca50f73457ea5



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py:
##########
@@ -553,12 +558,38 @@ def run_next(self, next_job: KubernetesJob) -> None:
         pod_template_file = next_job.pod_template_file
 
         dag_id, task_id, run_id, try_number, map_index = key
+
+        pod_id = create_unique_id(dag_id, task_id)
+        secret_name = ""

Review Comment:
   Handled here: 0fa0a3aec9e123fd618ae821866ca50f73457ea5



##########
providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py:
##########
@@ -588,7 +619,9 @@ def run_next(self, next_job: KubernetesJob) -> None:
             pod_override_object=kube_executor_config,
             base_worker_pod=base_worker_pod,
             with_mutation_hook=True,
+            workload_secret_name=secret_name or None,

Review Comment:
   0fa0a3aec9e123fd618ae821866ca50f73457ea5



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to