generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 587
Adding GEP 3171: Percentage-based Request Mirroring #3178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e6beaef
Create index.md
jakebennert 2506395
Create metadata.yaml
jakebennert 377eb60
Update index.md
jakebennert 6ad6511
Update metadata.yaml
jakebennert dd1f61b
Remove 'omitempty' from Fraction fields
jakebennert bf6644a
Merge branch 'kubernetes-sigs:main' into main
jakebennert 494d1ac
Split MirrorPercent into two fields: MirrorPercent and MirrorFraction.
jakebennert d998621
Update index.md
jakebennert 58b8d45
Add config examples.
jakebennert 4768da7
Add Existing Support Table
jakebennert 9c8f672
Update field names to avoid 'stuttering' in names.
jakebennert dbbe4de
Update geps/gep-3171/index.md
jakebennert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# GEP-3171: Percentage-based Request Mirroring | ||
|
||
* Issue: [#3171](https://github.com/kubernetes-sigs/gateway-api/issues/3171) | ||
* Status: **Provisional** | ||
|
||
(See status definitions [here](/geps/overview/#gep-states).) | ||
|
||
## TLDR | ||
|
||
Enhance the existing [Request Mirroring](https://gateway-api.sigs.k8s.io/guides/http-request-mirroring/) feature by allowing users to specify a percentage of requests they'd like mirrored. | ||
|
||
## Goals | ||
|
||
Successfully implement the feature. | ||
|
||
## Introduction | ||
|
||
[Request Mirroring](https://gateway-api.sigs.k8s.io/guides/http-request-mirroring/) is a feature that allows a user to mirror requests going to some backend A along to some other specified backend B. Right now Request Mirroring is an all or nothing feature – either 100% of request are mirrored, or 0% are. Percentage-based Request Mirroring will allow users to specify a percentage of requests they'd like mirrored as opposed to every single request. | ||
|
||
This feature is already [supported by Envoy](https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto#envoy-v3-api-msg-config-route-v3-routeaction-requestmirrorpolicy), so adding it for the Gateway API would enable better integration between the two products. There's also an existing user desire for this feature on the [HAProxy side](https://www.haproxy.com/blog/haproxy-traffic-mirroring-for-real-world-testing) and [NGINX side](https://alex.dzyoba.com/blog/nginx-mirror/). Since Request Mirroring is already supported by the Gateway API, Percentage-based Request Mirroring would a clear improvement on this pre-existing feature. | ||
|
||
jakebennert marked this conversation as resolved.
Show resolved
Hide resolved
|
||
## API | ||
|
||
This GEP proposes the following API changes: | ||
|
||
* Add utility type `Fraction` to [v1/shared_types.go](https://github.com/kubernetes-sigs/gateway-api/blob/cb5bf1541fa70f0692aebde8c64bba434cf331b6/apis/v1/shared_types.go) and include the equivalent type `Percentage`: | ||
|
||
|
||
```go | ||
type Fraction struct { | ||
// +optional | ||
// +kubebuilder:validation:Minimum=0 | ||
Numerator int32 `json:"numerator"` | ||
|
||
// +optional | ||
// +kubebuilder:default=100 | ||
// +kubebuilder:validation:Minimum=1 | ||
Denominator int32 `json:"denominator"` | ||
} | ||
|
||
type Percentage Fraction | ||
``` | ||
|
||
|
||
* Update the `HTTPRequestMirrorFilter` struct to include a `MirrorPercent` field of type `Percentage`: | ||
|
||
|
||
```go | ||
// HTTPRequestMirrorFilter defines configuration for the RequestMirror filter. | ||
type HTTPRequestMirrorFilter struct { | ||
// BackendRef references a resource where mirrored requests are sent. | ||
// | ||
// Mirrored requests must be sent only to a single destination endpoint | ||
// within this BackendRef, irrespective of how many endpoints are present | ||
// within this BackendRef. | ||
// | ||
// If the referent cannot be found, this BackendRef is invalid and must be | ||
// dropped from the Gateway. The controller must ensure the "ResolvedRefs" | ||
// condition on the Route status is set to `status: False` and not configure | ||
// this backend in the underlying implementation. | ||
// | ||
// If there is a cross-namespace reference to an *existing* object | ||
// that is not allowed by a ReferenceGrant, the controller must ensure the | ||
// "ResolvedRefs" condition on the Route is set to `status: False`, | ||
// with the "RefNotPermitted" reason and not configure this backend in the | ||
// underlying implementation. | ||
// | ||
// In either error case, the Message of the `ResolvedRefs` Condition | ||
// should be used to provide more detail about the problem. | ||
// | ||
// Support: Extended for Kubernetes Service | ||
// | ||
// Support: Implementation-specific for any other resource | ||
BackendRef BackendObjectReference `json:"backendRef"` | ||
|
||
// MirrorPercent represents the fraction of requests that should be | ||
// mirrored to BackendRef. | ||
// | ||
// If MirrorPercent is not specified, then 100% of requests will be | ||
// mirrored. | ||
// | ||
// +optional | ||
MirrorPercent Percentage `json:"mirrorPercent,omitempty"` | ||
} | ||
``` | ||
robscott marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: internal.gateway.networking.k8s.io/v1alpha2 | ||
kind: GEPDetails | ||
number: 3171 | ||
name: Percentage-based Request Mirroring | ||
status: Provisional | ||
authors: | ||
- jakebennert | ||
references: | ||
- https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.HTTPRequestMirrorFilter | ||
featureNames: | ||
- Percentage-based Request Mirroring |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.