Skip to content

Commit f49dc68

Browse files
authored
Merge pull request #1920 from jackfrancis/validate-max-pods-typed-error
use api-machinery-typed Error for MaxPods validation
2 parents 7a6f478 + 7f45b09 commit f49dc68

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

exp/api/v1beta1/azuremanagedmachinepool_webhook.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ func (r *AzureManagedMachinePool) validateLastSystemNodePool(cli client.Client)
195195
func (r *AzureManagedMachinePool) validateMaxPods() error {
196196
if r.Spec.MaxPods != nil {
197197
if to.Int32(r.Spec.MaxPods) < 10 || to.Int32(r.Spec.MaxPods) > 250 {
198-
return errors.New("MaxPods must be between 10 and 250")
198+
return field.Invalid(
199+
field.NewPath("Spec", "MaxPods"),
200+
r.Spec.MaxPods,
201+
"MaxPods must be between 10 and 250")
199202
}
200203
}
201204

0 commit comments

Comments
 (0)