fix(admission): validate subgroup names are lowercase on PodGroup creation#1164
Closed
cluster2600 wants to merge 1 commit intokai-scheduler:mainfrom
Closed
fix(admission): validate subgroup names are lowercase on PodGroup creation#1164cluster2600 wants to merge 1 commit intokai-scheduler:mainfrom
cluster2600 wants to merge 1 commit intokai-scheduler:mainfrom
Conversation
Contributor
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
…ation Closes kai-scheduler#948. The scheduler internally lowercases subgroup parent names via formatParentName(), but this was never enforced at admission time. A user creating a subgroup with mixed-case names would silently hit lookup failures at scheduling time. Add validation in the PodGroup webhook that rejects subgroup names and parent references containing uppercase characters, with a clear error message guiding the user. Signed-off-by: Maxime Grenu <maxime.grenu@gmail.com>
b1da24b to
448ab74
Compare
Author
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.
Closes #948.
Problem
The scheduler internally lowercases subgroup parent names via
formatParentName()inpkg/scheduler/api/podgroup_info/subgroup_info/factory.go, but this constraint was never validated at admission time. A user creating a PodGroup with mixed-case subgroup names (e.g.Workers) would have their resources accepted by the API but then silently hit parent-lookup failures during scheduling, which is quite confusing to diagnose.Solution
Added lowercase validation in the PodGroup validating webhook (
validateSubGroups) that rejects:Both
ValidateCreateandValidateUpdatepaths are covered since they share the same validation function. This ensures the constraint is properly recognised and enforced before the resource reaches the scheduler.Changes
pkg/apis/scheduling/v2alpha2/podgroup_webhook.go— addedstrings.ToLowerchecks forSubGroup.NameandSubGroup.ParentinvalidateSubGroups()pkg/apis/scheduling/v2alpha2/podgroup_webhook_test.go— updated existing test fixtures to use lowercase names (matching the new constraint), added three new test cases:Test plan
TestValidateSubGroupscases pass with lowercase fixture names