maomaodev commented on code in PR #58464:
URL: https://github.com/apache/spark/pull/58464#discussion_r3962307452


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/KubernetesClusterSchedulerBackend.scala:
##########
@@ -98,6 +100,35 @@ private[spark] class KubernetesClusterSchedulerBackend(
     
kubernetesClient.configMaps().inNamespace(namespace).resource(configMap).create()
   }
 
+  /**
+   * Publishes the krb5 ConfigMap name into [[KRB_CONFIG_MAP_NAME]] so 
executor pods can mount it.
+   * Cluster mode already has it set by the driver step; client mode creates 
or reuses it here.
+   */
+  private[k8s] def setUpExecutorKrb5ConfigMap(driverPod: Option[Pod]): Unit = {
+    // Already set by the driver feature step (cluster mode), nothing to do.
+    if (conf.getOption(KRB_CONFIG_MAP_NAME).isEmpty) {
+      conf.get(KUBERNETES_KERBEROS_KRB5_CONFIG_MAP) match {
+        case Some(existingMap) =>
+          // User supplied an existing ConfigMap, just publish its name to 
executors.
+          conf.set(KRB_CONFIG_MAP_NAME, existingMap)
+        case None =>
+          conf.get(KUBERNETES_KERBEROS_KRB5_FILE).foreach { localPath =>
+            val file = new File(localPath)
+            val configMapName = KubernetesClientUtils
+              .configMapName(s"spark-krb5-${KubernetesUtils.uniqueID()}")
+            val labels =
+              Map(SPARK_APP_ID_LABEL -> applicationId(),
+                SPARK_ROLE_LABEL -> SPARK_POD_EXECUTOR_ROLE)
+            val configMap = KubernetesClientUtils.buildConfigMap(
+              configMapName, Map(file.getName -> 
Files.readString(file.toPath)), labels)

Review Comment:
   Thanks for the review. Fixed in 
https://github.com/apache/spark/pull/58464/changes/692454934a05561120d23fa76f4886cdbab3e49f
 — both the client-mode and cluster-mode paths now store the krb5.conf 
ConfigMap data under the fixed "krb5.conf" key (extracted to a KRB_FILE_NAME 
constant), matching the executor mount's subPath("krb5.conf"). Added assertions 
covering the data key, KeyToPath projection, and subPath for the local-file, 
existing-ConfigMap, and executor cases.



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