You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apis/v1beta1/gateway_types.go
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -117,6 +117,11 @@ type GatewaySpec struct {
117
117
// +listMapKey=name
118
118
// +kubebuilder:validation:MinItems=1
119
119
// +kubebuilder:validation:MaxItems=64
120
+
// +kubebuilder:validation:XValidation:message="tls must be set for protocols ['HTTPS', 'TLS']",rule="self.all(l, l.protocol in ['HTTPS', 'TLS'] ? has(l.tls) : true)"
121
+
// +kubebuilder:validation:XValidation:message="tls must be empty for protocols ['HTTP', 'TCP', 'UDP']",rule="self.all(l, l.protocol in ['HTTP', 'TCP', 'UDP'] ? !has(l.tls) : true)"
122
+
// +kubebuilder:validation:XValidation:message="hostname must be empty for protocols ['TCP', 'UDP']",rule="self.all(l, l.protocol in ['TCP', 'UDP'] ? (!has(l.hostname) || l.hostname == '') : true)"
123
+
// +kubebuilder:validation:XValidation:message="Listener name must be unique within the Gateway",rule="self.all(l1, self.exists_one(l2, l1.name == l2.name))"
124
+
// +kubebuilder:validation:XValidation:message="Combination of port, protocol and hostname must be unique for each listener",rule="self.all(l1, self.exists_one(l2, l1.port == l2.port && l1.protocol == l2.protocol && (has(l1.hostname) && has(l2.hostname) ? l1.hostname == l2.hostname : true)))"
120
125
Listeners []Listener`json:"listeners"`
121
126
122
127
// Infrastructure defines infrastructure level attributes about this Gateway instance.
// GatewayTLSConfig describes a TLS configuration.
371
+
//
372
+
// +kubebuilder:validation:XValidation:message="certificateRefs must be set and not empty when TLSModeType is Terminate",rule="self.mode == 'Terminate' ? size(self.certificateRefs) > 0 : true"
364
373
typeGatewayTLSConfigstruct {
365
374
// Mode defines the TLS behavior for the TLS session initiated by the client.
366
375
// There are two possible modes:
@@ -526,6 +535,8 @@ type RouteGroupKind struct {
526
535
}
527
536
528
537
// GatewayAddress describes an address that can be bound to a Gateway.
538
+
//
539
+
// +kubebuilder:validation:XValidation:message="Hostname value must only contain valid characters (matching ^(\\*\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$)",rule="self.type == 'Hostname' ? self.value.matches('^(\\\\*\\\\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$'): true"
0 commit comments