You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/03/25 15:27:09 UTC

[GitHub] [spark] srowen commented on a change in pull request #24188: [SPARK-27258][K8S]Add the prefix 'spark-' for resourceNamePrefix that starts with number

srowen commented on a change in pull request #24188: [SPARK-27258][K8S]Add the prefix 'spark-' for resourceNamePrefix that starts with number
URL: https://github.com/apache/spark/pull/24188#discussion_r268700112
 
 

 ##########
 File path: resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala
 ##########
 @@ -78,7 +78,10 @@ private[spark] class KubernetesDriverConf(
 
   override val resourceNamePrefix: String = {
     val custom = if (Utils.isTesting) get(KUBERNETES_DRIVER_POD_NAME_PREFIX) else None
-    custom.getOrElse(KubernetesConf.getResourceNamePrefix(appName))
+    val resourceNamePrefix = custom.getOrElse(KubernetesConf.getResourceNamePrefix(appName))
+    // If the first character of resourceNamePrefix is number,add the extra prefix : "spark-".
+    val prefix = "spark-" + resourceNamePrefix.charAt(0)
+    resourceNamePrefix.replaceAll("^[0-9]", prefix)
 
 Review comment:
   Why not just prepend "spark-" if the first character is a digit? `if (Character.isDigit(resourceNamePrefix(0)))`

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org