Skip to content

Commit 94d185c

Browse files
authored
implement: wildcard and Regex matching in EarlyRequestHeaders and LateResponseHeaders (#7643)
* impl: support for wildcards in Early Request and Late Response headers Signed-off-by: Huabing Zhao <[email protected]>
1 parent 1cb4bd5 commit 94d185c

23 files changed

+539
-42
lines changed

api/v1alpha1/shared_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ type HTTPHeaderFilter struct {
931931
// +optional
932932
// +listType=map
933933
// +listMapKey=name
934+
// +kubebuilder:validation:MinItems=1
934935
// +kubebuilder:validation:MaxItems=64
935936
Set []gwapiv1.HTTPHeader `json:"set,omitempty"`
936937

@@ -954,6 +955,7 @@ type HTTPHeaderFilter struct {
954955
// +optional
955956
// +listType=map
956957
// +listMapKey=name
958+
// +kubebuilder:validation:MinItems=1
957959
// +kubebuilder:validation:MaxItems=64
958960
Add []gwapiv1.HTTPHeader `json:"add,omitempty"`
959961

@@ -977,6 +979,15 @@ type HTTPHeaderFilter struct {
977979
//
978980
// +optional
979981
// +listType=set
982+
// +kubebuilder:validation:MinItems=1
980983
// +kubebuilder:validation:MaxItems=64
981984
Remove []string `json:"remove,omitempty"`
985+
986+
// RemoveOnMatch removes headers whose names match the specified string matchers.
987+
// Matching is performed on the header name (case-insensitive).
988+
//
989+
// +optional
990+
// +kubebuilder:validation:MinItems=1
991+
// +kubebuilder:validation:MaxItems=64
992+
RemoveOnMatch []StringMatch `json:"removeOnMatch,omitempty"`
982993
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/gateway-crds-helm/templates/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ spec:
273273
- value
274274
type: object
275275
maxItems: 64
276+
minItems: 1
276277
type: array
277278
x-kubernetes-list-map-keys:
278279
- name
@@ -299,8 +300,40 @@ spec:
299300
items:
300301
type: string
301302
maxItems: 64
303+
minItems: 1
302304
type: array
303305
x-kubernetes-list-type: set
306+
removeOnMatch:
307+
description: |-
308+
RemoveOnMatch removes headers whose names match the specified string matchers.
309+
Matching is performed on the header name (case-insensitive).
310+
items:
311+
description: |-
312+
StringMatch defines how to match any strings.
313+
This is a general purpose match condition that can be used by other EG APIs
314+
that need to match against a string.
315+
properties:
316+
type:
317+
default: Exact
318+
description: Type specifies how to match against a string.
319+
enum:
320+
- Exact
321+
- Prefix
322+
- Suffix
323+
- RegularExpression
324+
type: string
325+
value:
326+
description: Value specifies the string value that the
327+
match must have.
328+
maxLength: 1024
329+
minLength: 1
330+
type: string
331+
required:
332+
- value
333+
type: object
334+
maxItems: 64
335+
minItems: 1
336+
type: array
304337
set:
305338
description: |-
306339
Set overwrites the request with the given header (name, value)
@@ -347,6 +380,7 @@ spec:
347380
- value
348381
type: object
349382
maxItems: 64
383+
minItems: 1
350384
type: array
351385
x-kubernetes-list-map-keys:
352386
- name
@@ -408,6 +442,7 @@ spec:
408442
- value
409443
type: object
410444
maxItems: 64
445+
minItems: 1
411446
type: array
412447
x-kubernetes-list-map-keys:
413448
- name
@@ -434,8 +469,40 @@ spec:
434469
items:
435470
type: string
436471
maxItems: 64
472+
minItems: 1
437473
type: array
438474
x-kubernetes-list-type: set
475+
removeOnMatch:
476+
description: |-
477+
RemoveOnMatch removes headers whose names match the specified string matchers.
478+
Matching is performed on the header name (case-insensitive).
479+
items:
480+
description: |-
481+
StringMatch defines how to match any strings.
482+
This is a general purpose match condition that can be used by other EG APIs
483+
that need to match against a string.
484+
properties:
485+
type:
486+
default: Exact
487+
description: Type specifies how to match against a string.
488+
enum:
489+
- Exact
490+
- Prefix
491+
- Suffix
492+
- RegularExpression
493+
type: string
494+
value:
495+
description: Value specifies the string value that the
496+
match must have.
497+
maxLength: 1024
498+
minLength: 1
499+
type: string
500+
required:
501+
- value
502+
type: object
503+
maxItems: 64
504+
minItems: 1
505+
type: array
439506
set:
440507
description: |-
441508
Set overwrites the request with the given header (name, value)
@@ -482,6 +549,7 @@ spec:
482549
- value
483550
type: object
484551
maxItems: 64
552+
minItems: 1
485553
type: array
486554
x-kubernetes-list-map-keys:
487555
- name

charts/gateway-helm/crds/generated/gateway.envoyproxy.io_clienttrafficpolicies.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ spec:
272272
- value
273273
type: object
274274
maxItems: 64
275+
minItems: 1
275276
type: array
276277
x-kubernetes-list-map-keys:
277278
- name
@@ -298,8 +299,40 @@ spec:
298299
items:
299300
type: string
300301
maxItems: 64
302+
minItems: 1
301303
type: array
302304
x-kubernetes-list-type: set
305+
removeOnMatch:
306+
description: |-
307+
RemoveOnMatch removes headers whose names match the specified string matchers.
308+
Matching is performed on the header name (case-insensitive).
309+
items:
310+
description: |-
311+
StringMatch defines how to match any strings.
312+
This is a general purpose match condition that can be used by other EG APIs
313+
that need to match against a string.
314+
properties:
315+
type:
316+
default: Exact
317+
description: Type specifies how to match against a string.
318+
enum:
319+
- Exact
320+
- Prefix
321+
- Suffix
322+
- RegularExpression
323+
type: string
324+
value:
325+
description: Value specifies the string value that the
326+
match must have.
327+
maxLength: 1024
328+
minLength: 1
329+
type: string
330+
required:
331+
- value
332+
type: object
333+
maxItems: 64
334+
minItems: 1
335+
type: array
303336
set:
304337
description: |-
305338
Set overwrites the request with the given header (name, value)
@@ -346,6 +379,7 @@ spec:
346379
- value
347380
type: object
348381
maxItems: 64
382+
minItems: 1
349383
type: array
350384
x-kubernetes-list-map-keys:
351385
- name
@@ -407,6 +441,7 @@ spec:
407441
- value
408442
type: object
409443
maxItems: 64
444+
minItems: 1
410445
type: array
411446
x-kubernetes-list-map-keys:
412447
- name
@@ -433,8 +468,40 @@ spec:
433468
items:
434469
type: string
435470
maxItems: 64
471+
minItems: 1
436472
type: array
437473
x-kubernetes-list-type: set
474+
removeOnMatch:
475+
description: |-
476+
RemoveOnMatch removes headers whose names match the specified string matchers.
477+
Matching is performed on the header name (case-insensitive).
478+
items:
479+
description: |-
480+
StringMatch defines how to match any strings.
481+
This is a general purpose match condition that can be used by other EG APIs
482+
that need to match against a string.
483+
properties:
484+
type:
485+
default: Exact
486+
description: Type specifies how to match against a string.
487+
enum:
488+
- Exact
489+
- Prefix
490+
- Suffix
491+
- RegularExpression
492+
type: string
493+
value:
494+
description: Value specifies the string value that the
495+
match must have.
496+
maxLength: 1024
497+
minLength: 1
498+
type: string
499+
required:
500+
- value
501+
type: object
502+
maxItems: 64
503+
minItems: 1
504+
type: array
438505
set:
439506
description: |-
440507
Set overwrites the request with the given header (name, value)
@@ -481,6 +548,7 @@ spec:
481548
- value
482549
type: object
483550
maxItems: 64
551+
minItems: 1
484552
type: array
485553
x-kubernetes-list-map-keys:
486554
- name

0 commit comments

Comments
 (0)