cuddly-jelly-27016
06/03/2025, 12:21 PMtask_resource_defaults, while other resources like nvidia.com/gpu and rdma/infiniband are preserved correctly.
## Expected Behavior
Pod template resources should have higher priority than platform defaults but lower priority than explicit resource overrides, following this priority order:
1. Resource overrides (highest priority)
2. Container inline resources
3. PodTemplate resources ← This should be preserved
4. Platform/task resource defaults (lowest priority)
## Current Behavior
CPU and memory from PodTemplate are being overwritten by task resource defaults, while GPU and RDMA resources work correctly.
## Example
Given this PodTemplate resources section:
resources:
requests:
cpu: "55"
memory: "1837Gi"
nvidia.com/gpu: "120"
rdma/infiniband: "63"
limits:
cpu: "55"
memory: "1837Gi"
nvidia.com/gpu: "120"
rdma/infiniband: "63"
Current Result:
• ✅ nvidia.com/gpu and rdma/infiniband are preserved
• ❌ cpu and memory are overwritten by task defaults
Expected Result:
• ✅ All resources from PodTemplate should be preserved when not explicitly overridden
## Root Cause
The issue is in the resource merging logic where PodTemplate resources are not being considered during the container resource customization phase in AddFlyteCustomizationsToContainer.
## Proposed Solution
1. Fetch base pod template early in ApplyFlytePodConfiguration
2. Extract container resources from the pod template
3. Pass these resources to an enhanced customization function
4. Implement proper resource priority merging with the correct precedence order
## Impact
In our case, we're using a multi-cluster deployment of Flyte, and our infrastructure is very heterogeneous in terms of resources, storage and network. We want to make sure our "infra" related code (such as PodTemplate) is separated from the Flyte workflow definitions. This is especially convenient where we have a lot of tasks that are occupying a node fully, regardless of the amount of resources there are (e.g in case there is 10 CPUs in nodes - we assign 9 CPUs, in case there is 200 CPUs - we assign 199, and so on).
This affects users who rely on PodTemplates to specify consistent resource requirements across their Flyte tasks, particularly those using specialized resources alongside standard CPU/memory requirements.
### Additional context to reproduce
1. Setup a task with specifying pod_template_name, specifying resources.limits and resources.requests in there.
2. Upon pod creation, your resources will be treated as unset and will be overwritten by platform (or config, if unset) defaults
### Screenshots
No response
### Are you sure this issue hasn't been raised already?
• Yes
### Have you read the Code of Conduct?
• Yes
flyteorg/flytecuddly-jelly-27016
07/02/2025, 12:38 AM