diff --git a/apis/zalando.org/v1/types.go b/apis/zalando.org/v1/types.go index 32ec2e7..fa1aeb8 100644 --- a/apis/zalando.org/v1/types.go +++ b/apis/zalando.org/v1/types.go @@ -43,6 +43,7 @@ type RouteGroupList struct { type RouteGroupSpec struct { // List of hostnames for the RouteGroup // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:XValidation:rule="self.all(i, size(self.filter(j, j==i)) == 1)", message="hosts can not contain duplicates" Hosts []string `json:"hosts,omitempty"` // List of backends that can be referenced in the routes Backends []RouteGroupBackend `json:"backends"` diff --git a/zalando.org_routegroups.yaml b/zalando.org_routegroups.yaml index 04236eb..1b2b264 100644 --- a/zalando.org_routegroups.yaml +++ b/zalando.org_routegroups.yaml @@ -136,6 +136,9 @@ spec: type: string minItems: 1 type: array + x-kubernetes-validations: + - message: hosts can not contain duplicates + rule: self.all(i, size(self.filter(j, j==i)) == 1) routes: description: Routes describe how a matching HTTP request is handled and where it is forwarded to