HwangDongJun commented on code in PR #58187:
URL: https://github.com/apache/spark/pull/58187#discussion_r4310429173


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesClientApplication.scala:
##########
@@ -121,8 +121,24 @@ private[spark] class Client(
         .withMountPath(SPARK_CONF_DIR_INTERNAL)
         .endVolumeMount()
       .build()
+    // SPARK-38079: a pod template (spark.kubernetes.driver.podTemplateFile) 
may already pin
+    // spec.nodeName to a specific node. The Kubernetes API rejects creating a 
pod that has
+    // both a non-empty spec.nodeName and a non-empty spec.schedulingGates 
(added below) --
+    // "nodeName cannot be set until all schedulingGates have been cleared" -- 
since nodeName
+    // is meant to be set only once nothing (including scheduling) stands 
between the pod and
+    // that node. Translate it to an equivalent kubernetes.io/hostname 
nodeSelector entry
+    // instead, which (unlike nodeName) is created and read normally on a 
gated pod and has
+    // the same effect once the scheduler runs -- unless 
spark.kubernetes.driver.node.selector.
+    // kubernetes.io/hostname (via BasicDriverFeatureStep, applied earlier in
+    // builder.buildFromFeatures() above) already set that same key: that 
explicit user
+    // configuration always wins, so it is never overwritten by this fallback.
+    val pinnedNodeName = Option(resolvedDriverSpec.pod.pod.getSpec.getNodeName)

Review Comment:
   Taken as suggested. A resolved pod that has `spec.nodeName` is no longer 
gated and goes through `master`'s flow, and the `nodeName` to `nodeSelector` 
rewrite is removed, so cordons, taints, affinity and custom schedulers behave 
as before for that pod. The "Pod Spec" table in `docs/running-on-kubernetes.md` 
now lists `nodeName` and `schedulingGates`.
   
   The cost is that such a pod keeps the race: with the config map applied late 
on purpose, a pinned pod still reported `FailedMount` on 5 of 5 submissions.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to