Github user tnachen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22146#discussion_r214205873
  
    --- Diff: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesUtils.scala
 ---
    @@ -59,5 +66,28 @@ private[spark] object KubernetesUtils {
         }
       }
     
    +  def loadPodFromTemplate(
    +      kubernetesClient: KubernetesClient,
    +      templateFile: File): SparkPod = {
    +    try {
    +      val pod = kubernetesClient.pods().load(templateFile).get()
    +      pod.getSpec.getContainers.asScala.toList match {
    +        case first :: rest => SparkPod(
    +          new PodBuilder(pod)
    +            .editSpec()
    +              .withContainers(rest.asJava)
    +              .endSpec()
    +            .build(),
    +          first)
    +        case Nil => SparkPod(pod, new ContainerBuilder().build())
    +      }
    +    } catch {
    +      case e: Exception =>
    +        logError(
    +          s"Encountered exception while attempting to load initial pod 
spec from file", e)
    +        throw new SparkException("Could not load driver pod from template 
file.", e)
    --- End diff --
    
    This error message is misleading, it throws when both executor and driver 
pod failed to load from its own template. Either remove "driver" or be more 
specific that its executor or driver.


---

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

Reply via email to