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 2021/10/11 15:43:10 UTC

[GitHub] [spark] attilapiros commented on a change in pull request #33550: [SPARK-36321][K8S] Do not fail application in kubernetes if name is too long

attilapiros commented on a change in pull request #33550:
URL: https://github.com/apache/spark/pull/33550#discussion_r726236287



##########
File path: resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala
##########
@@ -104,11 +105,14 @@ private[spark] class BasicExecutorFeatureStep(
     // hostname must be no longer than `KUBERNETES_DNSNAME_MAX_LENGTH`(63) characters,
     // so take the last 63 characters of the pod name as the hostname.
     // This preserves uniqueness since the end of name contains executorId
-    val hostname = name.substring(Math.max(0, name.length - KUBERNETES_DNSNAME_MAX_LENGTH))
-      // Remove non-word characters from the start of the hostname
-      .replaceAll("^[^\\w]+", "")
-      // Replace dangerous characters in the remaining string with a safe alternative.
-      .replaceAll("[^\\w-]+", "_")
+    val hostname = if (executorPodNamePrefix.length > KUBERNETES_POD_NAME_PREFIX_MAX_LENGTH) {
+      val mamePrefix = KubernetesConf.getResourceNamePrefix(

Review comment:
       Sorry @ulysses-you I was busy with other stuff but I would like to have a fix for this problem so yes a new PR is fine for me. 




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

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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