hehuiyuan edited a comment on issue #24188: [SPARK-27258][K8S]Add the prefix 'spark-' for resourceNamePrefix that starts with number URL: https://github.com/apache/spark/pull/24188#issuecomment-476063794 I think we can only update the resourceNamePrefix of service, which may be better. For the class of DriverServiceFeatureStep : ```scala private val preferredServiceName = s"${kubernetesConf.resourceNamePrefix}$DRIVER_SVC_POSTFIX" private val resolvedServiceName = if (preferredServiceName.length <= MAX_SERVICE_NAME_LENGTH) { preferredServiceName } else { val randomServiceId = KubernetesUtils.uniqueID(clock = clock) val shorterServiceName = s"spark-$randomServiceId$DRIVER_SVC_POSTFIX" logWarning(s"Driver's hostname would preferably be $preferredServiceName, but this is " + s"too long (must be <= $MAX_SERVICE_NAME_LENGTH characters). Falling back to use " + s"$shorterServiceName as the driver service's name.") shorterServiceName } ``` Updata: ```scala def isNumber(char: Char) : Boolean = { char >= '0' && char <= '9' } private val preferredServiceName = s"${kubernetesConf.resourceNamePrefix}$DRIVER_SVC_POSTFIX" private val resolvedServiceName = if (preferredServiceName.length <= MAX_SERVICE_NAME_LENGTH && !isNumber(preferredServiceName.charAt(0))) { preferredServiceName } else { val randomServiceId = KubernetesUtils.uniqueID(clock = clock) val shorterServiceName = s"spark-$randomServiceId$DRIVER_SVC_POSTFIX" logWarning(s"Driver's hostname would preferably be $preferredServiceName, but this is " + s"too long (must be <= $MAX_SERVICE_NAME_LENGTH characters) " + s"or the first character of $preferredServiceName is number which is not support." + s" Falling back to use $shorterServiceName as the driver service's name.") shorterServiceName } ```
---------------------------------------------------------------- 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]
