Skip to content

Commit

Permalink
fix: fix KongRoute's spec.headers field type (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Jan 21, 2025
1 parent db66b12 commit 06875e1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Adding a new version? You'll need three changes:

### Changes

- Fix `KongRoute`'s `spec.headers` field type.
[#243](https://github.com/Kong/kubernetes-configuration/pull/243)
- Add a `scope` field to `KongPluginBindingSpec` to allow setting the scope of
the plugin binding. The default value (`OnlyTargets`) is aligned with the previous
default behavior - the plugin will only be applied to the targets specified in the
Expand Down
2 changes: 1 addition & 1 deletion api/configuration/v1alpha1/kongroute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ type KongRouteAPISpec struct {
// A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port".
Destinations []sdkkonnectcomp.Destinations `json:"destinations,omitempty"`
// One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression.
Headers map[string]string `json:"headers,omitempty"`
Headers map[string][]string `json:"headers,omitempty"`
// A list of domain names that match this Route. Note that the hosts value is case sensitive.
Hosts []string `json:"hosts,omitempty"`
// The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol.
Expand Down
13 changes: 11 additions & 2 deletions api/configuration/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ spec:
type: array
headers:
additionalProperties:
type: string
items:
type: string
type: array
description: 'One or more lists of values indexed by header name that
will cause this Route to match if present in the request. The `Host`
header cannot be used with this attribute: hosts should be specified
Expand Down
4 changes: 2 additions & 2 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ to make the code generation required for Kubernetes CRDs work.
| Field | Description |
| --- | --- |
| `destinations` _Destinations array_ | A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". |
| `headers` _object (keys:string, values:string)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `headers` _object (keys:string, values:string array)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `hosts` _string array_ | A list of domain names that match this Route. Note that the hosts value is case sensitive. |
| `https_redirect_status_code` _[HTTPSRedirectStatusCode](#httpsredirectstatuscode)_ | The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. |
| `methods` _string array_ | A list of HTTP methods that match this Route. |
Expand Down Expand Up @@ -1339,7 +1339,7 @@ KongRouteSpec defines spec of a Kong Route.
| `controlPlaneRef` _[ControlPlaneRef](#controlplaneref)_ | ControlPlaneRef is a reference to a ControlPlane this KongRoute is associated with. Route can either specify a ControlPlaneRef and be 'serviceless' route or specify a ServiceRef and be associated with a Service. |
| `serviceRef` _[ServiceRef](#serviceref)_ | ServiceRef is a reference to a Service this KongRoute is associated with. Route can either specify a ControlPlaneRef and be 'serviceless' route or specify a ServiceRef and be associated with a Service. |
| `destinations` _Destinations array_ | A list of IP destinations of incoming connections that match this Route when using stream routing. Each entry is an object with fields "ip" (optionally in CIDR range notation) and/or "port". |
| `headers` _object (keys:string, values:string)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `headers` _object (keys:string, values:string array)_ | One or more lists of values indexed by header name that will cause this Route to match if present in the request. The `Host` header cannot be used with this attribute: hosts should be specified using the `hosts` attribute. When `headers` contains only one value and that value starts with the special prefix `~*`, the value is interpreted as a regular expression. |
| `hosts` _string array_ | A list of domain names that match this Route. Note that the hosts value is case sensitive. |
| `https_redirect_status_code` _[HTTPSRedirectStatusCode](#httpsredirectstatuscode)_ | The status code Kong responds with when all properties of a Route match except the protocol i.e. if the protocol of the request is `HTTP` instead of `HTTPS`. `Location` header is injected by Kong if the field is set to 301, 302, 307 or 308. Note: This config applies only if the Route is configured to only accept the `https` protocol. |
| `methods` _string array_ | A list of HTTP methods that match this Route. |
Expand Down

0 comments on commit 06875e1

Please sign in to comment.