dongjoon-hyun commented on a change in pull request #32610:
URL: https://github.com/apache/spark/pull/32610#discussion_r648002314



##########
File path: 
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala
##########
@@ -250,11 +250,32 @@ private[spark] object Config extends Logging {
       .stringConf
       .createOptional
 
+  // the definition of a label in DNS (RFC 1123).
+  private val dns1123LabelFmt = "[a-z0-9]([-a-z0-9]*[a-z0-9])?"
+
+  private val podConfValidator = 
(s"^$dns1123LabelFmt(\\.$dns1123LabelFmt)*$$").r.pattern
+
+  // The possible longest executor name would be 
"$prefix-exec-${Long.MaxValue}"
+  private def isValidExecutorPodNamePrefix(prefix: String): Boolean = {
+    // 6 is length of '-exec-'
+    val reservedLen = Long.MaxValue.toString.length + 6
+    val validLength = prefix.length + reservedLen <= 
KUBERNETES_LABEL_MAX_LENGTH
+    validLength && podConfValidator.matcher(prefix).matches()
+  }
+
   val KUBERNETES_EXECUTOR_POD_NAME_PREFIX =
     ConfigBuilder("spark.kubernetes.executor.podNamePrefix")
-      .doc("Prefix to use in front of the executor pod names.")
+      .doc("Prefix to use in front of the executor pod names. It must conform 
the rules defined " +
+        "by the Kubernetes <a 
href=\"https://kubernetes.io/docs/concepts/overview/"; +
+        "working-with-objects/names/#dns-label-names\">DNS Label Names</a>. 
Besides, the " +
+        "executor pod names will be generated in the form of " +
+        "<code>$podNamePrefix-exec-$id</code>, where the `id` is a positive 
long value, " +

Review comment:
       ditto. `long value`.




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

Reply via email to