-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-40350][Kubernetes] Use spark config to configure the parameters of volcano podgroup #37802
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,8 @@ | |
| */ | ||
| package org.apache.spark.deploy.k8s.features | ||
|
|
||
| import java.util | ||
|
|
||
| import io.fabric8.kubernetes.api.model._ | ||
| import io.fabric8.volcano.client.DefaultVolcanoClient | ||
| import io.fabric8.volcano.scheduling.v1beta1.{PodGroup, PodGroupSpec} | ||
|
|
@@ -54,11 +56,33 @@ private[spark] class VolcanoFeatureStep extends KubernetesDriverCustomFeatureCon | |
| metadata.setName(podGroupName) | ||
| metadata.setNamespace(namespace) | ||
| pg.setMetadata(metadata) | ||
|
|
||
| var spec = pg.getSpec | ||
| if (spec == null) spec = new PodGroupSpec | ||
| val queue = kubernetesConf.getOption(POD_GROUP_SPEC_QUEUE) | ||
| if (queue.isDefined) { | ||
| spec.setQueue(queue.get) | ||
| } | ||
| val minResourceCPU = kubernetesConf.getOption(POD_GROUP_SPEC_MIN_RESOURCE_CPU) | ||
| val minResourceMemory = kubernetesConf.getOption(POD_GROUP_SPEC_MIN_RESOURCE_MEMORY) | ||
| if (minResourceCPU.isDefined || minResourceMemory.isDefined) { | ||
| val minResources = new util.HashMap[String, Quantity] | ||
| if (minResourceCPU.isDefined) { | ||
| minResources.put("cpu", new Quantity(minResourceCPU.get)) | ||
| } | ||
| if (minResourceMemory.isDefined) { | ||
| minResources.put("memory", new Quantity(minResourceMemory.get)) | ||
| } | ||
| spec.setMinResources(minResources) | ||
|
Member
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 will force to overwrite existing MinResources and ignore existing template if one of configurations is set. |
||
| } | ||
| val minMember = kubernetesConf.getOption(POD_GROUP_SPEC_MIN_MEMBER) | ||
| if (minMember.isDefined) { | ||
| spec.setMinMember(minMember.get.toInt) | ||
| } | ||
| val priorityClassName = kubernetesConf.getOption(POD_GROUP_SPEC_PRIORITY_CLASS_NAME) | ||
| if (priorityClassName.isDefined) { | ||
| spec.setPriorityClassName(priorityClassName.get) | ||
| } | ||
| pg.setSpec(spec) | ||
|
|
||
| Seq(pg) | ||
| } | ||
|
|
||
|
|
@@ -75,4 +99,12 @@ private[spark] class VolcanoFeatureStep extends KubernetesDriverCustomFeatureCon | |
| private[spark] object VolcanoFeatureStep { | ||
| val POD_GROUP_ANNOTATION = "scheduling.k8s.io/group-name" | ||
| val POD_GROUP_TEMPLATE_FILE_KEY = "spark.kubernetes.scheduler.volcano.podGroupTemplateFile" | ||
| val POD_GROUP_SPEC_QUEUE = "spark.kubernetes.scheduler.volcano.podGroup.spec.queue" | ||
| val POD_GROUP_SPEC_MIN_RESOURCE_CPU = | ||
| "spark.kubernetes.scheduler.volcano.podGroup.spec.minResources.cpu" | ||
| val POD_GROUP_SPEC_MIN_RESOURCE_MEMORY = | ||
| "spark.kubernetes.scheduler.volcano.podGroup.spec.minResources.memory" | ||
| val POD_GROUP_SPEC_MIN_MEMBER = "spark.kubernetes.scheduler.volcano.podGroup.spec.minMember" | ||
| val POD_GROUP_SPEC_PRIORITY_CLASS_NAME = | ||
| "spark.kubernetes.scheduler.volcano.podGroup.spec.PriorityClassName" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 decided to add parameters support, the builder style might more stable and easy to maintainance.
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 can refactor this, if my opinion is accepted,