[SPARK-56793][K8S] Avoid cluster-wide LIST in executor pods polling#55754
Open
TongWei1105 wants to merge 1 commit intoapache:masterfrom
Open
[SPARK-56793][K8S] Avoid cluster-wide LIST in executor pods polling#55754TongWei1105 wants to merge 1 commit intoapache:masterfrom
TongWei1105 wants to merge 1 commit intoapache:masterfrom
Conversation
### What changes were proposed in this pull request? Scope the executor pod LIST issued by `ExecutorPodsPollingSnapshotSource` to the configured Kubernetes namespace by inserting `.inNamespace(namespace)` between `.pods()` and the label filters. ### Why are the changes needed? Without `.inNamespace(...)` the fabric8 client issues a cluster-wide LIST against the K8s API server. Other paths in the K8s scheduler module (e.g. `KubernetesClusterSchedulerBackend.doKillExecutors`, `ExecutorPodsLifecycleManager`) already scope their pod operations to the configured namespace; the polling source was inconsistent. A cluster-wide LIST: - fails under the typical least-privilege deployment where the driver ServiceAccount is bound to a namespaced Role rather than a ClusterRole; - causes unnecessary load and broadens the visibility surface even when ClusterRole permissions are granted. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Updated `ExecutorPodsPollingSnapshotSourceSuite` to mock the new `.inNamespace(...)` link in the chain. Ran the full `resource-managers/kubernetes/core` test module: 344 tests across 42 suites, all passing. ### Was this patch authored or co-authored using generative AI tooling? No.
Contributor
Author
|
Could you please take a look? @dongjoon-hyun |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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?
Scope the executor pod LIST issued by
ExecutorPodsPollingSnapshotSourceto the configured Kubernetes namespace by inserting.inNamespace(namespace)between.pods()and the label filters.Why are the changes needed?
Without
.inNamespace(...)the fabric8 client issues a cluster-wide LIST against the K8s API server. Other paths in the K8s scheduler module (e.g.KubernetesClusterSchedulerBackend.doKillExecutors,ExecutorPodsLifecycleManager) already scope their pod operations to the configured namespace; the polling source was inconsistent.A cluster-wide LIST:
Does this PR introduce any user-facing change?
No.
How was this patch tested?
Updated
ExecutorPodsPollingSnapshotSourceSuiteto mock the new.inNamespace(...)link in the chain. Ran the fullresource-managers/kubernetes/coretest module: 344 tests across 42 suites, all passing.Was this patch authored or co-authored using generative AI tooling?
Yes,Generated-by: Claude Code 4.7