<#7443 feat: apply extended resources to Ray head ...
# flyte-github
a
#7443 feat: apply extended resources to Ray head and worker pod specs Pull request opened by pingsutw Why are the changes needed? Ray tasks could not request non-standard resources (GPU accelerators, shared memory) per Ray group. The task-level
extended_resources
were applied to the base pod spec, but there was no way to configure a GPU accelerator or shared-memory volume specifically for the head group vs. an individual worker group. This is needed for clusters where the head and workers (or different worker groups) run on different accelerator types. What changes were proposed in this pull request? • Added
extended_resources
(
flyteidl2.core.ExtendedResources
) to
HeadGroupSpec
and
WorkerGroupSpec
in
flyteidl2/plugins/ray.proto
, and regenerated the Go bindings. • Extracted the GPU accelerator (node selectors, tolerations, MIG partition label) and shared-memory application logic out of
ToK8sPodSpec
into a reusable exported helper
flytek8s.ApplyExtendedResources(podSpec, objectMeta, primaryContainerName, extendedResources)
.
ToK8sPodSpec
now calls this helper, so behavior for the task-level path is unchanged. • The Ray plugin (
buildHeadPodTemplate
/
buildWorkerPodTemplate
) now applies each group's
extended_resources
on top of the task-level extended resources already baked into the base pod spec. • The shared
objectMeta
is deep-copied per group before applying, so group-specific labels (e.g. the MIG partition-slices label) don't leak between the head and worker groups. A
nil
group-level
extended_resources
is a no-op, so existing Ray tasks are unaffected. How was this patch tested? • Added
TestBuildResourceRayGroupExtendedResources
, which sets a GPU device on the head group and a different GPU device plus a shared-memory volume on the worker group, then asserts each group's pod gets only its own node selectors / tolerations / volume (and that the shared-memory volume and MIG-style labels do not leak onto the head). • Ran the
ray
and
flytek8s
package test suites (all passing) and
go vet
on both packages (clean). Labels • added Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte