Skip to content

Commit

Permalink
crd: require unique hosts (#613)
Browse files Browse the repository at this point in the history
Require unique non-empty hosts for ingress and routegroup specs.

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Apr 11, 2024
1 parent 8773eda commit 4a50b90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions docs/stack_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,9 @@ spec:
hosts:
items:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
metadata:
description: EmbeddedObjectMetaWithAnnotations defines the metadata
which can be attached to a resource. It's a slimmed down version
Expand Down Expand Up @@ -684,9 +686,6 @@ spec:
empty selector ({}) matches all namespaces.
properties:
matchExpressions:
description: matchExpressions is a list
of label selector requirements. The
requirements are ANDed.
items:
properties:
key:
Expand Down Expand Up @@ -7627,7 +7626,9 @@ spec:
description: Hosts is the list of hostnames to add to the routegroup.
items:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
lbAlgorithm:
description: The load balancing algorithm used for the generated
per stack backends.
Expand Down
4 changes: 4 additions & 0 deletions docs/stackset_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ spec:
hosts:
items:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
metadata:
description: EmbeddedObjectMetaWithAnnotations defines the metadata
which can be attached to a resource. It's a slimmed down version
Expand Down Expand Up @@ -192,7 +194,9 @@ spec:
description: Hosts is the list of hostnames to add to the routegroup.
items:
type: string
minItems: 1
type: array
x-kubernetes-list-type: set
lbAlgorithm:
description: The load balancing algorithm used for the generated
per stack backends.
Expand Down
8 changes: 6 additions & 2 deletions pkg/apis/zalando.org/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ type EmbeddedObjectMeta struct {
// +k8s:deepcopy-gen=true
type StackSetIngressSpec struct {
EmbeddedObjectMetaWithAnnotations `json:"metadata,omitempty"`
Hosts []string `json:"hosts"`
BackendPort intstr.IntOrString `json:"backendPort"`
// +kubebuilder:validation:MinItems=1
// +listType=set
Hosts []string `json:"hosts"`
BackendPort intstr.IntOrString `json:"backendPort"`

// +optional
Path string `json:"path"`
Expand All @@ -131,6 +133,8 @@ type StackSetExternalIngressSpec struct {
type RouteGroupSpec struct {
EmbeddedObjectMetaWithAnnotations `json:"metadata,omitempty"`
// Hosts is the list of hostnames to add to the routegroup.
// +kubebuilder:validation:MinItems=1
// +listType=set
Hosts []string `json:"hosts"`
// AdditionalBackends is the list of additional backends to use for
// routing.
Expand Down

0 comments on commit 4a50b90

Please sign in to comment.