Skip to content

Commit

Permalink
remove RateLimitFilter in favor of BackendTrafficPolicy
Browse files Browse the repository at this point in the history
Relates to envoyproxy#2006

Signed-off-by: Arko Dasgupta <arko@tetrate.io>
  • Loading branch information
arkodg committed Oct 26, 2023
1 parent 6b8794e commit 5190dbd
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 831 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/backendtrafficpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type BackendTrafficPolicySpec struct {
// RateLimit allows the user to limit the number of incoming requests
// to a predefined value based on attributes within the traffic flow.
// +optional
RateLimit *RateLimitFilterSpec `json:"rateLimit,omitempty"`
RateLimit *RateLimitPolicy `json:"rateLimit,omitempty"`

// LoadBalancer policy to apply when routing traffic from the gateway to
// the backend endpoints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,9 @@

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
// KindRateLimitFilter is the name of the RateLimitFilter kind.
KindRateLimitFilter = "RateLimitFilter"
)

// +kubebuilder:object:root=true
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`

// RateLimitFilter allows the user to limit the number of incoming requests
// to a predefined value based on attributes within the traffic flow.
type RateLimitFilter struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the desired state of RateLimitFilter.
Spec RateLimitFilterSpec `json:"spec"`
}

// RateLimitFilterSpec defines the desired state of RateLimitFilter.
// RateLimitPolicy defines the desired state of RateLimitFilter.
// +union
type RateLimitFilterSpec struct {
type RateLimitPolicy struct {
// Type decides the scope for the RateLimits.
// Valid RateLimitType values are "Global".
//
Expand Down Expand Up @@ -184,16 +162,3 @@ type RateLimitValue struct {
//
// +kubebuilder:validation:Enum=Second;Minute;Hour;Day
type RateLimitUnit string

//+kubebuilder:object:root=true

// RateLimitFilterList contains a list of RateLimitFilter resources.
type RateLimitFilterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []RateLimitFilter `json:"items"`
}

func init() {
SchemeBuilder.Register(&RateLimitFilter{}, &RateLimitFilterList{})
}
68 changes: 5 additions & 63 deletions api/v1alpha1/zz_generated.deepcopy.go

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

This file was deleted.

14 changes: 0 additions & 14 deletions internal/cmd/egctl/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,20 +766,6 @@ func kubernetesYAMLToResources(str string, addMissingResources bool) (*gatewayap
Spec: typedSpec.(egv1a1.EnvoyPatchPolicySpec),
}
resources.EnvoyPatchPolicies = append(resources.EnvoyPatchPolicies, envoyPatchPolicy)
case egv1a1.KindRateLimitFilter:
typedSpec := spec.Interface()
rateLimitFilter := &egv1a1.RateLimitFilter{
TypeMeta: metav1.TypeMeta{
Kind: egv1a1.KindRateLimitFilter,
APIVersion: egv1a1.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
Name: name,
},
Spec: typedSpec.(egv1a1.RateLimitFilterSpec),
}
resources.RateLimitFilters = append(resources.RateLimitFilters, rateLimitFilter)
}
}

Expand Down
Loading

0 comments on commit 5190dbd

Please sign in to comment.