Skip to content

fix(plugins): list only the job's own pods - #8215

Open
madiyar-wayve wants to merge 1 commit into
flyteorg:mainfrom
madiyar-wayve:madiyar/scope-plugin-pod-lists
Open

madiyar-wayve wants to merge 1 commit into
flyteorg:mainfrom
madiyar-wayve:madiyar/scope-plugin-pod-lists

Conversation

@madiyar-wayve

@madiyar-wayve madiyar-wayve commented Oct 21, 2026 •

Copy link
Copy Markdown

Tracking issue

Related to #8051

Why are the changes needed?

The executor gives plugins a reader over every Flyte pod in the cluster. Ray, Dask, PyTorch and the clustered (JobSet) plugin list all of them and pick their own by name prefix, or not at all. Once TaskActions live in per-project-domain namespaces (#8051), the same <run>-<action> names can exist in two namespaces:

  • Ray's head readiness check finds two head pods and errors, so dashboard and IDE links never turn ready.
  • Dask can resolve another job's scheduler pod.
  • PyTorch and JobSet log contexts include another project's pods.

Even within one namespace, a name prefix can match another job whose name starts with this one's, and the PyTorch and clustered log contexts had no filter at all.

What changes were proposed in this pull request?

  • The executor's plugin manager limits the plugin reader's List calls to the namespace of the resource it watches, so plugins don't each have to.
  • Each plugin selects its pods by the label its operator sets: Ray by cluster, Dask by cluster, PyTorch by job name, and clustered by JobSet name (the selector it already uses for worker pods).

Ray's log context also keeps the RayJob's submitter pod, selected by its Kubernetes Job name, since in K8sJobMode it carries the driver's output.

How was this patch tested?

New unit tests, which fail without this change: a plugin-manager test with pods in two namespaces, and plugin tests that add another job's pod (for Ray and Dask, one whose name shares the prefix) and check it is ignored. A Ray test checks the job's own submitter pod stays in the log context.

go test ./flyteplugins/go/tasks/plugins/k8s/... ./executor/...

Labels

  • fixed

Check all the applicable boxes

  • I updated the documentation accordingly.
  • All new and existing tests passed.
  • All commits are signed-off.

🤖 Generated with Claude Code

@popojk popojk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Maybe we can move the in name space filter one level up to plugin manager so we don't need to do this check in every plugin.

func isRayHeadReady(ctx context.Context, namespace, rayJobName string, pluginContext k8s.PluginContext) (bool, error) {
podList := &v1.PodList{}
err := pluginContext.K8sReader().List(ctx, podList)
err := pluginContext.K8sReader().List(ctx, podList, client.InNamespace(namespace))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a ray.io/cluster=<RayClusterName> label filter?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done: head readiness and the log context now select ray.io/cluster=<RayClusterName>.

statusDetails, _ := utils.MarshalObjToStruct(app.Status) //nolint: staticcheck
podList := &v1.PodList{}
err = pluginContext.K8sReader().List(ctx, podList)
err = pluginContext.K8sReader().List(ctx, podList, client.InNamespace(app.Namespace))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a training.kubeflow.org/job-name label filter?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, using kubeflowv1.JobNameLabel.

func isDaskSchedulerReady(ctx context.Context, namespace, daskJobName string, pluginContext k8s.PluginContext) (bool, error) {
podList := &v1.PodList{}
err := pluginContext.K8sReader().List(ctx, podList)
err := pluginContext.K8sReader().List(ctx, podList, client.InNamespace(namespace))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a dask.org/cluster-name label filter?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done for both scheduler lookups. The operator names a DaskJob’s cluster after the job, so the value is the job name.

@popojk

popojk commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

cc @AdilFayyaz

@madiyar-wayve
madiyar-wayve force-pushed the madiyar/scope-plugin-pod-lists branch from 6226b3f to 0c6e5ed Compare October 23, 2026 09:39
@madiyar-wayve madiyar-wayve changed the title fix(plugins): scope pod lists to the job's namespace fix(plugins): list only the job's own pods Oct 23, 2026
@madiyar-wayve
madiyar-wayve force-pushed the madiyar/scope-plugin-pod-lists branch from 0c6e5ed to e853be2 Compare October 23, 2026 10:00
Ray, Dask, PyTorch and clustered listed pods cluster-wide and matched
them by name prefix, which breaks once TaskActions live in separate
namespaces. The executor now limits the plugin reader to the job's
namespace, and each plugin selects its pods by the label its operator
sets (Ray cluster and submitter Job, Dask cluster, PyTorch job, JobSet
name).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Madiyar Aitzhanov <madiyar.aitzhanov@wayve.ai>
@madiyar-wayve
madiyar-wayve force-pushed the madiyar/scope-plugin-pod-lists branch from e853be2 to 618ed4f Compare October 23, 2026 10:13
@madiyar-wayve

Copy link
Copy Markdown
Author

This looks good. Maybe we can move the in name space filter one level up to plugin manager so we don't need to do this check in every plugin.

Thanks for the review @popojk! I made plugin manager to wrap the reader so every List is limited to the namespace of the resource it watches, and removed the per-plugin InNamespace calls.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants