This is an automated email from the ASF dual-hosted git repository.
jscheffl 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 c6cb72c208c Make pod patching logic explicitly reflect when a pod is
retained (#68507)
c6cb72c208c is described below
commit c6cb72c208cb4638e60ef455b2ea0edc70b97108
Author: SameerMesiah97 <[email protected]>
AuthorDate: Sun Jun 14 10:05:24 2026 +0100
Make pod patching logic explicitly reflect when a pod is retained (#68507)
due to phase-based deletion rules.
Co-authored-by: Sameer Mesiah <[email protected]>
---
.../src/airflow/providers/cncf/kubernetes/operators/pod.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
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 1fafe9b216c..9f59fcb66d3 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
@@ -1228,12 +1228,13 @@ class KubernetesPodOperator(BaseOperator):
istio_enabled = self.is_istio_enabled(remote_pod)
pod_phase = remote_pod.status.phase if hasattr(remote_pod, "status")
else None
+ should_keep = self.on_finish_action in {
+ OnFinishAction.KEEP_POD,
+ OnFinishAction.DELETE_ACTIVE_POD,
+ }
+
# if the pod fails or success, but we don't want to delete it
- if (
- pod_phase != PodPhase.SUCCEEDED
- or self.on_finish_action == OnFinishAction.KEEP_POD
- or self.on_finish_action == OnFinishAction.DELETE_ACTIVE_POD
- ):
+ if pod_phase != PodPhase.SUCCEEDED or should_keep:
self.patch_already_checked(remote_pod, reraise=False)
if istio_enabled or self.do_xcom_push: