From fabe810ab55496849e06afc04f6d78c289f7c597 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Mon, 9 Sep 2024 14:24:25 +0530 Subject: [PATCH] Fix rl key not deleted bug --- .../operator/controllers/dp/api_controller.go | 2 +- common-controller/internal/xds/server.go | 6 +----- .../apis/cp/v1alpha2/zz_generated.deepcopy.go | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index 0ba0592549..4408120bcf 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -1445,7 +1445,7 @@ func (apiReconciler *APIReconciler) getAPIsForAIRatelimitPolicy(ctx context.Cont } if aiRatelimitPolicy.Spec.TargetRef.Kind == constants.KindBackend { - backend := &dpv1alpha1.Backend{} + backend := &dpv1alpha2.Backend{} namespacedName := types.NamespacedName{ Name: string(aiRatelimitPolicy.Spec.TargetRef.Name), Namespace: utils.GetNamespace(aiRatelimitPolicy.Spec.TargetRef.Namespace, aiRatelimitPolicy.GetNamespace()), diff --git a/common-controller/internal/xds/server.go b/common-controller/internal/xds/server.go index 457f754d42..ec4ef38a0c 100644 --- a/common-controller/internal/xds/server.go +++ b/common-controller/internal/xds/server.go @@ -167,11 +167,7 @@ func UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicies dpv1alpha1 // UpdateRateLimitXDSCacheForAIRatelimitPolicies updates the xDS cache of the RateLimiter for AI ratelimit policies. func UpdateRateLimitXDSCacheForAIRatelimitPolicies(aiRatelimitPolicySpecs map[apimachiner_types.NamespacedName]*dpv1alpha3.AIRateLimitPolicySpec) { - loggers.LoggerAPKOperator.Infof("000000") - if len(aiRatelimitPolicySpecs) != 0 { - loggers.LoggerAPKOperator.Infof("1111111") - rlsPolicyCache.ProcessAIRatelimitPolicySpecsAndUpdateCache(aiRatelimitPolicySpecs) - } + rlsPolicyCache.ProcessAIRatelimitPolicySpecsAndUpdateCache(aiRatelimitPolicySpecs) } // DeleteAPILevelRateLimitPolicies delete the ratelimit xds cache diff --git a/common-go-libs/apis/cp/v1alpha2/zz_generated.deepcopy.go b/common-go-libs/apis/cp/v1alpha2/zz_generated.deepcopy.go index d893c19326..4d3fd79aa0 100644 --- a/common-go-libs/apis/cp/v1alpha2/zz_generated.deepcopy.go +++ b/common-go-libs/apis/cp/v1alpha2/zz_generated.deepcopy.go @@ -345,6 +345,22 @@ func (in *SubscriptionList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubscriptionSpec) DeepCopyInto(out *SubscriptionSpec) { + *out = *in + out.API = in.API +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubscriptionSpec. +func (in *SubscriptionSpec) DeepCopy() *SubscriptionSpec { + if in == nil { + return nil + } + out := new(SubscriptionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SubscriptionStatus) DeepCopyInto(out *SubscriptionStatus) { *out = *in