fix: use configurable GPU resource name instead of hardcoded nvidia.com/gpu#7237
fix: use configurable GPU resource name instead of hardcoded nvidia.com/gpu#7237nuthalapativarun wants to merge 3 commits intoflyteorg:masterfrom
Conversation
|
I've fixed this in our company's fork and I believe it was more involved than this due to handling of pod templates and needing to normalize the dummy GPU resource name to the configured one. If you can wait a week or two I can probably pull that work into master. |
Oh this looks like some drive by AI assisted pull request so I'll wait to review this until I get back from vacation. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7237 +/- ##
==========================================
- Coverage 56.96% 56.95% -0.01%
==========================================
Files 931 931
Lines 58246 58247 +1
==========================================
- Hits 33178 33173 -5
- Misses 22014 22020 +6
Partials 3054 3054
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…om/gpu Two code paths hardcoded "nvidia.com/gpu" when mapping Flyte GPU resource requirements to Kubernetes ResourceList entries, ignoring the GpuResourceName field available in K8sPluginConfig. This prevented users from using alternative GPU resource types (e.g. amd.com/gpu, intel.com/gpu) even when correctly configured via the gpu-resource-name Helm value. - flyteplugins: ToK8sResourceList now reads GpuResourceName from config.GetK8sPluginConfig() instead of using the ResourceNvidiaGPU constant directly. - flytepropeller: convertTaskResourcesToRequirements now reads GpuResourceName from flytek8sConfig.GetK8sPluginConfig() instead of utils.ResourceNvidiaGPU. - Update tests in both packages to assert against the config-driven key. Closes flyteorg#6746 Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
- Fix gci import ordering in taskexec_context_test.go (flytek8sConfig must come before io/mocks alphabetically) - Set GpuResourceName explicitly in TestBuildResourceRayCustomK8SPod to match resourceRequirements fixture which uses nvidia.com/gpu; empty K8sPluginConfig caused key mismatch after ToK8sResourceList was updated to use configurable GPU resource name Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
18bd4af to
3522587
Compare
|
This has been greatly improved in v2, check the v2 branch - close |
|
Thanks for the context, @Sovietaced — happy to expand the scope to cover pod template normalization and dummy GPU resource name handling as well. If you can point me to the relevant code paths (or describe what your fork's fix looks like at a high level), I can incorporate that before your review. No rush given the vacation timeline. @kumare3 — do you mean this should target the v2 branch instead of master, or that the issue is already resolved there and this PR should be closed? Happy to follow whichever path makes more sense for the project. |
Tracking issue
Closes #6746
Why are the changes needed?
Two code paths hardcoded
"nvidia.com/gpu"when building KubernetesResourceListentries from Flyte GPU resource requirements. This hardcoding took precedence over theGpuResourceNamefield already configurable inK8sPluginConfig(via thegpu-resource-nameHelm/propeller config value), making it impossible to use alternative GPU resource types such asamd.com/gpuorintel.com/gpu.The affected paths were:
flyteplugins/go/tasks/pluginmachinery/flytek8s/utils.go—ToK8sResourceListused the package-levelResourceNvidiaGPUconstant.flytepropeller/pkg/controller/nodes/task/taskexec_context.go—convertTaskResourcesToRequirementsusedutils.ResourceNvidiaGPU.Note that
SanitizeGPUResourceRequirementsandApplyResourceOverridesincontainer_helper.goalready correctly read fromconfig.GetK8sPluginConfig().GpuResourceName. This PR brings the two remaining call sites into alignment.What changes were proposed in this pull request?
flyteplugins/.../flytek8s/utils.go: Importflytek8s/configand replaceResourceNvidiaGPUwithconfig.GetK8sPluginConfig().GpuResourceNameinToK8sResourceList.flytepropeller/.../taskexec_context.go: Importflytek8s/configand replaceutils.ResourceNvidiaGPUwithflytek8sConfig.GetK8sPluginConfig().GpuResourceNameinconvertTaskResourcesToRequirements. Remove now-unusedflytepropeller/pkg/utilsimport.config.GetK8sPluginConfig().GpuResourceNamerather than the hardcoded constant, confirming the behavior is config-driven.How was this patch tested?
go test ./go/tasks/pluginmachinery/flytek8s/...inflyteplugins/— passes.go test ./pkg/controller/nodes/task/...inflytepropeller/— passes.Labels
fixed
I updated the documentation accordingly.
All new and existing tests passed.
All commits are signed-off.