Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 29.4k
[SPARK-27258][K8S]Deal with the k8s resource names that don't match their own regular expression#24839
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
[SPARK-27258][K8S]Deal with the k8s resource names that don't match their own regular expression #24839
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -39,14 +39,15 @@ 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) or is not a valid service name." + | ||
| s"Falling back to use $shorterServiceName as the driver service's name.") | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it should be falling back to some default name. It is not necessarily the shorter if the preferred is invalid. Author There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only a method for dealing with the invalid service name. If the name is invalid and we don't deal with it, the job only has a driver pod.
| ||
| shorterServiceName | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still needed then, if you're simply validating and replacing the name if it starts with "-"?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The '^-' is used for all kubernetes resources. If the resource name starts with "-",we replace it with
"",which can run normally .The service name that starts with
0-9is replace.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need to match the fabric8 regex bellow, shouldn't this be
.replaceAll("^[^a-z]", "")to replace any leading/first non alpha character?