Skip to content

Commit

Permalink
operator; fix max-targets validation for Streams
Browse files Browse the repository at this point in the history
  • Loading branch information
zolug committed Feb 6, 2023
1 parent a76d340 commit 6538230
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/v1/stream_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func (r *Stream) validateUpdate(oldObj runtime.Object) error {
return apierrors.NewForbidden(r.GroupResource(),
r.Name, field.Forbidden(field.NewPath("metadata", "labels", "trench"), "update on trench label is forbidden"))
}
if r.Spec.MaxTargets != old.Spec.MaxTargets {
if r.Spec.MaxTargets != old.Spec.MaxTargets &&
(r.Spec.MaxTargets == nil || old.Spec.MaxTargets == nil || *r.Spec.MaxTargets != *old.Spec.MaxTargets) {
return apierrors.NewForbidden(r.GroupResource(),
r.Name, field.Forbidden(field.NewPath("metadata", "spec", "max-targets"), "update on max-targets is forbidden"))
}
Expand Down

0 comments on commit 6538230

Please sign in to comment.