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 2022/03/23 02:55:28 UTC

[GitHub] [spark] Yikun commented on a change in pull request #35943: [SPARK-38630][K8S] K8s app name label should start and end with alphanumeric char

Yikun commented on a change in pull request #35943:
URL: https://github.com/apache/spark/pull/35943#discussion_r832802242



##########
File path: resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala
##########
@@ -270,7 +271,7 @@ private[spark] object KubernetesConf {
         .replaceAll("-+", "-"),
       "",
       KUBERNETES_DNSNAME_MAX_LENGTH
-    )
+    ).stripPrefix("-").stripSuffix("-")

Review comment:
       Note for my self or others: k8s label allow `dashes (-), underscores (_), dots (.)`, we alread replaced `underscores (_)`, `dots (.)` by `dashes (-)` before, so strip "-" prefix/suffix is enough in here.
   
   Below tests are also passed:
   ```
   assert(KubernetesConf.getAppNameLabel(".hello.") === "hello")
   assert(KubernetesConf.getAppNameLabel("_hello_") === "hello")
   ```




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