Skip to content

Commit

Permalink
validator: remove duplicate hostname from ingress (#2884)
Browse files Browse the repository at this point in the history
Signed-off-by: Mustafa Abdelrahman <mustafa.abdelrahman@zalando.de>
  • Loading branch information
MustafaSaber authored Jan 23, 2024
1 parent 6c33066 commit 072f747
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions dataclients/kubernetes/definitions/ingressvalidator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ func (igv *IngressV1Validator) Validate(item *IngressV1Item) error {
errs = append(errs, igv.validateFilterAnnotation(item.Metadata.Annotations))
errs = append(errs, igv.validatePredicateAnnotation(item.Metadata.Annotations))
errs = append(errs, igv.validateRoutesAnnotation(item.Metadata.Annotations))
errs = append(errs, igv.validateHosts(item))

return errorsJoin(errs...)
}
Expand Down Expand Up @@ -51,15 +50,3 @@ func (igv *IngressV1Validator) validateRoutesAnnotation(annotations map[string]s
}
return nil
}

func (igv *IngressV1Validator) validateHosts(item *IngressV1Item) error {
var errs []error
uniqueHosts := make(map[string]struct{}, len(item.Spec.Rules))
for _, rule := range item.Spec.Rules {
if _, ok := uniqueHosts[rule.Host]; ok {
errs = append(errs, fmt.Errorf("duplicate host %q", rule.Host))
}
uniqueHosts[rule.Host] = struct{}{}
}
return errorsJoin(errs...)
}

0 comments on commit 072f747

Please sign in to comment.