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

 ##########
 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:
   1. For example: resourceNamePrefix = 1min-xxx
   
   After execute this code:
   
   `val prefix = "spark-" + resourceNamePrefix.charAt(0)
       resourceNamePrefix.replaceAll("^[0-9]", prefix)`
   
   resourceNamePrefix = spark-1min-xxx,which satisfies the regular expression 
`[a-z]([-a-z0-9]*[a-z0-9])?`
   
   2. For example : resourceNamePrefix = min-xxx
   
   After execute this code:
   
   `val prefix = "spark-" + resourceNamePrefix.charAt(0)
       resourceNamePrefix.replaceAll("^[0-9]", prefix)`
   
   resourceNamePrefix = min-xxx,which does not change.
   
   
   
   
   
   Local testing was done for this method only.
   

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