[FLINK-31652][k8s] Handle the deleted event in case pod is deleted during the pending phase - #22311
[FLINK-31652][k8s] Handle the deleted event in case pod is deleted during the pending phase#22311SinBex wants to merge 2 commits into
Conversation
…ring the pending phase
|
@xintongsong Could you please help to review this PR in your free time? Thanks. |
| import java.util.concurrent.CancellationException; | ||
| import java.util.concurrent.CompletableFuture; | ||
|
|
||
| import static io.fabric8.kubernetes.client.Watcher.Action.ADDED; |
There was a problem hiding this comment.
It's better not use fabric classes in KubernetesResourceManagerDriver since these are Flink internal logic.
There was a problem hiding this comment.
Thanks for your suggestion. It is indeed better not to introduce an external class, I will use an internal enum to replace it.
| () -> { | ||
| for (KubernetesPod pod : pods) { | ||
| if (pod.isTerminated()) { | ||
| if (action == DELETED || pod.isTerminated()) { |
There was a problem hiding this comment.
We need some annotations to explain why we need this logic.
…ted during the pending phase
|
Thank you so much for your review @huwh , I have updated the code, PTAL~ |
xintongsong
left a comment
There was a problem hiding this comment.
Thanks @SinBex for fixing this. The PR LGTM. I have only 1 minor comment, which I'll address myself while merging this.
| } | ||
|
|
||
| @Test | ||
| void testOnPodDeletedWithDeletedEvent() throws Exception { |
There was a problem hiding this comment.
| void testOnPodDeletedWithDeletedEvent() throws Exception { | |
| void testOnPodDeletedBeforeScheduled() throws Exception { |
…ring the pending phase This closes #22311
…ring the pending phase This closes #22311
…ring the pending phase This closes apache#22311
…ring the pending phase This closes apache#22311
What is the purpose of the change
Currently, in kubernetes deployment, if the taskmanager pod is deleted in 'Pending' phase, the flink job will get stuck and keep waiting for the pod scheduled. The cause reason is that the pod status will not be updated in time, so the KubernetesResourceManagerDriver won't detect the pod is terminated, but should handle the deleted event.
Brief change log
Verifying this change
KubernetesResourceManagerDriverTest#testOnPodDeletedWithDeletedEventDoes this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation