Skip to content

Commit

Permalink
fix(policies): use GatewayAPI style header modifier in all policies
Browse files Browse the repository at this point in the history
MeshHealthCheck and MeshRateLimit didn't adopt the same style of
headers.
This is important for api coherency

Fix #5712

Signed-off-by: Charly Molter <charly.molter@konghq.com>
  • Loading branch information
lahabana committed Jan 19, 2023
1 parent f3b869d commit e1383a6
Show file tree
Hide file tree
Showing 33 changed files with 1,006 additions and 531 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ var (
type HeaderMatcher struct {
// +kubebuilder:validation:Enum=REGULAR_EXPRESSION;EXACT;PREFIX
Type HeaderMatcherType `json:"type,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Name HeaderName `json:"name,omitempty"`
Value HeaderValue `json:"value,omitempty"`
}

// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Pattern=`^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$`
type HeaderName string

type HeaderValue string
Original file line number Diff line number Diff line change
Expand Up @@ -682,24 +682,46 @@ spec:
requestHeadersToAdd:
description: The list of HTTP headers which should be
added to each health check request
items:
properties:
append:
default: true
description: If true (default) the header values
should be appended to already present ones
type: boolean
key:
description: Header name
type: string
value:
description: Header value
type: string
required:
- key
- value
type: object
type: array
properties:
add:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
set:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
type: object
type: object
initialJitter:
description: If specified, Envoy will start health checking
Expand Down Expand Up @@ -1636,23 +1658,46 @@ spec:
headers:
description: The Headers to be added to the
HTTP response on a rate limit event
items:
properties:
append:
default: true
description: Should the header be appended
type: boolean
key:
description: Header name
type: string
value:
description: Header value
type: string
required:
- key
- value
type: object
type: array
properties:
add:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
set:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
type: object
status:
description: The HTTP status code to be set
on a rate limit event
Expand Down Expand Up @@ -1994,6 +2039,9 @@ spec:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
type:
enum:
Expand All @@ -2013,6 +2061,9 @@ spec:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
type:
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,24 +682,46 @@ spec:
requestHeadersToAdd:
description: The list of HTTP headers which should be
added to each health check request
items:
properties:
append:
default: true
description: If true (default) the header values
should be appended to already present ones
type: boolean
key:
description: Header name
type: string
value:
description: Header value
type: string
required:
- key
- value
type: object
type: array
properties:
add:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
set:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
type: object
type: object
initialJitter:
description: If specified, Envoy will start health checking
Expand Down Expand Up @@ -1636,23 +1658,46 @@ spec:
headers:
description: The Headers to be added to the
HTTP response on a rate limit event
items:
properties:
append:
default: true
description: Should the header be appended
type: boolean
key:
description: Header name
type: string
value:
description: Header value
type: string
required:
- key
- value
type: object
type: array
properties:
add:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
set:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
value:
type: string
required:
- name
- value
type: object
maxItems: 16
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
type: object
status:
description: The HTTP status code to be set
on a rate limit event
Expand Down Expand Up @@ -1994,6 +2039,9 @@ spec:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
type:
enum:
Expand All @@ -2013,6 +2061,9 @@ spec:
items:
properties:
name:
maxLength: 256
minLength: 1
pattern: ^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$
type: string
type:
enum:
Expand Down
Loading

0 comments on commit e1383a6

Please sign in to comment.