liyinan926 commented on a change in pull request #27520: [SPARK-30771][K8S] 
Avoid failed mount warning from kubernetes and support the optional mount.
URL: https://github.com/apache/spark/pull/27520#discussion_r377883931
 
 

 ##########
 File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala
 ##########
 @@ -127,15 +127,18 @@ private[spark] class Client(
         .pods()
         .withName(driverPodName)
         .watch(watcher)) { _ =>
-      val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
+      var createdDriverPod: Option[Pod] = None
       try {
         val otherKubernetesResources =
           resolvedDriverSpec.driverKubernetesResources ++ Seq(configMap)
-        addDriverOwnerReference(createdDriverPod, otherKubernetesResources)
         kubernetesClient.resourceList(otherKubernetesResources: 
_*).createOrReplace()
+        createdDriverPod = 
Some(kubernetesClient.pods().create(resolvedDriverPod))
+        addDriverOwnerReference(createdDriverPod.get, otherKubernetesResources)
 
 Review comment:
   Basically you will need to update the resources against the API server after 
the driver pod gets created. However, there's a potential risk here: if the 
creation of the driver pod failed for whatever reasons, the ownerRefs won't be 
added so garbage collection won't kick in and consequently the resources won't 
be properly cleaned up.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to