Repository navigation
fix(trainer): reject ContainerPatch env entries with both value and valueFrom - #884
Open
SAURABHSALVE wants to merge 1 commit into
Open
SAURABHSALVE wants to merge 1 commit into
SAURABHSALVE wants to merge 1 commit into
Conversation
…alueFrom ContainerPatch.__post_init__ validated that each env entry has at least one of value/valueFrom, but never rejected having both. The Kubernetes API treats these as mutually exclusive (EnvVar.valueFrom: "Cannot be used if value is not empty"), so such a patch passed SDK validation and only failed later when the TrainJob was created. Reject env entries where value is a non-empty string and valueFrom is also set. An empty string value alongside valueFrom is still accepted, matching the Kubernetes API's own exemption for an empty value. Fixes kubeflow#883 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Saurabh Vijay Salve <saurabhsalve9999@gmail.com>
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This branch has not been deployed
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.
What this PR does / why we need it:
ContainerPatch.__post_init__validates eachenventry but only checks that at least one ofvalue/valueFromis present. It never rejects an entry that sets both, even though the Kubernetes API treats them as mutually exclusive:EnvVar.valueFrom's own description is "Cannot be used if value is not empty." Such a patch currently passes SDK validation and only fails later, server-side, when the TrainJob is actually created.This adds a check that rejects an
enventry whenvalueis a non-empty string andvalueFromis also set, matching Kubernetes' own rule. An empty-stringvaluealongsidevalueFromis still accepted, since the Kubernetes API only disallows the combination whenvalueis not empty.Tests:
test_container_patch_validationparametrize for the new rejection.test_container_patch_accepts_valid_env_entriescoveringvalueonly,valueFromonly, and an empty-stringvaluewithvalueFrom, to confirm previously-valid inputs still pass.Which issue(s) this PR fixes:
Fixes #883
Checklist:
🤖 Generated with Claude Code