stijndehaes commented on a change in pull request #28423:
URL: https://github.com/apache/spark/pull/28423#discussion_r419230937
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala
##########
@@ -127,25 +129,33 @@ private[spark] class Client(
.endSpec()
.build()
val driverPodName = resolvedDriverPod.getMetadata.getName
- Utils.tryWithResource(
- kubernetesClient
- .pods()
- .withName(driverPodName)
- .watch(watcher)) { _ =>
- val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
- try {
- val otherKubernetesResources =
- resolvedDriverSpec.driverKubernetesResources ++ Seq(configMap)
- addDriverOwnerReference(createdDriverPod, otherKubernetesResources)
- kubernetesClient.resourceList(otherKubernetesResources:
_*).createOrReplace()
- } catch {
- case NonFatal(e) =>
- kubernetesClient.pods().delete(createdDriverPod)
- throw e
- }
- val sId = Seq(conf.namespace, driverPodName).mkString(":")
- watcher.watchOrStop(sId)
+ var watch: Watch = null
+ val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
+ try {
+ val otherKubernetesResources =
resolvedDriverSpec.driverKubernetesResources ++ Seq(configMap)
+ addDriverOwnerReference(createdDriverPod, otherKubernetesResources)
+ kubernetesClient.resourceList(otherKubernetesResources:
_*).createOrReplace()
+ } catch {
+ case NonFatal(e) =>
+ kubernetesClient.pods().delete(createdDriverPod)
+ throw e
+ }
+ val sId = Seq(conf.namespace, driverPodName).mkString(":")
+ breakable {
+ while (true) {
+ try {
+ watch = kubernetesClient
+ .pods()
+ .withName(driverPodName)
+ .watch(watcher)
+ watcher.watchOrStop(sId)
Review comment:
I think you are right with the race condition, since a watch is started
with the resource version from the java k8s client, we start watching changes
from that resource version.
So we are in the case: `resourceVersion=“{value other than 0}”`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]