fix: respect plugin GeneratedNameMaxLength in k8s PluginManager#7625
Open
falloficaruss wants to merge 1 commit into
Open
fix: respect plugin GeneratedNameMaxLength in k8s PluginManager#7625falloficaruss wants to merge 1 commit into
falloficaruss wants to merge 1 commit into
Conversation
Fixes flyteorg#7607 Signed-off-by: Abhishek Shinde <norizzabhii@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7607
Tracking issue
Fixes #7607
When a Ray task runs as a sub-action (i.e. it is launched from a parent workflow or driver task rather than being the root action), the generated resource name follows the format {run}-{action}-{attempt} (e.g., rqfn7vfrdp9j84q86stm-a0d7xyznuli5is847rvhzlkly-0 ), which is typically 48 characters.
However,
KubeRayhas a strict metadata validation constraint restrictingRayJobnames to a maximum of 47 characters. When this limit is exceeded,KubeRayrejects the metadata creation request, causing the workflow task to hang indefinitely.To prevent this, the Ray task plugin declares a
GeneratedNameMaxLengthof 47 in its properties. But the unified Kubernetes plugin manager (PluginManager) in theFlyte v2executor was assigning the object name usingtaskCtx.GetTaskExecutionID().GetGeneratedName()directly without checking or applyingGeneratedNameMaxLength.This PR modifies the plugin manager to check
GeneratedNameMaxLengthand callGetGeneratedNameWithinstead, ensuring that generated resource names are properly bounded and truncated within the limits of the target plugin.What changes were proposed in this pull request?
This PR updates the Kubernetes plugin metadata builder to respect the name length limits specified by plugins:
GeneratedNameMaxLength: Inplugin_manager.go, updated theaddObjectMetadatafunction to inspectpm.plugin.GetProperties().GeneratedNameMaxLength.GetGeneratedNameWith(0, maxLength)instead of GetGeneratedName() to securely bound and truncate the resource name.
validation.IsDNS1123Subdomainensures that trailing hyphens or dot separators resulting from truncation are automatically cleaned up.How was this patch tested?
Unit Tests:
Ran the test suites for the executor plugin package and the Ray task plugin package to ensure that there are no regressions:
Run executor plugin tests
go test -v ./pkg/plugin/...Run Ray plugin tests
go test -v ./go/tasks/plugins/k8s/ray/...Compilation:
Verified that both the manager and executor entry points compile successfully:
go build ./executor/cmd/main.gogo build ./manager/cmd/main.goLabels
Setup process
Screenshots
Check all the applicable boxes
Related PRs
Stack
If you do use
git townto manage PR Stacks, the stack relevant to this PRwill show below. Otherwise, you can ignore this section.
Docs link