@@ -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,24 @@ const (
282
283
HeaderMatchImplementationSpecific HeaderMatchType = "ImplementationSpecific"
283
284
)
284
285
286
+ // HTTPHeaderName is the name of an HTTP header.
287
+ //
288
+ // Valid values include:
289
+ //
290
+ // * "Authorization"
291
+ // * "Set-Cookie"
292
+ //
293
+ // Invalid values include:
294
+ //
295
+ // * ":method" - ":" is an invalid character. This means that pseudo headers are
296
+ // not currently supported by this type.
297
+ // * "/invalid" - "/" is an invalid character
298
+ //
299
+ // +kubebuilder:validation:MinLength=1
300
+ // +kubebuilder:validation:MaxLength=256
301
+ // +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$`
302
+ type HTTPHeaderName string
303
+
285
304
// HTTPHeaderMatch describes how to select a HTTP route by matching HTTP request
286
305
// headers.
287
306
type HTTPHeaderMatch struct {
@@ -314,10 +333,7 @@ type HTTPHeaderMatch struct {
314
333
// Generally, proxies should follow the guidance from the RFC:
315
334
// https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
316
335
// 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"`
336
+ Name HTTPHeaderName `json:"name"`
321
337
322
338
// Value is the value of HTTP Header to be matched.
323
339
//
@@ -423,14 +439,20 @@ type HTTPRouteMatch struct {
423
439
// ANDed together, meaning, a request must match all the specified headers
424
440
// to select the route.
425
441
//
442
+ // +listType=map
443
+ // +listMapKey=name
426
444
// +optional
445
+ // +kubebuilder:validation:MaxItems=16
427
446
Headers []HTTPHeaderMatch `json:"headers,omitempty"`
428
447
429
448
// QueryParams specifies HTTP query parameter matchers. Multiple match
430
449
// values are ANDed together, meaning, a request must match all the
431
450
// specified query parameters to select the route.
432
451
//
452
+ // +listType=map
453
+ // +listMapKey=name
433
454
// +optional
455
+ // +kubebuilder:validation:MaxItems=16
434
456
QueryParams []HTTPQueryParamMatch `json:"queryParams,omitempty"`
435
457
436
458
// Method specifies HTTP method matcher.
@@ -574,10 +596,7 @@ type HTTPHeader struct {
574
596
// entries with an equivalent header name MUST be ignored. Due to the
575
597
// case-insensitivity of header names, "foo" and "Foo" are considered
576
598
// equivalent.
577
- //
578
- // +kubebuilder:validation:MinLength=1
579
- // +kubebuilder:validation:MaxLength=256
580
- Name string `json:"name"`
599
+ Name HTTPHeaderName `json:"name"`
581
600
582
601
// Value is the value of HTTP Header to be matched.
583
602
//
@@ -604,6 +623,9 @@ type HTTPRequestHeaderFilter struct {
604
623
// my-header: bar
605
624
//
606
625
// +optional
626
+ // +listType=map
627
+ // +listMapKey=name
628
+ // +kubebuilder:validation:MaxItems=16
607
629
Set []HTTPHeader `json:"set,omitempty"`
608
630
609
631
// Add adds the given header(s) (name, value) to the request
@@ -623,6 +645,9 @@ type HTTPRequestHeaderFilter struct {
623
645
// my-header: bar
624
646
//
625
647
// +optional
648
+ // +listType=map
649
+ // +listMapKey=name
650
+ // +kubebuilder:validation:MaxItems=16
626
651
Add []HTTPHeader `json:"add,omitempty"`
627
652
628
653
// Remove the given header(s) from the HTTP request before the
@@ -659,29 +684,32 @@ type HTTPRequestRedirect struct {
659
684
// +optional
660
685
// +kubebuilder:validation:Enum=HTTP;HTTPS
661
686
Protocol * string `json:"protocol,omitempty"`
687
+
662
688
// Hostname is the hostname to be used in the value of the `Location`
663
689
// header in the response.
664
690
// When empty, the hostname of the request is used.
665
691
//
666
692
// Support: Core
667
693
//
668
694
// +optional
669
- Hostname * string `json:"hostname,omitempty"`
695
+ Hostname * Hostname `json:"hostname,omitempty"`
696
+
670
697
// Port is the port to be used in the value of the `Location`
671
698
// header in the response.
672
699
// When empty, port (if specified) of the request is used.
673
700
//
674
701
// Support: Extended
675
702
//
676
703
// +optional
677
- Port * int `json:"port,omitempty"`
704
+ Port * PortNumber `json:"port,omitempty"`
705
+
678
706
// StatusCode is the HTTP status code to be used in response.
679
707
//
680
708
// Support: Core
681
709
//
682
710
// +optional
683
711
// +kubebuilder:default=302
684
- // +kubebuilder:validation=301;302
712
+ // +kubebuilder:validation:Enum =301;302
685
713
StatusCode * int `json:"statusCode,omitempty"`
686
714
}
687
715
0 commit comments