Skip to content

[SPARK-51250][K8S] Add Support for K8s PriorityClass Configuration fo… #49998

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zemin-piao
Copy link

What changes were proposed in this pull request?

  • Introduce a new spark configuration spark.kubernetes.priorityclass.name.
  • Create a new FeatureStep class PriorityClassFeatureStep that passes configured priority class name to driver and executor pods.
  • Tests for PriorityClassFeatureStep.scala

Why are the changes needed?

Currently when running spark on k8s, with spark-submit approach, in order to specify priority class name, the only possible way is to specify in the pod template. In a cluster with numerous priority classes, it means multiple pod template files are to be used, each of which has variant priority class name only.

One could dynamically generate the pod templates based on priority classes, however this introduces additional overhead on user side (e.g. building a process to dynamically generate templates just for priority class name, making sure dynamically generated templates are still valid)

Furthermore, for SPARK on YARN there is a configuration spark.yarn.priority that is flexible and easy to use for users. It is good to achieve the similar level of simplicity for users moving from SPARK on YARN to SPARK on K8s.

Does this PR introduce any user-facing change?

Yes. With this PR, users can use spark.kubernetes.priorityclass.name to specify the priority class name for driver and executor pods.

How was this patch tested?

Tests were added in this pull request

Was this patch authored or co-authored using generative AI tooling?

No

@zemin-piao
Copy link
Author

Bump :P

@zemin-piao
Copy link
Author

@yaooqinn if you have time could you maybe have a look? Thanks a lot!

@yaooqinn
Copy link
Member

Kubernetes has a large number of APIs, and I'm quite sure which ones should be added to the Spark defaults. I think using spark.kubernetes.driver.pod.featureSteps is beneficial.

Also cc @dongjoon-hyun

@dongjoon-hyun
Copy link
Member

dongjoon-hyun commented Apr 17, 2025

I'm not sure about this part of the PR claim. When does this happen, @zemin-piao ?

In a cluster with numerous priority classes

@zemin-piao
Copy link
Author

Kubernetes has a large number of APIs, and I'm quite sure which ones should be added to the Spark defaults. I think using spark.kubernetes.driver.pod.featureSteps is beneficial.

Also cc @dongjoon-hyun

Indeed in the released this is how I did priority class setting by using the customised feature step. I made this PR with this new spark config, with the thought that setting priority class is a generic thing for spark on k8s.

@zemin-piao
Copy link
Author

I'm not sure about this part of the PR claim. When does this happen, @zemin-piao ?

In a cluster with numerous priority classes

IMO it happens when multiple business criticalities needs to be defined within a cluster. This can also happen if in a cluster, a value based prioritisation needs to happen.

@zemin-piao
Copy link
Author

@yaooqinn @dongjoon-hyun thanks for your questions. Lemme know if more clarification and discussion needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants