You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2023/03/23 07:29:15 UTC

[GitHub] [spark] pan3793 opened a new pull request, #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

pan3793 opened a new pull request, #40533:
URL: https://github.com/apache/spark/pull/40533

   <!--
   Thanks for sending a pull request!  Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
     2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
     4. Be sure to keep the PR description updated to reflect all changes.
     5. Please write your PR title to summarize what this PR proposes.
     6. If possible, provide a concise example to reproduce the issue for a faster review.
     7. If you want to add a new configuration, please read the guideline first for naming configurations in
        'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
     8. If you want to add or modify an error type or message, please read the guideline first in
        'core/src/main/resources/error/README.md'.
   -->
   
   ### What changes were proposed in this pull request?
   <!--
   Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
   If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
     1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
     2. If you fix some SQL features, you can provide some references of other DBMSes.
     3. If there is design documentation, please add the link.
     4. If there is a discussion in the mailing list, please add the link.
   -->
   Change the generated resource name prefix to meet K8s requirements
   
   ### Why are the changes needed?
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you propose a new API, clarify the use case for a new API.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   > DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?')
   
   ```
   bin/spark-submit \
   	 --master k8s://https://*.*.*.*:6443 \
   	 --deploy-mode cluster \
   	 --name 你好_187609 \
            ...
   ```
   
   ```
   Exception in thread "main" io.fabric8.kubernetes.client.KubernetesClientException: 
   Failure executing: POST at: https://*.*.*.*:6443/api/v1/namespaces/spark/services. Message: Service "187609-f19020870d12c349-driver-svc" is invalid: metadata.name: Invalid value: "187609-f19020870d12c349-driver-svc": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?'). Received status: Status(apiVersion=v1, code=422, details=StatusDetails(causes=[StatusCause(field=metadata.name, message=Invalid value: "187609-f19020870d12c349-driver-svc": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?'), reason=FieldValueInvalid, additionalProperties={})], group=null, kind=Service, name=187609-f19020870d12c349-driver-svc,
  retryAfterSeconds=null, uid=null, additionalProperties={}), kind=Status, message=Service "187609-f19020870d12c349-driver-svc" is invalid: metadata.name: Invalid value: "187609-f19020870d12c349-driver-svc": a DNS-1035 label must consist of lower case alphanumeric characters or '-', start with an alphabetic character, and end with an alphanumeric character (e.g. 'my-name',  or 'abc-123', regex used for validation is '[a-z]([-a-z0-9]*[a-z0-9])?'), metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=Invalid, status=Failure, additionalProperties={}).
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
   If no, write 'No'.
   -->
   No
   
   ### How was this patch tested?
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
   -->
   New UT.


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


[GitHub] [spark] pan3793 commented on pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #40533:
URL: https://github.com/apache/spark/pull/40533#issuecomment-1483677257

   > To @pan3793 and @yaooqinn . IMO, what we need is only one additional line at the end of the replacement. WDYT?
   > 
   > ```scala
   > .replaceAll("^[0-9]", "x")
   > ```
   
   Yes, this approach does not introduce breaking change, updated as suggested


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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147983528


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -252,6 +252,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   }
 
   test("SPARK-40869: Resource name prefix should not start with a hyphen") {
-    assert(KubernetesConf.getResourceNamePrefix("_hello_").startsWith("hello"))
+    assert(KubernetesConf.getResourceNamePrefix("_hello_").startsWith("xhellox"))

Review Comment:
   We don't need this breaking change if we follow https://github.com/apache/spark/pull/40533/files#r1147982928



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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147046457


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
-      .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+    var prefix = ""
+    while (prefix.isEmpty) {

Review Comment:
   Thank you, @dongjoon-hyun. 
   
   Add `while` here is because the current body may produce empty string `""`. To avoid while loop, we need to change the algorithm:
   
   - how do you think @yaooqinn‘s suggestion, simply replaces the illegal characters with 'x'
   - or if the result is `""`, just return a constant string, e.g. `"spark"`



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


[GitHub] [spark] dongjoon-hyun closed pull request #40533: [SPARK-42906][K8S] Replace a starting digit with `x` in resource name prefix

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #40533: [SPARK-42906][K8S] Replace a starting digit with `x` in resource name prefix
URL: https://github.com/apache/spark/pull/40533


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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147984980


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -259,9 +259,9 @@ private[spark] object KubernetesConf {
     s"$appName-$id"
       .trim
       .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
+      .replaceAll("[^a-z0-9\\-]", "x")

Review Comment:
   It seems that it becomes we don't need this part.



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


[GitHub] [spark] dongjoon-hyun commented on pull request #40533: [SPARK-42906][K8S] Replace a starting digit with `x` in resource name prefix

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #40533:
URL: https://github.com/apache/spark/pull/40533#issuecomment-1485948727

   Merged to master/3.4/3.3/3.2.


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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147855130


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
-      .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+    var prefix = ""
+    while (prefix.isEmpty) {

Review Comment:
   option 1 is adopted



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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1145950352


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")

Review Comment:
   The suggestion sounds good to me, which make the generated name easier to meet the K8s requirements, and if we adopt it, maybe `getAppNameLabel` should be updated as well.
   
   will do it if no objections till tomorrow.



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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147855519


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")

Review Comment:
   updated as suggested



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


[GitHub] [spark] yaooqinn commented on pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on PR #40533:
URL: https://github.com/apache/spark/pull/40533#issuecomment-1483728354

   Hi @dongjoon-hyun thanks for pinging me, SGTM


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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1145950352


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")

Review Comment:
   The suggestion sounds good to me, which makes the generated name easier to meet the K8s requirements, and if we adopt it, maybe `getAppNameLabel` should be updated as well.
   
   will do it if no objections till tomorrow.



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


[GitHub] [spark] pan3793 commented on pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #40533:
URL: https://github.com/apache/spark/pull/40533#issuecomment-1480723613

   cc @dongjoon-hyun @yaooqinn @Yikun 


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


[GitHub] [spark] yaooqinn commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "yaooqinn (via GitHub)" <gi...@apache.org>.
yaooqinn commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1145877352


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")

Review Comment:
   how about replacing these characters with 'x', which makes us easily refer to unknown ones? 



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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147981474


##########
resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/KubernetesConfSuite.scala:
##########
@@ -252,6 +252,14 @@ class KubernetesConfSuite extends SparkFunSuite {
   }
 
   test("SPARK-40869: Resource name prefix should not start with a hyphen") {
-    assert(KubernetesConf.getResourceNamePrefix("_hello_").startsWith("hello"))
+    assert(KubernetesConf.getResourceNamePrefix("_hello_").startsWith("xhellox"))

Review Comment:
   You don't need this behavior change if you follow https://github.com/apache/spark/pull/40533/files#r1147981215



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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1146739948


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
-      .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+    var prefix = ""
+    while (prefix.isEmpty) {

Review Comment:
   Can we avoid `while` because sometime this may lead us to the infinite loop if someone change the body of `while` accidentally in the future?



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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1145950352


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -255,13 +255,17 @@ private[spark] object KubernetesConf {
     s"spark-${UUID.randomUUID().toString.replaceAll("-", "")}"
 
   def getResourceNamePrefix(appName: String): String = {
-    val id = KubernetesUtils.uniqueID()
-    s"$appName-$id"
-      .trim
-      .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")

Review Comment:
   The suggestion sounds good to me, which makes the generated name easier to meet the K8s requirements.
   
   will do it if no objections till tomorrow.



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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147982928


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -259,9 +259,9 @@ private[spark] object KubernetesConf {
     s"$appName-$id"
       .trim
       .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
+      .replaceAll("[^a-z0-9\\-]", "x")
       .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+      .replaceAll("^[0-9\\-]", "x")

Review Comment:
   Let's keep the original one and have like the following.
   ```scala
   .replaceAll("^-", "")
   .replaceAll("^[0-9]", "x")
   ```



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


[GitHub] [spark] dongjoon-hyun commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1147981215


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -259,9 +259,9 @@ private[spark] object KubernetesConf {
     s"$appName-$id"
       .trim
       .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
+      .replaceAll("[^a-z0-9\\-]", "x")
       .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+      .replaceAll("^[0-9\\-]", "x")

Review Comment:
   Actually, for this one, please remove it like before.



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


[GitHub] [spark] pan3793 commented on a diff in pull request #40533: [SPARK-42906][K8S] Resource name prefix should start with an alphabetic character

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on code in PR #40533:
URL: https://github.com/apache/spark/pull/40533#discussion_r1148249740


##########
resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesConf.scala:
##########
@@ -259,9 +259,9 @@ private[spark] object KubernetesConf {
     s"$appName-$id"
       .trim
       .toLowerCase(Locale.ROOT)
-      .replaceAll("[^a-z0-9\\-]", "-")
+      .replaceAll("[^a-z0-9\\-]", "x")
       .replaceAll("-+", "-")
-      .replaceAll("^-", "")
+      .replaceAll("^[0-9\\-]", "x")

Review Comment:
   updated as suggested



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