fix: delete pod when base container completes - #39694
Conversation
Fixes apache#39693. Special logic was added to `KubernetesPodOperator`'s lifecycle to handle the case where an istio proxy sidecar is running and preventing the pod from completing, but this logic should have been applied more generally to handle when multiple containers are ran in the pod. The new behavior considers the pod completed if the container matching the base name has completed.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
Did you test |
|
I did a little digging, and that scenario was never covered when the feature was added in #33306 😞. I don't think we want to leave these pods still running. |
|
Yeah, it's tough to 1) do it generally 2) not delete pods and 3) not leave the pods running. That's why istio has (or tried to have it turns out) special handling. I'm actually excited about the new(ish) sidecar support in k8s. It should make this situation a lot easier to tackle. Istio does have support for it also via |
|
@jedcunningham I'm not sure I understand your point about I'm also excited by the introduction of sidecars, but sadly the GKE cluster that my team has airflow deployed on is currently on k8s version 1.27.x and our infra team doesn't have plans to upgrade to 1.29.x for a couple of months... We have a workaround which is to just enable the istio proxy (or just name the sidecar container |
dirrao
left a comment
There was a problem hiding this comment.
In the case of additional sidecars, the additional sidecars (i.e. Splunk) have to wait for the completion of the base container and do self-kill. If not, we need to kill the additional sidecars after the timeout. Are we handling that scenario?
|
@ashb @dirrao That should happen when the pod is deleted. According to the k8s docs, when a pod is marked for deletion the containers in the pod are issued a TERM with a 30 second grace period. |
|
closes: #39625 |
amoghrajesh
left a comment
There was a problem hiding this comment.
Do we not have istio support anymore?
Can we instead also try using sidecar containers in. new k8s or by using the container lifecycle exit hooks?
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
Closes #39693
Special logic was added to
KubernetesPodOperator's lifecycle to handle the case where an istio proxy sidecar is running and preventing the pod from completing, but this logic should have been applied more generally to handle when multiple containers are ran in the pod. The new behavior considers the pod completed if the container matching the base name has completed.The istio-specific logic has been removed because it is no longer used.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.