-
Notifications
You must be signed in to change notification settings - Fork 126
fix: validate modelroute target entries #1061
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,6 +180,12 @@ func (v *KthenaRouterValidator) validateModelRoute(modelRoute *networkingv1alpha | |
| if len(rule.TargetModels) == 0 { | ||
| allErrs = append(allErrs, field.Required(ruleField.Child("targetModels"), "each rule must have at least one target model")) | ||
| } | ||
| for j, target := range rule.TargetModels { | ||
| targetField := ruleField.Child("targetModels").Index(j) | ||
| if target != nil && target.ModelServerName == "" { | ||
| allErrs = append(allErrs, field.Required(targetField.Child("modelServerName"), "modelServerName must be specified")) | ||
| } | ||
| } | ||
|
Comment on lines
+183
to
+188
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The validating webhook should also enforce consistency in the |
||
| } | ||
|
|
||
| if len(allErrs) > 0 { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ptal
// +kubebuilder:validation:required, so this is not needed