Skip to content

Commit ab04695

Browse files
authored
Merge branch 'main' into auto-getn
Signed-off-by: Arko Dasgupta <[email protected]>
2 parents 57017c3 + f17b6df commit ab04695

File tree

88 files changed

+6767
-704
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+6767
-704
lines changed

api/v1alpha1/backendtrafficpolicy_types.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@ type BackendTrafficPolicy struct {
3939
// +kubebuilder:validation:XValidation:rule="(has(self.targetRef) && !has(self.targetRefs)) || (!has(self.targetRef) && has(self.targetRefs)) || (has(self.targetSelectors) && self.targetSelectors.size() > 0) ", message="either targetRef or targetRefs must be used"
4040
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? self.targetRef.group == 'gateway.networking.k8s.io' : true ", message="this policy can only have a targetRef.group of gateway.networking.k8s.io"
4141
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? self.targetRef.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute'] : true", message="this policy can only have a targetRef.kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
42-
// +kubebuilder:validation:XValidation:rule="has(self.targetRef) ? !has(self.targetRef.sectionName) : true",message="this policy does not yet support the sectionName field"
4342
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, ref.group == 'gateway.networking.k8s.io') : true ", message="this policy can only have a targetRefs[*].group of gateway.networking.k8s.io"
4443
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, ref.kind in ['Gateway', 'HTTPRoute', 'GRPCRoute', 'UDPRoute', 'TCPRoute', 'TLSRoute']) : true ", message="this policy can only have a targetRefs[*].kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute"
45-
// +kubebuilder:validation:XValidation:rule="has(self.targetRefs) ? self.targetRefs.all(ref, !has(ref.sectionName)) : true",message="this policy does not yet support the sectionName field"
4644
// +kubebuilder:validation:XValidation:rule="!has(self.compression) || !has(self.compressor)", message="either compression or compressor can be set, not both"
4745
type BackendTrafficPolicySpec struct {
4846
PolicyTargetReferences `json:",inline"`

api/v1alpha1/envoygateway_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ type EnvoyGatewayKubernetesProvider struct {
272272
// RateLimitPDB allows to control the pod disruption budget of rate limit service.
273273
//
274274
// +optional
275-
RateLimitPDB *KubernetesPodDisruptionBudgetSpec `json:"rateLimitPdb,omitempty"`
275+
RateLimitPDB *KubernetesPodDisruptionBudgetSpec `json:"rateLimitPDB,omitempty"`
276276

277277
// Watch holds configuration of which input resources should be watched and reconciled.
278278
// +optional

api/v1alpha1/ratelimit_types.go

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
package v1alpha1
77

8+
import (
9+
gwapiv1 "sigs.k8s.io/gateway-api/apis/v1"
10+
)
11+
812
// RateLimitSpec defines the desired state of RateLimitSpec.
913
// +union
1014
type RateLimitSpec struct {
@@ -183,17 +187,30 @@ type RateLimitCostMetadata struct {
183187
// RateLimitSelectCondition specifies the attributes within the traffic flow that can
184188
// be used to select a subset of clients to be ratelimited.
185189
// All the individual conditions must hold True for the overall condition to hold True.
190+
// And, at least one of headers or methods or path or sourceCIDR condition must be specified.
191+
//
192+
// +kubebuilder:validation:XValidation:rule="has(self.headers) || has(self.methods) || has(self.path) || has(self.sourceCIDR)",message="at least one of headers, methods, path or sourceCIDR must be specified"
186193
type RateLimitSelectCondition struct {
187194
// Headers is a list of request headers to match. Multiple header values are ANDed together,
188195
// meaning, a request MUST match all the specified headers.
189-
// At least one of headers or sourceCIDR condition must be specified.
190196
//
191197
// +optional
192198
// +kubebuilder:validation:MaxItems=16
193199
Headers []HeaderMatch `json:"headers,omitempty"`
194200

201+
// Methods is a list of request methods to match. Multiple method values are ORed together,
202+
// meaning, a request can match any one of the specified methods. If not specified, it matches all methods.
203+
//
204+
// +optional
205+
Methods []MethodMatch `json:"methods,omitempty"`
206+
207+
// Path is the request path to match.
208+
// Support Exact, PathPrefix and RegularExpression match types.
209+
//
210+
// +optional
211+
Path *PathMatch `json:"path,omitempty"`
212+
195213
// SourceCIDR is the client IP Address range to match on.
196-
// At least one of headers or sourceCIDR condition must be specified.
197214
//
198215
// +optional
199216
SourceCIDR *SourceMatch `json:"sourceCIDR,omitempty"`
@@ -278,6 +295,39 @@ const (
278295
HeaderMatchDistinct HeaderMatchType = "Distinct"
279296
)
280297

298+
// MethodMatch defines the matching criteria for the HTTP method of a request.
299+
type MethodMatch struct {
300+
// Value specifies the HTTP method.
301+
Value gwapiv1.HTTPMethod `json:"value"`
302+
303+
// Invert specifies whether the value match result will be inverted.
304+
//
305+
// +optional
306+
// +kubebuilder:default=false
307+
Invert *bool `json:"invert,omitempty"`
308+
}
309+
310+
// PathMatch defines the matching criteria for the HTTP path of a request.
311+
type PathMatch struct {
312+
// Type specifies how to match against the value of the path.
313+
//
314+
// +optional
315+
// +kubebuilder:default=PathPrefix
316+
Type *gwapiv1.PathMatchType `json:"type,omitempty"`
317+
318+
// Value specifies the HTTP path.
319+
//
320+
// +kubebuilder:default="/"
321+
// +kubebuilder:validation:MaxLength=1024
322+
Value string `json:"value"`
323+
324+
// Invert specifies whether the value match result will be inverted.
325+
//
326+
// +optional
327+
// +kubebuilder:default=false
328+
Invert *bool `json:"invert,omitempty"`
329+
}
330+
281331
// RateLimitValue defines the limits for rate limiting.
282332
type RateLimitValue struct {
283333
Requests uint `json:"requests"`

api/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)