From e54e727640c2d28764a16483a0a3dca51e49d6b9 Mon Sep 17 00:00:00 2001 From: Alexander Yastrebov Date: Wed, 6 Mar 2024 16:37:25 +0100 Subject: [PATCH] crd: add minItems for hosts The hosts field is not required but it should have at least one item when specified. Signed-off-by: Alexander Yastrebov --- apis/zalando.org/v1/types.go | 1 + zalando.org_routegroups.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/apis/zalando.org/v1/types.go b/apis/zalando.org/v1/types.go index 1221000..32ec2e7 100644 --- a/apis/zalando.org/v1/types.go +++ b/apis/zalando.org/v1/types.go @@ -42,6 +42,7 @@ type RouteGroupList struct { // +k8s:deepcopy-gen=true type RouteGroupSpec struct { // List of hostnames for the RouteGroup + // +kubebuilder:validation:MinItems=1 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 f06f7e7..04236eb 100644 --- a/zalando.org_routegroups.yaml +++ b/zalando.org_routegroups.yaml @@ -134,6 +134,7 @@ spec: items: pattern: "^[a-z0-9]([-a-z0-9]*[a-z0-9])?([.][a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" type: string + minItems: 1 type: array routes: description: Routes describe how a matching HTTP request is handled