fix: reject empty parent in serving group names#1041
Conversation
|
[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 |
There was a problem hiding this comment.
Pull request overview
Tightens the servingGroupRegex so names with an empty parent (e.g. -1) are rejected, and adds unit tests covering the parser.
Changes:
- Anchor the regex with
^and require a non-empty parent (.+instead of.*). - Minor docstring grammar fix.
- Add
TestGetParentNameAndOrdinalcovering valid and malformed inputs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/model-serving-controller/utils/utils.go | Updated regex to require non-empty parent and anchored start. |
| pkg/model-serving-controller/utils/utils_test.go | Added unit tests for GetParentNameAndOrdinal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request updates the servingGroupRegex in utils.go to include a start-of-string anchor and require a non-empty parent name. It also adds a comprehensive test suite TestGetParentNameAndOrdinal in utils_test.go to verify the regex behavior across various edge cases. I have no feedback to provide.
Signed-off-by: pm-ju <pmdevops29@gmail.com>
76bf296 to
ea301fd
Compare
FAUST-BENCHOU
left a comment
There was a problem hiding this comment.
low priority i think
kthena/pkg/model-serving-controller/utils/utils.go
Lines 78 to 80 in 4db2ddd
Fair, agreed this is a small hardening fix rather than a high-priority issue. I opened it because the parser currently accepts malformed generated names like |
/kind bug
What this PR does / why we need it:
GetParentNameAndOrdinalcurrently accepts names like-1and returns an empty parent with ordinal1.This tightens the generated ServingGroup/role name parser so it only accepts names with a non-empty parent before the final numeric ordinal, for example
vllm-sample-0.This also adds unit coverage for valid generated names and malformed inputs.
Verification:
go test ./pkg/model-serving-controller/utils