flyte icon indicating copy to clipboard operation
flyte copied to clipboard

TFJob and MPIJob CRs don't carry the pod template's labels and annotations

Open stantheman0128 opened this issue 1 month ago • 2 comments

On main, the TensorFlow and MPI plugins build their job CR with only TypeMeta and Spec:

  • flyteplugins/go/tasks/plugins/k8s/kfoperators/tensorflow/tensorflow.go lines 139-145
  • flyteplugins/go/tasks/plugins/k8s/kfoperators/mpi/mpi.go lines 144-150

addObjectMetadata in executor/pkg/plugin/k8s/plugin_manager.go then merges in the default and execution labels and annotations, but the object starts out empty, so labels and annotations from the task's pod template never reach the TFJob or MPIJob itself. It is the same problem #8000 described for the JobSet, where controllers such as Kueue read the job object's metadata.

PyTorch had this gap too, and #7833 fixed it by setting the objectMeta returned from flytek8s.ToK8sPodSpec on the PyTorchJob. The Dask and Ray plugins already pass it to the objects they create.

I'd like to take this with the same change as #7833 in both plugins, plus a test in each package modeled on TestBuildResourcePytorchPodTemplateMetadataOnCR. The Spark plugin also drops that objectMeta, but I haven't looked at whether the SparkApplication should get it, so I'm leaving Spark out unless someone wants it included.

stantheman0128 avatar Oct 13 '26 17:10 stantheman0128

#take

stantheman0128 avatar Oct 13 '26 17:10 stantheman0128

You are correct: currently, the TensorFlow and MPI plugins do not propagate pod template labels and annotations to the TFJob and MPIJob CRs, as their objects are initialized with only TypeMeta and Spec. This means metadata from the pod template is lost, similar to the issue previously fixed for PyTorch in #7833, where objectMeta from flytek8s.ToK8sPodSpec is set on the CR itself. Dask and Ray already handle this correctly. A fix would involve applying the same approach as #7833 to both TensorFlow and MPI plugins, and adding tests similar to TestBuildResourcePytorchPodTemplateMetadataOnCR for each plugin, as you described. The Spark plugin's handling of objectMeta is not addressed here and would require separate investigation.

Would you like a step-by-step breakdown of how to implement this fix in the TensorFlow and MPI plugins, including example test code?

Sources:


This is an AI-generated response and your feedback is appreciated! Please leave a 👍 if this is helpful and 👎 if it is not.

Mention @herald to ask follow-up questions. See runllm.com for more!

runllm avatar Oct 13 '26 17:10 runllm