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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to