Skip to content

Validate targetModels entries for empty modelServerName and nil targets#1086

Closed
madmecodes wants to merge 1 commit into
volcano-sh:mainfrom
madmecodes:fix/modelroute-validate-target-models
Closed

Validate targetModels entries for empty modelServerName and nil targets#1086
madmecodes wants to merge 1 commit into
volcano-sh:mainfrom
madmecodes:fix/modelroute-validate-target-models

Conversation

@madmecodes
Copy link
Copy Markdown
Contributor

Summary

  • Add webhook validation to reject targetModels entries with empty modelServerName
  • Add webhook validation to reject nil target model entries in targetModels
  • Add test cases covering empty modelServerName, nil targets, and mixed valid/invalid entries

Fixes #1060

Test plan

  • Unit tests added for empty modelServerName validation
  • Unit tests added for nil target model entry validation
  • Unit tests added for mixed valid and invalid targetModels entries
  • All existing tests continue to pass

Reject targetModels entries with empty modelServerName and nil target
entries during webhook validation, preventing invalid objects from
reaching the router datastore.

Fixes volcano-sh#1060

Signed-off-by: Ayush Gupta <ayushguptadev1@gmail.com>
Signed-off-by: madmecodes <ayushguptadev1@gmail.com>
Copilot AI review requested due to automatic review settings May 17, 2026 10:12
@volcano-sh-bot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign hzxuzhonghu for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enhances the ModelRoute validation logic in the kthena-router webhook by ensuring that target models are not nil and that the ModelServerName field is populated. Additionally, it includes comprehensive unit tests to verify these new validation constraints across various scenarios, including nil entries and empty strings. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds webhook validation for targetModels entries to reject nil entries and entries with an empty modelServerName.

Changes:

  • Add per-target validation loop in validateModelRoute.
  • Add three new test cases for empty modelServerName, nil target, and mixed invalid entries.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/kthena-router/webhook/validator.go Iterates targetModels to flag nil entries and empty modelServerName.
pkg/kthena-router/webhook/validator_test.go Adds test cases covering the new validation paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@FAUST-BENCHOU
Copy link
Copy Markdown
Contributor

duplicate with #1061

@madmecodes
Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #1061, which was submitted first. Thanks for pointing it out!

@madmecodes madmecodes closed this May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ModelRoute should reject invalid targetModels entries

4 participants