This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new b6eafcf4516a [SPARK-55431][K8S] Set `resizePolicy` to `NotRequired`
explicitly for executor pods
b6eafcf4516a is described below
commit b6eafcf4516a977bca90eb19953fac094f277286
Author: Dongjoon Hyun <[email protected]>
AuthorDate: Sun Feb 8 16:42:35 2026 -0800
[SPARK-55431][K8S] Set `resizePolicy` to `NotRequired` explicitly for
executor pods
### What changes were proposed in this pull request?
This PR aims to set `resizePolicy` to `NotRequired` explicitly for executor
pods.
### Why are the changes needed?
From K8s v1.35, `In-Place Pod Resize` graduates to `Stable`. So, Apache
Spark users can use the features.
-
https://kubernetes.io/blog/2025/12/19/kubernetes-v1-35-in-place-pod-resize-ga/
-
https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/
Although `NotRequired` is the default value, it's recommend to set this
explicitly to `NotRequired` if we want to be consistent with the existing
Apache Spark's pod `restartPolicy=Never` behavior.
https://kubernetes.io/docs/tasks/configure-pod-container/resize-container-resources/#container-resize-policies
> If a Pod's overall restartPolicy is Never, then any container
resizePolicy must be NotRequired for all resources. You cannot configure a
resize policy that would require a restart in such Pods.
https://github.com/apache/spark/blob/63f1f96a895126cacca217effc225c9200a093eb/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala#L281
### Does this PR introduce _any_ user-facing change?
No because this is `NotRequired` is the default value of `resizePolicy`.
### How was this patch tested?
Pass the CIs with newly added test case.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: `Opus 4.5` on `Claude Code`
Closes #54214 from dongjoon-hyun/SPARK-55431.
Authored-by: Dongjoon Hyun <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../deploy/k8s/features/BasicExecutorFeatureStep.scala | 8 ++++++++
.../k8s/features/BasicExecutorFeatureStepSuite.scala | 17 +++++++++++++++++
2 files changed, 25 insertions(+)
diff --git
a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala
b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala
index 855e404b7646..2e8690fc33bd 100644
---
a/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala
+++
b/resource-managers/kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStep.scala
@@ -217,6 +217,14 @@ private[spark] class BasicExecutorFeatureStep(
.addToRequests("cpu", executorCpuQuantity)
.addToLimits(executorResourceQuantities.asJava)
.endResources()
+ .addNewResizePolicy()
+ .withResourceName("cpu")
+ .withRestartPolicy("NotRequired")
+ .endResizePolicy()
+ .addNewResizePolicy()
+ .withResourceName("memory")
+ .withRestartPolicy("NotRequired")
+ .endResizePolicy()
.addNewEnv()
.withName(ENV_SPARK_USER)
.withValue(Utils.getCurrentUserName())
diff --git
a/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStepSuite.scala
b/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStepSuite.scala
index 2a5dc864d635..4ab9f3a72d34 100644
---
a/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStepSuite.scala
+++
b/resource-managers/kubernetes/core/src/test/scala/org/apache/spark/deploy/k8s/features/BasicExecutorFeatureStepSuite.scala
@@ -651,6 +651,23 @@ class BasicExecutorFeatureStepSuite extends SparkFunSuite
with BeforeAndAfter {
.getLimits.get("memory")) === "1174Mi")
}
+ test("SPARK-55431: executor pod sets resizePolicy to NotRequired for cpu and
memory") {
+ val step = new BasicExecutorFeatureStep(newExecutorConf(), new
SecurityManager(baseConf),
+ defaultProfile)
+ val executor = step.configurePod(SparkPod.initialPod())
+
+ val resizePolicies = executor.container.getResizePolicy.asScala
+ assert(resizePolicies.size === 2)
+
+ val cpuPolicy = resizePolicies.find(_.getResourceName == "cpu")
+ assert(cpuPolicy.isDefined)
+ assert(cpuPolicy.get.getRestartPolicy === "NotRequired")
+
+ val memoryPolicy = resizePolicies.find(_.getResourceName == "memory")
+ assert(memoryPolicy.isDefined)
+ assert(memoryPolicy.get.getRestartPolicy === "NotRequired")
+ }
+
// There is always exactly one controller reference, and it points to the
driver pod.
private def checkOwnerReferences(executor: Pod, driverPodUid: String): Unit
= {
assert(executor.getMetadata.getOwnerReferences.size() === 1)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]