From 487dc2f9ca7dd7dcf2744dcbb029ae8d1bccde94 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Tue, 14 Jan 2025 10:35:37 +0800 Subject: [PATCH] fix: throttleHost is not array in ExternalRateLimit Signed-off-by: Lin Yang --- ...on.gateway.flomesh.io_externalratelimits.yaml | 16 +++++----------- pkg/apis/extension/v1alpha1/externalratelimit.go | 7 ++----- .../extension/v1alpha1/zz_generated.deepcopy.go | 5 ----- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/cmd/fsm-bootstrap/crds/extension.gateway.flomesh.io_externalratelimits.yaml b/cmd/fsm-bootstrap/crds/extension.gateway.flomesh.io_externalratelimits.yaml index 2e263a88..de76f89d 100644 --- a/cmd/fsm-bootstrap/crds/extension.gateway.flomesh.io_externalratelimits.yaml +++ b/cmd/fsm-bootstrap/crds/extension.gateway.flomesh.io_externalratelimits.yaml @@ -60,17 +60,11 @@ spec: type: array x-kubernetes-list-type: set throttleHost: - description: ThrottleHosts is the list of hosts to be throttled - items: - description: HostPort is a host name with optional port number - maxLength: 253 - minLength: 1 - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(:[0-9]{1,5})?$ - type: string - maxItems: 32 - minItems: 1 - type: array - x-kubernetes-list-type: set + description: ThrottleHost is the host to be throttled + maxLength: 253 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*(:[0-9]{1,5})?$ + type: string type: object status: description: ExternalRateLimitStatus defines the observed state of ExternalRateLimit diff --git a/pkg/apis/extension/v1alpha1/externalratelimit.go b/pkg/apis/extension/v1alpha1/externalratelimit.go index 93386f7a..56c6186c 100644 --- a/pkg/apis/extension/v1alpha1/externalratelimit.go +++ b/pkg/apis/extension/v1alpha1/externalratelimit.go @@ -7,11 +7,8 @@ import ( // ExternalRateLimitSpec defines the desired state of ExternalRateLimit type ExternalRateLimitSpec struct { - // +listType=set - // +kubebuilder:validation:MinItems=1 - // +kubebuilder:validation:MaxItems=32 - // ThrottleHosts is the list of hosts to be throttled - ThrottleHosts []HostPort `json:"throttleHost,omitempty"` + // ThrottleHost is the host to be throttled + ThrottleHost HostPort `json:"throttleHost,omitempty"` // +optional // +listType=set diff --git a/pkg/apis/extension/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/extension/v1alpha1/zz_generated.deepcopy.go index 08dde23d..f3561305 100644 --- a/pkg/apis/extension/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/extension/v1alpha1/zz_generated.deepcopy.go @@ -361,11 +361,6 @@ func (in *ExternalRateLimitList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ExternalRateLimitSpec) DeepCopyInto(out *ExternalRateLimitSpec) { *out = *in - if in.ThrottleHosts != nil { - in, out := &in.ThrottleHosts, &out.ThrottleHosts - *out = make([]HostPort, len(*in)) - copy(*out, *in) - } if in.PassHeaders != nil { in, out := &in.PassHeaders, &out.PassHeaders *out = make([]v1.HeaderName, len(*in))