Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,6 @@ private[spark] object KubernetesConf {
.replaceAll("\\.", "-")
.replaceAll("[^a-z0-9\\-]", "")
.replaceAll("-+", "-")
.replaceAll("^-", "")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,16 @@ private[spark] class DriverServiceFeatureStep(
"managed via a Kubernetes service.")

private val preferredServiceName = s"${kubernetesConf.resourceNamePrefix}$DRIVER_SVC_POSTFIX"
private val resolvedServiceName = if (preferredServiceName.length <= MAX_SERVICE_NAME_LENGTH) {
private val resolvedServiceName = if (preferredServiceName.length <= MAX_SERVICE_NAME_LENGTH
&& Character.isLetter(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). Falling back to use " +
s"$shorterServiceName as the driver service's name.")
s"too long (must be <= $MAX_SERVICE_NAME_LENGTH characters) " +
s"or the first character of $preferredServiceName is not letter which is not support." +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

support -> supported.
You could just say "or is not a valid service name"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK! But there are some conflicts at present.

Copy link
Author

@hehuiyuan hehuiyuan Jun 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@srowen Hi, i have a question that is how to deal with the prefix of user-defined pod.

It handles the default prefix of podName in this PR .
Is there any need for further treatment or it's necessary to explain it for KUBERNETES_EXECUTOR_POD_NAME_PREFIX and KUBERNETES_DRIVER_POD_NAME in the doc.

  override val resourceNamePrefix: String = {
    get(KUBERNETES_EXECUTOR_POD_NAME_PREFIX).getOrElse(
      KubernetesConf.getResourceNamePrefix(appName))
  }

  private val driverPodName = conf
    .get(KUBERNETES_DRIVER_POD_NAME)
    .getOrElse(s"${conf.resourceNamePrefix}-driver")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That I don't know ... @skonto?

s" Falling back to use $shorterServiceName as the driver service's name.")
shorterServiceName
}

Expand Down