Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class KubernetesPodOperator(BaseOperator):
:param log_pod_spec_on_failure: Log the pod's specification if a failure occurs
:param on_finish_action: What to do when the pod reaches its final state, or the execution is interrupted.
If "delete_pod", the pod will be deleted regardless its state; if "delete_succeeded_pod",
only succeeded pod will be deleted. You can set to "keep_pod" to keep the pod. "delete_active_pod" deletes
only failed pod will be kept. You can set to "keep_pod" to keep the pod. "delete_active_pod" deletes
pods that are still active (Pending or Running).
:param termination_message_policy: The termination message policy of the base container.
Default value is "File"
Expand Down Expand Up @@ -1187,7 +1187,7 @@ def process_pod_deletion(self, pod: k8s.V1Pod, *, reraise=True) -> bool:
or (
self.on_finish_action == OnFinishAction.DELETE_SUCCEEDED_POD
and (
pod.status.phase == PodPhase.SUCCEEDED
pod.status.phase != PodPhase.FAILED
or container_is_succeeded(pod, self.base_container_name)
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,8 @@ def test_omitted_namespace_no_conn_not_in_k8s(self, mock_find, mock_path):
(OnFinishAction.DELETE_POD, PodPhase.RUNNING, True),
(OnFinishAction.DELETE_POD, PodPhase.SUCCEEDED, True),
(OnFinishAction.DELETE_POD, PodPhase.FAILED, True),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.PENDING, False),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.RUNNING, False),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.PENDING, True),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.RUNNING, True),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.SUCCEEDED, True),
(OnFinishAction.DELETE_SUCCEEDED_POD, PodPhase.FAILED, False),
(OnFinishAction.DELETE_ACTIVE_POD, PodPhase.PENDING, True),
Expand Down Expand Up @@ -964,7 +964,7 @@ def test_termination_grace_period_default_value_correctly_set(self):
({"on_finish_action": "keep_pod"}, False, False),
({"on_finish_action": "keep_pod"}, True, False),
({"on_finish_action": "delete_succeeded_pod"}, False, True),
({"on_finish_action": "delete_succeeded_pod"}, True, False),
({"on_finish_action": "delete_succeeded_pod"}, True, True),
({"on_finish_action": "delete_active_pod"}, True, True),
({"on_finish_action": "delete_active_pod"}, False, True),
],
Expand Down Expand Up @@ -1042,7 +1042,7 @@ def test_pod_with_istio_delete_after_await_container_error(
[
pytest.param({}, True, id="default"), # default values
pytest.param({"on_finish_action": "delete_pod"}, True, id="delete-pod"),
pytest.param({"on_finish_action": "delete_succeeded_pod"}, False, id="delete-succeeded-pod"),
pytest.param({"on_finish_action": "delete_succeeded_pod"}, True, id="delete-succeeded-pod"),
pytest.param({"on_finish_action": "keep_pod"}, False, id="keep-pod"),
pytest.param({"on_finish_action": "delete_active_pod"}, False, id="delete-active-pod"),
],
Expand Down