diff --git a/apis/zalando.org/v1/types.go b/apis/zalando.org/v1/types.go index 32ec2e7..da7bf54 100644 --- a/apis/zalando.org/v1/types.go +++ b/apis/zalando.org/v1/types.go @@ -43,6 +43,8 @@ type RouteGroupList struct { type RouteGroupSpec struct { // List of hostnames for the RouteGroup // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=255 + // +kubebuilder:validation:XValidation:rule="self.all(i, size(self.filter(j, j==i)) == 1)", message="hosts must be unique" 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 f977a68..a3efca9 100644 --- a/zalando.org_routegroups.yaml +++ b/zalando.org_routegroups.yaml @@ -134,8 +134,12 @@ spec: maxLength: 255 pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?([.][a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string + maxItems: 255 minItems: 1 type: array + x-kubernetes-validations: + - message: hosts must be unique + 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