@@ -298,6 +298,7 @@ type HTTPPathMatch struct {
298
298
//
299
299
// +optional
300
300
// +kubebuilder:default="/"
301
+ // +kubebuilder:validation:MaxLength=1024
301
302
Value * string `json:"value,omitempty"`
302
303
}
303
304
@@ -318,6 +319,13 @@ const (
318
319
HeaderMatchImplementationSpecific HeaderMatchType = "ImplementationSpecific"
319
320
)
320
321
322
+ // HTTPHeaderName is the name of an HTTP header.
323
+ //
324
+ // +kubebuilder:validation:MinLength=1
325
+ // +kubebuilder:validation:MaxLength=256
326
+ // +kubebuilder:validation:Pattern=`^[-A-Za-z0-9]+$`
327
+ type HTTPHeaderName string
328
+
321
329
// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
322
330
// headers.
323
331
type HTTPHeaderMatch struct {
@@ -344,10 +352,7 @@ type HTTPHeaderMatch struct {
344
352
// entries with an equivalent header name MUST be ignored. Due to the
345
353
// case-insensitivity of header names, "foo" and "Foo" are considered
346
354
// equivalent.
347
- //
348
- // +kubebuilder:validation:MinLength=1
349
- // +kubebuilder:validation:MaxLength=256
350
- Name string `json:"name"`
355
+ Name HTTPHeaderName `json:"name"`
351
356
352
357
// Value is the value of HTTP Header to be matched.
353
358
//
@@ -453,14 +458,20 @@ type HTTPRouteMatch struct {
453
458
// ANDed together, meaning, a request must match all the specified headers
454
459
// to select the route.
455
460
//
461
+ // +listType=map
462
+ // +listMapKey=name
456
463
// +optional
464
+ // +kubebuilder:validation:MaxItems=16
457
465
Headers []HTTPHeaderMatch `json:"headers,omitempty"`
458
466
459
467
// QueryParams specifies HTTP query parameter matchers. Multiple match
460
468
// values are ANDed together, meaning, a request must match all the
461
469
// specified query parameters to select the route.
462
470
//
471
+ // +listType=map
472
+ // +listMapKey=name
463
473
// +optional
474
+ // +kubebuilder:validation:MaxItems=16
464
475
QueryParams []HTTPQueryParamMatch `json:"queryParams,omitempty"`
465
476
466
477
// Method specifies HTTP method matcher.
@@ -604,10 +615,7 @@ type HTTPHeader struct {
604
615
// entries with an equivalent header name MUST be ignored. Due to the
605
616
// case-insensitivity of header names, "foo" and "Foo" are considered
606
617
// equivalent.
607
- //
608
- // +kubebuilder:validation:MinLength=1
609
- // +kubebuilder:validation:MaxLength=256
610
- Name string `json:"name"`
618
+ Name HTTPHeaderName `json:"name"`
611
619
612
620
// Value is the value of HTTP Header to be matched.
613
621
//
@@ -634,6 +642,7 @@ type HTTPRequestHeaderFilter struct {
634
642
// my-header: bar
635
643
//
636
644
// +optional
645
+ // +kubebuilder:validation:MaxItems=16
637
646
Set []HTTPHeader `json:"set,omitempty"`
638
647
639
648
// Add adds the given header(s) (name, value) to the request
@@ -653,6 +662,7 @@ type HTTPRequestHeaderFilter struct {
653
662
// my-header: bar
654
663
//
655
664
// +optional
665
+ // +kubebuilder:validation:MaxItems=16
656
666
Add []HTTPHeader `json:"add,omitempty"`
657
667
658
668
// Remove the given header(s) from the HTTP request before the
@@ -688,30 +698,34 @@ type HTTPRequestRedirect struct {
688
698
//
689
699
// +optional
690
700
// +kubebuilder:validation:Enum=HTTP;HTTPS
701
+
691
702
Protocol * string `json:"protocol,omitempty"`
703
+
692
704
// Hostname is the hostname to be used in the value of the `Location`
693
705
// header in the response.
694
706
// When empty, the hostname of the request is used.
695
707
//
696
708
// Support: Core
697
709
//
698
710
// +optional
699
- Hostname * string `json:"hostname,omitempty"`
711
+ Hostname * Hostname `json:"hostname,omitempty"`
712
+
700
713
// Port is the port to be used in the value of the `Location`
701
714
// header in the response.
702
715
// When empty, port (if specified) of the request is used.
703
716
//
704
717
// Support: Extended
705
718
//
706
719
// +optional
707
- Port * int `json:"port,omitempty"`
720
+ Port * PortNumber `json:"port,omitempty"`
721
+
708
722
// StatusCode is the HTTP status code to be used in response.
709
723
//
710
724
// Support: Core
711
725
//
712
726
// +optional
713
727
// +kubebuilder:default=302
714
- // +kubebuilder:validation=301;302
728
+ // +kubebuilder:validation:Enum =301;302
715
729
StatusCode * int `json:"statusCode,omitempty"`
716
730
}
717
731
0 commit comments