Skip to content

Commit

Permalink
crd: require unique hosts
Browse files Browse the repository at this point in the history
Example validation message:
```
Error from server (Invalid): error when creating "rg.yaml": RouteGroup.zalando.org "duplicate-hosts" is invalid: spec.hosts[1]: Duplicate value: "foo.example.org"
```

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Mar 27, 2024
1 parent 5c0ecfd commit 2593d38
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions apis/zalando.org/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ type RouteGroupList struct {
type RouteGroupSpec struct {
// List of hostnames for the RouteGroup
// +kubebuilder:validation:MinItems=1
// +listType=set
Hosts []string `json:"hosts,omitempty"`
// List of backends that can be referenced in the routes
Backends []RouteGroupBackend `json:"backends"`
Expand Down Expand Up @@ -179,6 +180,7 @@ type RouteGroupTLSSpec struct {
// The values in this list must match the host name(s) used for
// the RouteGroup in order to terminate TLS for the host(s).
// +kubebuilder:validation:MinItems=1
// +listType=set
Hosts []string `json:"hosts"`

// SecretName is the name of the secret used to terminate TLS traffic.
Expand Down
6 changes: 0 additions & 6 deletions client/clientset/versioned/doc.go

This file was deleted.

2 changes: 2 additions & 0 deletions zalando.org_routegroups.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ spec:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
routes:
description: Routes describe how a matching HTTP request is handled
and where it is forwarded to
Expand Down Expand Up @@ -221,6 +222,7 @@ spec:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
secretName:
description: |-
SecretName is the name of the secret used to terminate TLS traffic.
Expand Down

0 comments on commit 2593d38

Please sign in to comment.