[SPARK-53907][K8S] Support spark.kubernetes.allocation.maximum
#52615
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.
What changes were proposed in this pull request?
This PR aims to support
spark.kubernetes.allocation.maximum
.Why are the changes needed?
Since we use
AtomicInteger
ID generator, we hit the overflow atInt.MaxValue
. We had better throw exceptions explicitly in this case because it's highly a malfunctioning situation when a Spark driver tries to create2147483647 (Int.MaxValue)
executor pods.spark/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/scheduler/cluster/k8s/ExecutorPodsAllocator.scala
Line 49 in e05c75e
Does this PR introduce any user-facing change?
Practically no because a normal Spark job and K8s cluster cannot handle
2147483647
executor pod creation. If a user has this case, it means the ID overflow happens and the ID will be rotated to0
and the executor IDs will be reused. It's already a bug situation.How was this patch tested?
Pass the CIs with newly added test cases.
Was this patch authored or co-authored using generative AI tooling?
No.