This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 5337b057d1c cncf-kubernetes: fix potential race condition in 
trigger_reentry flow caused by `is_istio_enabled` (#69269)
5337b057d1c is described below

commit 5337b057d1c3a463a20bb90fa8168e37597dbc3a
Author: Noah Gil <[email protected]>
AuthorDate: Sun Jul 19 18:06:49 2026 -0400

    cncf-kubernetes: fix potential race condition in trigger_reentry flow 
caused by `is_istio_enabled` (#69269)
    
    * Gracefully return istio check if pod is removed
    
    This is meant to catch a potential race condition in the
    `trigger_reentry` flow. There is already a check that the pod still
    exists in the event of a success, but it is still possible for the pod
    to be removed during the first and second API read. Should this happen,
    we should return the same way as if no pod was provided to the function.
    
    * Add log for missing pod in istio check
    
    ---------
    
    Co-authored-by: Przemysław Mirowski 
<[email protected]>
---
 .../src/airflow/providers/cncf/kubernetes/operators/pod.py  | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git 
a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py
 
b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py
index b5843fee268..18062c71526 100644
--- 
a/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py
+++ 
b/providers/cncf/kubernetes/src/airflow/providers/cncf/kubernetes/operators/pod.py
@@ -1341,7 +1341,18 @@ class KubernetesPodOperator(BaseOperator):
         if not pod:
             return False
 
-        remote_pod = self.pod_manager.read_pod(pod)
+        try:
+            remote_pod = self.pod_manager.read_pod(pod)
+        except ApiException as e:
+            if e.status == 404:
+                # Pod was likely GC'd between the trigger firing and re-entry
+                log.warning(
+                    "Pod %s/%s not found during istio check.",
+                    pod.metadata.namespace,
+                    pod.metadata.name,
+                )
+                return False
+            raise e
 
         return any(container.name == self.ISTIO_CONTAINER_NAME for container 
in remote_pod.spec.containers)
 

Reply via email to