Skip to content

Commit

Permalink
Fix tenant flow for ai subscription ratelimit policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Oct 10, 2024
1 parent 129ba5b commit 5b9c71a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion apim-apk-agent/internal/k8sClient/k8s_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"context"
"crypto/sha1"
"encoding/hex"
"fmt"
"strings"

dpv1alpha1 "github.com/wso2/apk/common-go-libs/apis/dp/v1alpha1"
Expand Down Expand Up @@ -519,7 +520,7 @@ func DeployAIRateLimitPolicyFromCPPolicy(policy eventhubTypes.SubscriptionPolicy

crRateLimitPolicies := dpv1alpha3.AIRateLimitPolicy{
ObjectMeta: metav1.ObjectMeta{
Name: getSha1Value(policy.Name),
Name: getSha1Value(fmt.Sprintf("%s-%s",policy.Name, policy.TenantDomain)),
Namespace: conf.DataPlane.Namespace,
},
Spec: dpv1alpha3.AIRateLimitPolicySpec{
Expand Down
2 changes: 1 addition & 1 deletion apim-apk-agent/internal/messaging/notification_listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ func handlePolicyEvents(data []byte, eventType string, c client.Client) {
logger.LoggerMessaging.Infof("Policy: %s for policy type: %s", policyEvent.PolicyName, policyEvent.PolicyType)
managementserver.DeleteSubscriptionPolicy(policyEvent.PolicyName, policyEvent.TenantDomain)
k8sclient.UnDeploySubscriptionRateLimitPolicyCR(policyEvent.PolicyName, c)
k8sclient.UndeploySubscriptionAIRateLimitPolicyCR(policyEvent.PolicyName, c)
k8sclient.UndeploySubscriptionAIRateLimitPolicyCR(fmt.Sprintf("%s-%s",policyEvent.PolicyName, policyEvent.TenantDomain), c)
ratelimitPolicies := managementserver.GetAllRateLimitPolicies()
logger.LoggerMessaging.Infof("Rate Limit Policies Internal Map: %v", ratelimitPolicies)
}
Expand Down

0 comments on commit 5b9c71a

Please sign in to comment.