From 74488f848829ffdb132c594771106f7053d81571 Mon Sep 17 00:00:00 2001 From: KevFan Date: Mon, 13 May 2024 10:50:09 +0100 Subject: [PATCH] fix: remove obselete flags from redis options --- api/v1alpha1/limitador_types.go | 8 -------- api/v1alpha1/zz_generated.deepcopy.go | 10 ---------- bundle/manifests/limitador.kuadrant.io_limitadors.yaml | 8 -------- config/crd/bases/limitador.kuadrant.io_limitadors.yaml | 8 -------- controllers/limitador_controller_test.go | 4 ---- pkg/limitador/redis_cache_storage_options.go | 6 ------ pkg/limitador/redis_cache_storage_options_test.go | 4 ---- 7 files changed, 48 deletions(-) diff --git a/api/v1alpha1/limitador_types.go b/api/v1alpha1/limitador_types.go index e5e901ad..7b282dfa 100644 --- a/api/v1alpha1/limitador_types.go +++ b/api/v1alpha1/limitador_types.go @@ -207,14 +207,6 @@ type Redis struct { } type RedisCachedOptions struct { - // +optional - // TTL for cached counters in milliseconds [default: 5000] - TTL *int `json:"ttl,omitempty"` - - // +optional - // Ratio to apply to the TTL from Redis on cached counters [default: 10] - Ratio *int `json:"ratio,omitempty"` - // +optional // FlushPeriod for counters in milliseconds [default: 1000] FlushPeriod *int `json:"flush-period,omitempty"` diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index e537799b..8e1697a8 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -416,16 +416,6 @@ func (in *RedisCached) DeepCopy() *RedisCached { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RedisCachedOptions) DeepCopyInto(out *RedisCachedOptions) { *out = *in - if in.TTL != nil { - in, out := &in.TTL, &out.TTL - *out = new(int) - **out = **in - } - if in.Ratio != nil { - in, out := &in.Ratio, &out.Ratio - *out = new(int) - **out = **in - } if in.FlushPeriod != nil { in, out := &in.FlushPeriod, &out.FlushPeriod *out = new(int) diff --git a/bundle/manifests/limitador.kuadrant.io_limitadors.yaml b/bundle/manifests/limitador.kuadrant.io_limitadors.yaml index 45cc39b8..12e17f17 100644 --- a/bundle/manifests/limitador.kuadrant.io_limitadors.yaml +++ b/bundle/manifests/limitador.kuadrant.io_limitadors.yaml @@ -1061,18 +1061,10 @@ spec: description: 'MaxCached refers to the maximum amount of counters cached [default: 10000]' type: integer - ratio: - description: 'Ratio to apply to the TTL from Redis on - cached counters [default: 10]' - type: integer response-timeout: description: 'ResponseTimeout defines the timeout for Redis commands in milliseconds [default: 350]' type: integer - ttl: - description: 'TTL for cached counters in milliseconds - [default: 5000]' - type: integer type: object type: object type: object diff --git a/config/crd/bases/limitador.kuadrant.io_limitadors.yaml b/config/crd/bases/limitador.kuadrant.io_limitadors.yaml index a869157e..3fbe2ed0 100644 --- a/config/crd/bases/limitador.kuadrant.io_limitadors.yaml +++ b/config/crd/bases/limitador.kuadrant.io_limitadors.yaml @@ -1062,18 +1062,10 @@ spec: description: 'MaxCached refers to the maximum amount of counters cached [default: 10000]' type: integer - ratio: - description: 'Ratio to apply to the TTL from Redis on - cached counters [default: 10]' - type: integer response-timeout: description: 'ResponseTimeout defines the timeout for Redis commands in milliseconds [default: 350]' type: integer - ttl: - description: 'TTL for cached counters in milliseconds - [default: 5000]' - type: integer type: object type: object type: object diff --git a/controllers/limitador_controller_test.go b/controllers/limitador_controller_test.go index d1f564da..3988692f 100644 --- a/controllers/limitador_controller_test.go +++ b/controllers/limitador_controller_test.go @@ -600,8 +600,6 @@ var _ = Describe("Limitador controller", func() { It("with all the optional parameters, the command line is correct", func(ctx SpecContext) { limitadorObj := limitadorWithRedisCachedStorage(client.ObjectKeyFromObject(redisSecret), testNamespace) limitadorObj.Spec.Storage.RedisCached.Options = &limitadorv1alpha1.RedisCachedOptions{ - TTL: ptr.To(1), - Ratio: ptr.To(2), FlushPeriod: ptr.To(3), MaxCached: ptr.To(4), ResponseTimeout: ptr.To(5), @@ -632,8 +630,6 @@ var _ = Describe("Limitador controller", func() { "/home/limitador/etc/limitador-config.yaml", "redis_cached", "$(LIMITADOR_OPERATOR_REDIS_URL)", - "--ttl", "1", - "--ratio", "2", "--flush-period", "3", "--max-cached", "4", "--response-timeout", "5", diff --git a/pkg/limitador/redis_cache_storage_options.go b/pkg/limitador/redis_cache_storage_options.go index 2f164ff1..0d388d18 100644 --- a/pkg/limitador/redis_cache_storage_options.go +++ b/pkg/limitador/redis_cache_storage_options.go @@ -21,12 +21,6 @@ func RedisCachedDeploymentOptions(ctx context.Context, cl client.Client, defSecr command := []string{"redis_cached", "$(LIMITADOR_OPERATOR_REDIS_URL)"} if redisCachedObj.Options != nil { - if redisCachedObj.Options.TTL != nil { - command = append(command, "--ttl", strconv.Itoa(*redisCachedObj.Options.TTL)) - } - if redisCachedObj.Options.Ratio != nil { - command = append(command, "--ratio", strconv.Itoa(*redisCachedObj.Options.Ratio)) - } if redisCachedObj.Options.FlushPeriod != nil { command = append(command, "--flush-period", strconv.Itoa(*redisCachedObj.Options.FlushPeriod)) } diff --git a/pkg/limitador/redis_cache_storage_options_test.go b/pkg/limitador/redis_cache_storage_options_test.go index bb3441ad..32fc47b9 100644 --- a/pkg/limitador/redis_cache_storage_options_test.go +++ b/pkg/limitador/redis_cache_storage_options_test.go @@ -105,8 +105,6 @@ func TestRedisCachedDeploymentOptions(t *testing.T) { redisObj := limitadorv1alpha1.RedisCached{ ConfigSecretRef: &v1.LocalObjectReference{Name: "redisSecret"}, Options: &limitadorv1alpha1.RedisCachedOptions{ - TTL: ptr.To(1), - Ratio: ptr.To(2), FlushPeriod: ptr.To(3), MaxCached: ptr.To(4), ResponseTimeout: ptr.To(5), @@ -119,8 +117,6 @@ func TestRedisCachedDeploymentOptions(t *testing.T) { Command: []string{ "redis_cached", "$(LIMITADOR_OPERATOR_REDIS_URL)", - "--ttl", "1", - "--ratio", "2", "--flush-period", "3", "--max-cached", "4", "--response-timeout", "5",