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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]