@@ -262,6 +262,7 @@ type HTTPPathMatch struct {
262
262
//
263
263
// +optional
264
264
// +kubebuilder:default="/"
265
+ // +kubebuilder:validation:MaxLength=1024
265
266
Value * string `json:"value,omitempty"`
266
267
}
267
268
@@ -282,6 +283,13 @@ const (
282
283
HeaderMatchImplementationSpecific HeaderMatchType = "ImplementationSpecific"
283
284
)
284
285
286
+ // HTTPHeaderName is the name of an HTTP header.
287
+ //
288
+ // +kubebuilder:validation:MinLength=1
289
+ // +kubebuilder:validation:MaxLength=256
290
+ // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$`
291
+ type HTTPHeaderName string
292
+
285
293
// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
286
294
// headers.
287
295
type HTTPHeaderMatch struct {
@@ -314,10 +322,7 @@ type HTTPHeaderMatch struct {
314
322
// Generally, proxies should follow the guidance from the RFC:
315
323
// https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
316
324
// processing a repeated header, with special handling for "Set-Cookie".
317
- //
318
- // +kubebuilder:validation:MinLength=1
319
- // +kubebuilder:validation:MaxLength=256
320
- Name string `json:"name"`
325
+ Name HTTPHeaderName `json:"name"`
321
326
322
327
// Value is the value of HTTP Header to be matched.
323
328
//
@@ -423,14 +428,20 @@ type HTTPRouteMatch struct {
423
428
// ANDed together, meaning, a request must match all the specified headers
424
429
// to select the route.
425
430
//
431
+ // +listType=map
432
+ // +listMapKey=name
426
433
// +optional
434
+ // +kubebuilder:validation:MaxItems=16
427
435
Headers []HTTPHeaderMatch `json:"headers,omitempty"`
428
436
429
437
// QueryParams specifies HTTP query parameter matchers. Multiple match
430
438
// values are ANDed together, meaning, a request must match all the
431
439
// specified query parameters to select the route.
432
440
//
441
+ // +listType=map
442
+ // +listMapKey=name
433
443
// +optional
444
+ // +kubebuilder:validation:MaxItems=16
434
445
QueryParams []HTTPQueryParamMatch `json:"queryParams,omitempty"`
435
446
436
447
// Method specifies HTTP method matcher.
@@ -574,10 +585,7 @@ type HTTPHeader struct {
574
585
// entries with an equivalent header name MUST be ignored. Due to the
575
586
// case-insensitivity of header names, "foo" and "Foo" are considered
576
587
// equivalent.
577
- //
578
- // +kubebuilder:validation:MinLength=1
579
- // +kubebuilder:validation:MaxLength=256
580
- Name string `json:"name"`
588
+ Name HTTPHeaderName `json:"name"`
581
589
582
590
// Value is the value of HTTP Header to be matched.
583
591
//
@@ -604,6 +612,9 @@ type HTTPRequestHeaderFilter struct {
604
612
// my-header: bar
605
613
//
606
614
// +optional
615
+ // +listType=map
616
+ // +listMapKey=name
617
+ // +kubebuilder:validation:MaxItems=16
607
618
Set []HTTPHeader `json:"set,omitempty"`
608
619
609
620
// Add adds the given header(s) (name, value) to the request
@@ -623,6 +634,9 @@ type HTTPRequestHeaderFilter struct {
623
634
// my-header: bar
624
635
//
625
636
// +optional
637
+ // +listType=map
638
+ // +listMapKey=name
639
+ // +kubebuilder:validation:MaxItems=16
626
640
Add []HTTPHeader `json:"add,omitempty"`
627
641
628
642
// Remove the given header(s) from the HTTP request before the
@@ -659,29 +673,32 @@ type HTTPRequestRedirect struct {
659
673
// +optional
660
674
// +kubebuilder:validation:Enum=HTTP;HTTPS
661
675
Protocol * string `json:"protocol,omitempty"`
676
+
662
677
// Hostname is the hostname to be used in the value of the `Location`
663
678
// header in the response.
664
679
// When empty, the hostname of the request is used.
665
680
//
666
681
// Support: Core
667
682
//
668
683
// +optional
669
- Hostname * string `json:"hostname,omitempty"`
684
+ Hostname * Hostname `json:"hostname,omitempty"`
685
+
670
686
// Port is the port to be used in the value of the `Location`
671
687
// header in the response.
672
688
// When empty, port (if specified) of the request is used.
673
689
//
674
690
// Support: Extended
675
691
//
676
692
// +optional
677
- Port * int `json:"port,omitempty"`
693
+ Port * PortNumber `json:"port,omitempty"`
694
+
678
695
// StatusCode is the HTTP status code to be used in response.
679
696
//
680
697
// Support: Core
681
698
//
682
699
// +optional
683
700
// +kubebuilder:default=302
684
- // +kubebuilder:validation=301;302
701
+ // +kubebuilder:validation:Enum =301;302
685
702
StatusCode * int `json:"statusCode,omitempty"`
686
703
}
687
704
0 commit comments