-
Notifications
You must be signed in to change notification settings - Fork 117
Add parameter for driver pod name #258
Add parameter for driver pod name #258
Conversation
|
This could be handy. One question: IIRC the reason of appending timestamps to driver pod name (as well as the driver service name, we use the same for them) is because pod/service names must be unique within the same k8s namespace and we want to avoid conflictions. So should we check if there is already a pod/service with the same name before launching the driver pod? If so, maybe it's also worth adding an integration test? |
|
If pod name is exist, k8s API server will return error for Exception in thread "main" io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://test.k8s:6443/api/v1/namespaces/dbyin/pods. Message: pods "spark-pi-001" already exists. Received status: Status(apiVersion=v1, code=409, details=StatusDetails(causes=[], group=null, kind=pods, name=spark-pi-001, retryAfterSeconds=null, additionalProperties={}), kind=Status, message=pods "spark-pi-001" already exists, metadata=ListMeta(resourceVersion=null, selfLink=null, additionalProperties={}), reason=AlreadyExists, status=Failure, additionalProperties={}).I think this is what we expect. Of course, we can check it before create driver pod, but I think it's unnecessary, k8s API server do this is better when creating pod. |
|
The parameter is currently marked internal in config.scala. |
|
Also would need to be added here: https://github.com/apache-spark-on-k8s/spark/blob/branch-2.1-kubernetes/docs/running-on-kubernetes.md#spark-properties |
| "Unexpected value for annotation2") | ||
| } | ||
|
|
||
| test("Run with driver pod name") { |
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.
I wish we did not add more e2es and instead used unit tests better. This one is fine for now, but it's something to consider in the future.
| private val appName = sparkConf.getOption("spark.app.name") | ||
| .getOrElse("spark") | ||
| private val kubernetesAppId = s"$appName-$launchTime".toLowerCase.replaceAll("\\.", "-") | ||
| private val kubernetesAppId = sparkConf.getOption("spark.kubernetes.driver.pod.name") |
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 pod name spark.kubernetes.driver.pod.name and the app ID spark.app.id are slightly different -- I think the change on this line should be pulling from spark.app.id if we want to make the app ID configurable.
Given that this PR is about the pod name and not the app ID, maybe drop the change on this line and leave just the pod name configurable?
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.
It's reasonable:)
| private val appName = sparkConf.getOption("spark.app.name") | ||
| .getOrElse("spark") | ||
| private val kubernetesAppId = s"$appName-$launchTime".toLowerCase.replaceAll("\\.", "-") | ||
| private val kubernetesDriverPodName = sparkConf.getOption("spark.kubernetes.driver.pod.name") |
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.
can you use KUBERNETES_DRIVER_POD_NAME here?
| private val appName = sparkConf.getOption("spark.app.name") | ||
| .getOrElse("spark") | ||
| private val kubernetesAppId = s"$appName-$launchTime".toLowerCase.replaceAll("\\.", "-") | ||
| private val kubernetesDriverPodName = sparkConf.getOption("spark.kubernetes.driver.pod.name") |
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.
and here?
ash211
left a comment
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.
LGTM let's merge if tests pass
docs/running-on-kubernetes.md
Outdated
| <td><code>spark.kubernetes.driver.pod.name</code></td> | ||
| <td><code>(none)</code></td> | ||
| <td> | ||
| Name of the driver pod |
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.
Maybe add this: If not set, the driver pod name would be "spark.app.name" suffixed by a timestamp to avoid confliction with other spark apps.
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.
Done. Thanks @lins05
* Add parameter for driver pod name * Mark KUBERNETES_DRIVER_POD_NAME not being internal. Update docment. * Add test case for driver pod name * Diff driver pod name with appid * replace 'spark.kubernetes.driver.pod.name` with KUBERNETES_DRIVER_POD_NAME * Update readme to complete item
[NOSQUASH] Resync kube
* Add parameter for driver pod name * Mark KUBERNETES_DRIVER_POD_NAME not being internal. Update docment. * Add test case for driver pod name * Diff driver pod name with appid * replace 'spark.kubernetes.driver.pod.name` with KUBERNETES_DRIVER_POD_NAME * Update readme to complete item
Add parameter for driver pod name. #252