Skip to content

Commit 494d1ac

Browse files
authored
Split MirrorPercent into two fields: MirrorPercent and MirrorFraction.
1 parent bf6644a commit 494d1ac

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

geps/gep-3171/index.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ This feature is already [supported by Envoy](https://www.envoyproxy.io/docs/envo
2323

2424
This GEP proposes the following API changes:
2525

26-
* 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`:
26+
* Add utility type `Fraction` to [v1/shared_types.go](https://github.com/kubernetes-sigs/gateway-api/blob/cb5bf1541fa70f0692aebde8c64bba434cf331b6/apis/v1/shared_types.go):
2727

2828

2929
```go
3030
type Fraction struct {
3131
// +optional
32+
// +kubebuilder:default=100
3233
// +kubebuilder:validation:Minimum=0
3334
Numerator int32 `json:"numerator"`
3435

@@ -37,8 +38,6 @@ type Fraction struct {
3738
// +kubebuilder:validation:Minimum=1
3839
Denominator int32 `json:"denominator"`
3940
}
40-
41-
type Percentage Fraction
4241
```
4342

4443

@@ -73,13 +72,32 @@ type HTTPRequestMirrorFilter struct {
7372
// Support: Implementation-specific for any other resource
7473
BackendRef BackendObjectReference `json:"backendRef"`
7574

76-
// MirrorPercent represents the fraction of requests that should be
75+
// MirrorPercent represents the percentage of requests that should be
76+
// mirrored to BackendRef. Its minimum value is 0 (indicating 0% of
77+
// requests) and its maximum value is 100 (indicating 100% of requests).
78+
//
79+
// If both MirrorPercent and MirrorFraction are specified, MirrorFraction
80+
// will take priority. If MirrorPercent is unspecified, it will have a
81+
// default value of 100. If MirrorFraction is unspecified, it will have
82+
// a default value of 100/100. This means that if neither field is
83+
// specified, 100% of requests will be mirrored.
84+
//
85+
// +optional
86+
// +kubebuilder:default=100
87+
// +kubebuilder:validation:Minimum=0
88+
// +kubebuilder:validation:Maximum=100
89+
MirrorPercent int32 `json:"mirrorPercent,omitempty"`
90+
91+
// MirrorFraction represents the fraction of requests that should be
7792
// mirrored to BackendRef.
7893
//
79-
// If MirrorPercent is not specified, then 100% of requests will be
80-
// mirrored.
94+
// If both MirrorPercent and MirrorFraction are specified, MirrorFraction
95+
// will take priority. If MirrorPercent is unspecified, it will have a
96+
// default value of 100. If MirrorFraction is unspecified, it will have
97+
// a default value of 100/100. This means that if neither field is
98+
// specified, 100% of requests will be mirrored.
8199
//
82100
// +optional
83-
MirrorPercent Percentage `json:"mirrorPercent,omitempty"`
101+
MirrorFraction Fraction `json:"mirrorFraction,omitempty"`
84102
}
85103
```

0 commit comments

Comments
 (0)