From 31f04ecc835a3d8415662833523545e1ad0e66fd Mon Sep 17 00:00:00 2001 From: Noah Gil Date: Thu, 2 Jul 2026 12:44:41 -0400 Subject: [PATCH 1/2] 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. --- .../src/airflow/providers/cncf/kubernetes/operators/pod.py | 7 ++++++- 1 file changed, 6 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 9f59fcb66d368..0cbc1227e5f41 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 @@ -1337,7 +1337,12 @@ def is_istio_enabled(self, pod: V1Pod) -> bool: 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: + return False + raise e return any(container.name == self.ISTIO_CONTAINER_NAME for container in remote_pod.spec.containers) From ebf25d9b375082a88037be9f8f444379b74094cc Mon Sep 17 00:00:00 2001 From: Noah Gil Date: Thu, 16 Jul 2026 11:59:40 -0400 Subject: [PATCH 2/2] Add log for missing pod in istio check --- .../src/airflow/providers/cncf/kubernetes/operators/pod.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 0cbc1227e5f41..c26817cd25e4b 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,6 +1341,12 @@ def is_istio_enabled(self, pod: V1Pod) -> bool: 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