Skip to content

[SPARK-56670][K8S] Restrict ExecutorResizePlugin to direct pods allocator#55615

Closed
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-56670
Closed

[SPARK-56670][K8S] Restrict ExecutorResizePlugin to direct pods allocator#55615
dongjoon-hyun wants to merge 1 commit into
apache:masterfrom
dongjoon-hyun:SPARK-56670

Conversation

@dongjoon-hyun
Copy link
Copy Markdown
Member

@dongjoon-hyun dongjoon-hyun commented Apr 30, 2026

What changes were proposed in this pull request?

This PR restricts ExecutorResizePlugin to activate only when the direct pods allocator (ExecutorPodsAllocator) is configured via spark.kubernetes.allocation.pods.allocator.

When the configured allocator is anything else (statefulset, deployment, or a user-supplied class), ExecutorResizeDriverPlugin.init() now logs a warning and returns early without creating a Kubernetes client or
scheduling the periodic memory check.

Why are the changes needed?

ExecutorResizePlugin resizes individual executor pods in place via pods().withName(...).subresource("resize").patch(...). This works correctly only when Spark itself owns each pod, i.e. with the direct allocator. For the other allocators, user-defined or the higher-level controller's pod template is the source of truth and patching a single pod under those allocators may have unexpected side-effects.

  • statefulsetStatefulSet.spec.template
  • deploymentDeployment.spec.template

Does this PR introduce any user-facing change?

No, ExecutorResizePlugin is a new unreleased feature of Apache Spark 4.2.0.

How was this patch tested?

Pass the CIs with the newly added test coverage.

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

Generated-by: Claude Code (Opus 4.7)

@dongjoon-hyun
Copy link
Copy Markdown
Member Author

All tests passed.

@dongjoon-hyun
Copy link
Copy Markdown
Member Author

Could you review this PR, @HyukjinKwon ?

@dongjoon-hyun
Copy link
Copy Markdown
Member Author

Thank you, @HyukjinKwon ~ Merged to master for Apache Spark 4.2.0.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-56670 branch April 30, 2026 04:26
dongjoon-hyun added a commit that referenced this pull request May 1, 2026
…s allocator

### What changes were proposed in this pull request?

This PR restricts `ExecutorPVCResizePlugin` to the `direct` pods allocator. When `spark.kubernetes.allocation.pods.allocator` is not `direct`, `init()` logs a warning and returns early.

### Why are the changes needed?

`ExecutorPVCResizePlugin` patches individual executor PVCs directly. This only works when Spark owns each pod and its PVCs (`direct` allocator). For `statefulset` and `deployment` allocators, PVCs are governed by the controller's `volumeClaimTemplates`, so direct patches conflict with the controller.

This mirrors SPARK-56670, which restricted the sibling `ExecutorResizePlugin` for the same reason.
- #55615

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Pass the CIs with new unit tests.

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

Generated-by: Claude Code (Opus 4.7)

Closes #55652 from dongjoon-hyun/SPARK-56702.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants