holdenk commented on a change in pull request #32610:
URL: https://github.com/apache/spark/pull/32610#discussion_r658200417
##########
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-${Int.MaxValue}"
+ private def isValidExecutorPodNamePrefix(prefix: String): Boolean = {
+ // 6 is length of '-exec-'
+ val reservedLen = Int.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 " +
Review comment:
Same comment as above
##########
File path: docs/running-on-kubernetes.md
##########
@@ -889,7 +889,10 @@ See the [configuration page](configuration.html) for
information on Spark config
<td><code>spark.kubernetes.executor.podNamePrefix</code></td>
<td>(none)</td>
<td>
- Prefix to use in front of the executor pod names.
+ 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
Review comment:
Could we perhaps rephrase this as:
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>.
The prefix will be used to generate executor pod names in the form of
<code>$podNamePrefix-exec-$id</code>, where the `id` is
##########
File path:
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/Config.scala
##########
@@ -560,4 +580,6 @@ private[spark] object Config extends Logging {
val KUBERNETES_VOLUMES_OPTIONS_SERVER_KEY = "options.server"
val KUBERNETES_DRIVER_ENV_PREFIX = "spark.kubernetes.driverEnv."
+
+ val KUBERNETES_LABEL_MAX_LENGTH = 63
Review comment:
I'd say `KUBERNETES_DNSNAME_MAX_LENGTH` sounds good :)
--
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]