From af63478130d08d2ac021e5b817727fe568f2df06 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Tue, 17 Sep 2024 08:10:03 +0530 Subject: [PATCH] clear logs --- adapter/internal/discovery/xds/server.go | 1 - .../internal/oasparser/envoyconf/listener.go | 1 - .../envoyconf/routes_with_clusters.go | 1 - .../oasparser/model/adapter_internal_api.go | 4 +- .../operator/controllers/dp/api_controller.go | 19 +-------- .../operator/synchronizer/data_store.go | 6 --- .../dp/airatelimitpolicy_controller.go | 39 ------------------- .../internal/xds/ratelimiter_cache.go | 5 --- .../apk/enforcer/grpc/ExtAuthService.java | 3 -- .../grpc/ExternalProcessorService.java | 9 ++--- .../enforcer/grpc/client/RatelimitClient.java | 10 +++-- .../apk/enforcer/security/KeyValidator.java | 2 - .../security/jwt/APIKeyAuthenticator.java | 4 +- .../wso2/apk/enforcer/server/AuthServer.java | 1 - .../subscription/SubscriptionDto.java | 2 +- .../gateway-runtime-deployment.yaml | 4 +- 16 files changed, 18 insertions(+), 93 deletions(-) diff --git a/adapter/internal/discovery/xds/server.go b/adapter/internal/discovery/xds/server.go index 0903c1ef8..8aaa1f1f0 100644 --- a/adapter/internal/discovery/xds/server.go +++ b/adapter/internal/discovery/xds/server.go @@ -563,7 +563,6 @@ func PopulateInternalMaps(adapterInternalAPI *model.AdapterInternalAPI, labels, } err := UpdateOrgAPIMap(vHosts, labels, listenerName, sectionName, adapterInternalAPI) - logger.LoggerAPI.Infof("vhosts::: %+v", vHosts) for vhost, _ := range vHosts { logger.LoggerAPI.Infof("vhost::: %+v, %+v, %+v", vhost, adapterInternalAPI.AIProvider.Enabled, adapterInternalAPI.GetSubscriptionValidation()) if adapterInternalAPI.AIProvider.Enabled && adapterInternalAPI.GetSubscriptionValidation() { diff --git a/adapter/internal/oasparser/envoyconf/listener.go b/adapter/internal/oasparser/envoyconf/listener.go index a5c4b0d1e..493550539 100644 --- a/adapter/internal/oasparser/envoyconf/listener.go +++ b/adapter/internal/oasparser/envoyconf/listener.go @@ -381,7 +381,6 @@ func CreateVirtualHosts(vhostToRouteArrayMap map[string][]*routev3.Route, custom } for vhost, routes := range vhostToRouteArrayMap { - loggers.LoggerAPI.Infof("vhosttosubairl: %+v, \n vhoststosubrl: %+v", vhostToSubscriptionAIRL, vhostToSubscriptionRL) if flag, exists := vhostToSubscriptionAIRL[vhost]; exists && flag { rateLimits = append(rateLimits, generateSubscriptionBasedAIRatelimits()...) } diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go index 4f8b709dc..772031f38 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go @@ -960,7 +960,6 @@ func createRoutes(params *routeCreateParams) (routes []*routev3.Route, err error } routeConfig := resource.GetEndpoints().Config metaData := &corev3.Metadata{} - logger.LoggerAPI.Infof("Is backend based rl enabled: %+v", resource.GetEnableBackendBasedAIRatelimit()) if params.isAiAPI { metaData = &corev3.Metadata{ FilterMetadata: map[string]*structpb.Struct{ diff --git a/adapter/internal/oasparser/model/adapter_internal_api.go b/adapter/internal/oasparser/model/adapter_internal_api.go index eecc75ffa..b6be28d39 100644 --- a/adapter/internal/oasparser/model/adapter_internal_api.go +++ b/adapter/internal/oasparser/model/adapter_internal_api.go @@ -544,11 +544,11 @@ func (adapterInternalAPI *AdapterInternalAPI) SetInfoHTTPRouteCR(httpRoute *gwap enableBackendBasedAIRatelimit := false descriptorValue := "" if aiRatelimitPolicy, exists := ruleIdxToAiRatelimitPolicyMapping[ruleID]; exists { - loggers.LoggerAPI.Infof("Found AI ratelimit mapping for ruleId: %d, related api: %s", ruleID, adapterInternalAPI.UUID) + loggers.LoggerAPI.Debugf("Found AI ratelimit mapping for ruleId: %d, related api: %s", ruleID, adapterInternalAPI.UUID) enableBackendBasedAIRatelimit = true descriptorValue = prepareAIRatelimitIdentifier(adapterInternalAPI.OrganizationID, utils.NamespacedName(aiRatelimitPolicy), &aiRatelimitPolicy.Spec) } else { - loggers.LoggerAPI.Infof("Could not find AIratelimit for ruleId: %d, len of map: %d, related api: %s", ruleID, len(ruleIdxToAiRatelimitPolicyMapping), adapterInternalAPI.UUID) + loggers.LoggerAPI.Debugf("Could not find AIratelimit for ruleId: %d, len of map: %d, related api: %s", ruleID, len(ruleIdxToAiRatelimitPolicyMapping), adapterInternalAPI.UUID) } backendBasePath := "" diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index 5ee559958..44301838a 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -877,10 +877,10 @@ func (apiReconciler *APIReconciler) getResolvedBackendsMapping(ctx context.Conte if err := apiReconciler.client.List(ctx, aiRLPolicyList, &k8client.ListOptions{ FieldSelector: fields.OneTermEqualSelector(aiRatelimitPolicyToBackendIndex, backendNamespacedName.String()), }); err != nil { - loggers.LoggerAPKOperator.Infof("No associated AI ratelimit policy found for : %s", backendNamespacedName.String()) + loggers.LoggerAPKOperator.Debugf("No associated AI ratelimit policy found for : %s", backendNamespacedName.String()) } else { for _, aiRLPolicy := range aiRLPolicyList.Items { - loggers.LoggerAPKOperator.Infof("Adding mapping for ruleid: %d to aiRLPolicy: %s", id, utils.NamespacedName(&aiRLPolicy)) + loggers.LoggerAPKOperator.Debugf("Adding mapping for ruleid: %d to aiRLPolicy: %s", id, utils.NamespacedName(&aiRLPolicy)) ruleIdxToAiRatelimitPolicyMapping[id] = &aiRLPolicy } } @@ -2017,21 +2017,6 @@ func addIndexes(ctx context.Context, mgr manager.Manager) error { return err } - // // AIRatelimitPolicy to Subscription indexer - // if err := mgr.GetFieldIndexer().IndexField(ctx, &dpv1alpha3.AIRateLimitPolicy{}, aiRatelimitPolicyToSubscriptionIndex, - // func(rawObj k8client.Object) []string { - // aiRatelimitPolicy := rawObj.(*dpv1alpha3.AIRateLimitPolicy) - // var subscriptions []string - // namespace := utils.GetNamespace(aiRatelimitPolicy.Spec.TargetRef.Namespace, aiRatelimitPolicy.GetNamespace()) - // subscriptions = append(subscriptions, types.NamespacedName{ - // Name: string(aiRatelimitPolicy.Spec.TargetRef.Name), - // Namespace: namespace, - // }.String()) - // return subscriptions - // }); err != nil { - // return err - // } - // API to Subscription indexer if err := mgr.GetFieldIndexer().IndexField(ctx, &dpv1alpha2.API{}, apiToSubscriptionIndex, func(rawObj k8client.Object) []string { diff --git a/adapter/internal/operator/synchronizer/data_store.go b/adapter/internal/operator/synchronizer/data_store.go index ee67d98d0..995aff427 100644 --- a/adapter/internal/operator/synchronizer/data_store.go +++ b/adapter/internal/operator/synchronizer/data_store.go @@ -109,18 +109,15 @@ func (ods *OperatorDataStore) processAPIState(apiNamespacedName types.Namespaced for key, aiRl := range apiState.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping { if cachedAIRl, exists := cachedAPI.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping[key]; exists { if utils.NamespacedName(cachedAIRl).String() != utils.NamespacedName(aiRl).String() || cachedAIRl.Generation != aiRl.Generation { - loggers.LoggerAPI.Infof("Returning true * %s %s %d %d", utils.NamespacedName(cachedAIRl).String(), utils.NamespacedName(aiRl).String(), cachedAIRl.Generation, aiRl.Generation) updated = true break } } else { - loggers.LoggerAPI.Info("Returning true&&") updated = true break } } if len(cachedAPI.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping) != len(apiState.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping) { - loggers.LoggerAPI.Info("Returning true ***") updated = true } } @@ -164,18 +161,15 @@ func (ods *OperatorDataStore) processAPIState(apiNamespacedName types.Namespaced for key, aiRl := range apiState.SandHTTPRoute.RuleIdxToAiRatelimitPolicyMapping { if cachedAIRl, exists := cachedAPI.SandHTTPRoute.RuleIdxToAiRatelimitPolicyMapping[key]; exists { if utils.NamespacedName(cachedAIRl).String() != utils.NamespacedName(aiRl).String() || cachedAIRl.Generation != aiRl.Generation { - loggers.LoggerAPI.Info("Returning true") updated = true break } } else { - loggers.LoggerAPI.Info("Returning true") updated = true break } } if len(cachedAPI.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping) != len(apiState.ProdHTTPRoute.RuleIdxToAiRatelimitPolicyMapping) { - loggers.LoggerAPI.Info("Returning true") updated = true } } diff --git a/common-controller/internal/operator/controllers/dp/airatelimitpolicy_controller.go b/common-controller/internal/operator/controllers/dp/airatelimitpolicy_controller.go index 0d618a227..4791376a3 100644 --- a/common-controller/internal/operator/controllers/dp/airatelimitpolicy_controller.go +++ b/common-controller/internal/operator/controllers/dp/airatelimitpolicy_controller.go @@ -26,27 +26,11 @@ import ( "sigs.k8s.io/controller-runtime/pkg/log" dpv1alpha3 "github.com/wso2/apk/common-go-libs/apis/dp/v1alpha3" - // "context" - // "fmt" - // "time" - - // logger "github.com/sirupsen/logrus" - // k8error "k8s.io/apimachinery/pkg/api/errors" - // "k8s.io/apimachinery/pkg/fields" - // "k8s.io/apimachinery/pkg/runtime" - // "k8s.io/apimachinery/pkg/types" - // ctrl "sigs.k8s.io/controller-runtime" - // "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" "sigs.k8s.io/controller-runtime/pkg/handler" - // "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/manager" "sigs.k8s.io/controller-runtime/pkg/predicate" - // "sigs.k8s.io/controller-runtime/pkg/reconcile" - - // k8client "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/source" - // gwapiv1 "sigs.k8s.io/gateway-api/apis/v1" "github.com/wso2/apk/adapter/pkg/logging" cache "github.com/wso2/apk/common-controller/internal/cache" @@ -54,8 +38,6 @@ import ( loggers "github.com/wso2/apk/common-controller/internal/loggers" "github.com/wso2/apk/common-controller/internal/utils" xds "github.com/wso2/apk/common-controller/internal/xds" - // dpv1alpha1 "github.com/wso2/apk/common-go-libs/apis/dp/v1alpha1" - // dpv1alpha2 "github.com/wso2/apk/common-go-libs/apis/dp/v1alpha2" "github.com/wso2/apk/common-go-libs/constants" ) @@ -73,12 +55,6 @@ func NewAIRatelimitController(mgr manager.Manager, ratelimitStore *cache.Ratelim ods: ratelimitStore, } - // ctx := context.Background() - // if err := addIndexes(ctx, mgr); err != nil { - // loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2612, logging.BLOCKER, "Error adding indexes: %v", err)) - // return err - // } - c, err := controller.New(constants.AIRatelimitController, mgr, controller.Options{Reconciler: aiRateLimitPolicyReconciler}) if err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2663, logging.BLOCKER, @@ -89,20 +65,6 @@ func NewAIRatelimitController(mgr manager.Manager, ratelimitStore *cache.Ratelim conf := config.ReadConfigs() predicates := []predicate.Predicate{predicate.NewPredicateFuncs(utils.FilterByNamespaces(conf.CommonController.Operator.Namespaces))} - // if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha2.API{}), - // handler.EnqueueRequestsFromMapFunc(aiRateLimitPolicyReconciler.getRatelimitForAPI), predicates...); err != nil { - // loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2611, logging.BLOCKER, - // "Error watching API resources: %v", err)) - // return err - // } - - // if err := c.Watch(source.Kind(mgr.GetCache(), &gwapiv1.HTTPRoute{}), - // handler.EnqueueRequestsFromMapFunc(aiRateLimitPolicyReconciler.getRatelimitForHTTPRoute), predicates...); err != nil { - // loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2613, logging.BLOCKER, - // "Error watching HTTPRoute resources: %v", err)) - // return err - // } - if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha3.AIRateLimitPolicy{}), &handler.EnqueueRequestForObject{}, predicates...); err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2639, logging.BLOCKER, "Error watching Ratelimit resources: %v", err.Error())) @@ -153,7 +115,6 @@ func (r *AIRateLimitPolicyReconciler) Reconcile(ctx context.Context, req ctrl.Re xds.UpdateRateLimiterPolicies(conf.CommonController.Server.Label) } } - loggers.LoggerAPKOperator.Infof("AIRatelimit reconcile..*****.") return ctrl.Result{}, nil } diff --git a/common-controller/internal/xds/ratelimiter_cache.go b/common-controller/internal/xds/ratelimiter_cache.go index 53827e723..035c6c91f 100644 --- a/common-controller/internal/xds/ratelimiter_cache.go +++ b/common-controller/internal/xds/ratelimiter_cache.go @@ -335,10 +335,8 @@ func (r *rateLimitPolicyCache) AddCustomRateLimitPolicies(customRateLimitPolicy // ProcessSubscriptionBasedAIRatelimitPolicySpecsAndUpdateCache process the specs and update the cache func (r *rateLimitPolicyCache) ProcessSubscriptionBasedAIRatelimitPolicySpecsAndUpdateCache(subscriptionEnabledAIRatelimitPolicies map[types.NamespacedName]struct{}, aiRatelimitPolicySpecs map[types.NamespacedName]*dpv1alpha3.AIRateLimitPolicySpec) { aiRlDescriptors := make([]*rls_config.RateLimitDescriptor, 0) - loggers.LoggerAPKOperator.Infof("222222") for namespacedNameRl := range subscriptionEnabledAIRatelimitPolicies { if airl, exists := aiRatelimitPolicySpecs[namespacedNameRl]; exists { - loggers.LoggerAPKOperator.Infof("----- %s %s %s", DescriptorKeyForSubscriptionBasedAIRequestTokenCount, prepareSubscriptionBasedAIRatelimitIdentifier(airl.Override.Organization, namespacedNameRl), DescriptorKeyForSubscription) // Add descriptor for RequestTokenCount aiRlDescriptors = append(aiRlDescriptors, &rls_config.RateLimitDescriptor{ Key: DescriptorKeyForSubscriptionBasedAIRequestTokenCount, @@ -403,10 +401,7 @@ func (r *rateLimitPolicyCache) ProcessSubscriptionBasedAIRatelimitPolicySpecsAnd // ProcessAIratelimitPolicySpecsAndUpdateCache process the specs and update the cache func (r *rateLimitPolicyCache) ProcessAIRatelimitPolicySpecsAndUpdateCache(aiRateLimitPolicySpecs map[types.NamespacedName]*dpv1alpha3.AIRateLimitPolicySpec) { aiRlDescriptors := make([]*rls_config.RateLimitDescriptor, 0) - loggers.LoggerAPKOperator.Infof("222222") for namespacedName, spec := range aiRateLimitPolicySpecs { - logger.Infof("Adding : %s, %s", DescriptorKeyForAIRequestCount, prepareAIRatelimitIdentifier(spec.Override.Organization, namespacedName, spec)) - logger.Infof("For airl: %s", namespacedName) // Add descriptor for RequestTokenCount aiRlDescriptors = append(aiRlDescriptors, &rls_config.RateLimitDescriptor{ Key: DescriptorKeyForAIRequestTokenCount, diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExtAuthService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExtAuthService.java index b961743b3..060a441b0 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExtAuthService.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExtAuthService.java @@ -270,7 +270,6 @@ private String constructQueryParamString(boolean removeAllQueryParams, String re * @param value */ private void addMetadata(Struct.Builder structBuilder, String key, String value) { - System.out.println("Key: " + key + " value: " + value); structBuilder.putFields(key, Value.newBuilder().setStringValue(value).build()); } @@ -309,6 +308,4 @@ private CheckResponse buildReadyCheckResponse(CheckResponse.Builder responseBuil .setDeniedResponse(deniedResponsePreparer.build()) .build(); } - - } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExternalProcessorService.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExternalProcessorService.java index 602b897fe..258c65546 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExternalProcessorService.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/ExternalProcessorService.java @@ -75,7 +75,6 @@ public class ExternalProcessorService extends ExternalProcessorGrpc.ExternalProc public StreamObserver process( final StreamObserver responseObserver) { FilterMetadata filterMetadata = new FilterMetadata(); - System.out.println("process ...."); return new StreamObserver() { @Override @@ -131,7 +130,6 @@ public void onNext(ProcessingRequest request) { filterMetadata.backendBasedAIRatelimitDescriptorValue = metadata.backendBasedAIRatelimitDescriptorValue; filterMetadata.enableBackendBasedAIRatelimit = metadata.enableBackendBasedAIRatelimit; } - System.out.println("In the response flow metadata descirtor:" + filterMetadata.backendBasedAIRatelimitDescriptorValue); if (request.hasResponseBody()) { final byte[] bodyFromResponse = request.getResponseBody().getBody().toByteArray(); executorService.submit(() -> { @@ -177,7 +175,6 @@ public void onNext(ProcessingRequest request) { }); responseObserver.onCompleted(); } else { - System.out.println("Request does not have response body"); responseObserver.onCompleted(); } @@ -186,7 +183,7 @@ public void onNext(ProcessingRequest request) { @Override public void onError(Throwable err) { - System.out.println("on error ...."+ err.getLocalizedMessage() + " " + err.getMessage() + " " + err.toString()+ " ****"); + logger.error("Error initiated from envoy in the external processing session. Error: " + err); } @Override @@ -277,7 +274,7 @@ private static Usage extractUsageFromHeaders(HttpHeaders headers, String complet } return usage; } catch (Exception e) { - System.out.println("Error occured while getting yusage info from headers"+e); + logger.error("Error occured while getting yusage info from headers" + e); return null; } } @@ -342,7 +339,7 @@ private static Usage extractUsageFromBody(String body, String completionTokenPat return usage; } catch (Exception e) { - System.out.println(String.format("Unexpected error while extracting usage from the body: %s", body) + " \n" + e); + logger.error(String.format("Unexpected error while extracting usage from the body: %s", body) + " \n" + e); return null; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/client/RatelimitClient.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/client/RatelimitClient.java index f62d293e1..e0b341cd1 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/client/RatelimitClient.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/grpc/client/RatelimitClient.java @@ -8,17 +8,20 @@ import io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts; import io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder; import io.grpc.netty.shaded.io.netty.handler.ssl.SslContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.wso2.apk.enforcer.config.ConfigHolder; +import org.wso2.apk.enforcer.grpc.ExternalProcessorService; import java.io.File; import java.nio.file.Paths; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import javax.net.ssl.SSLException; public class RatelimitClient { + private static final Logger logger = LogManager.getLogger(RatelimitClient.class); RateLimitServiceGrpc.RateLimitServiceBlockingStub stub; + public RatelimitClient(){ File certFile = Paths.get(ConfigHolder.getInstance().getEnvVarConfig().getEnforcerPublicKeyPath()).toFile(); File keyFile = Paths.get(ConfigHolder.getInstance().getEnvVarConfig().getEnforcerPrivateKeyPath()).toFile(); @@ -30,7 +33,7 @@ public RatelimitClient(){ .keyManager(certFile, keyFile) .build(); } catch (SSLException e) { - System.out.println("Error while generating SSL Context."+ e); + logger.error("Error while generating SSL Context."+ e); } String rlHost = ConfigHolder.getInstance().getEnvVarConfig().getRatelimiterHost(); int port = ConfigHolder.getInstance().getEnvVarConfig().getRatelimiterPort(); @@ -59,7 +62,6 @@ public void shouldRatelimit(List configs) { .setHitsAddend(hitsAddend) .build(); RateLimitResponse rateLimitResponse = stub.shouldRateLimit(rateLimitRequest); - System.out.println(rateLimitResponse.getOverallCode()); } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java index daf2aa091..c6bfc3fda 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/KeyValidator.java @@ -263,8 +263,6 @@ public static APIKeyValidationInfoDTO validateSubscription(String apiUuid, Strin return infoDTO; } - - private static void validate(APIKeyValidationInfoDTO infoDTO, Application app, Subscription sub) { // Validate subscription status diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java index 0eb2a90ef..eba64e2c2 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/APIKeyAuthenticator.java @@ -222,8 +222,8 @@ private AuthenticationContext processAPIKey(RequestContext requestContext, Strin .getMandateSubscriptionValidation(); if (!requestContext.getMatchedAPI().isSystemAPI() && (isGatewayLevelSubscriptionValidationEnabled || requestContext.getMatchedAPI() .isSubscriptionValidation())) { - validationInfoDto = KeyValidator.validateSubscription(apiUuid, apiContext, - requestContext.getMatchedAPI(), payload); +// validationInfoDto = KeyValidator.validateSubscription(apiUuid, apiContext, +// requestContext.getMatchedAPI(), payload); log.debug("Validating subscription for API Key using JWT claims against invoked API info." + " context: {} version: {}", apiContext, apiVersion); validationInfoDto = getAPIKeyValidationDTO(requestContext, payload); diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/server/AuthServer.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/server/AuthServer.java index d849dc648..38ac92af2 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/server/AuthServer.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/server/AuthServer.java @@ -159,7 +159,6 @@ private static Server initServer() throws SSLException { EnforcerWorkerPool enforcerWorkerPool = new EnforcerWorkerPool(threadPoolConfig.getCoreSize(), threadPoolConfig.getMaxSize(), threadPoolConfig.getKeepAliveTime(), threadPoolConfig.getQueueSize(), Constants.EXTERNAL_AUTHZ_THREAD_GROUP, Constants.EXTERNAL_AUTHZ_THREAD_ID); - System.out.println("test"); return NettyServerBuilder.forPort(authServerConfig.getPort()) .keepAliveTime(authServerConfig.getKeepAliveTime(), TimeUnit.SECONDS).bossEventLoopGroup(bossGroup) .workerEventLoopGroup(workerGroup) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDto.java index b8a31efaa..42cb28a93 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDto.java @@ -63,4 +63,4 @@ public void setRatelimitTier(String ratelimitTier) { this.ratelimitTier = ratelimitTier; } -} \ No newline at end of file +} diff --git a/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml b/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml index bf6217a4f..50d9bc91f 100644 --- a/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml +++ b/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml @@ -100,9 +100,9 @@ spec: value: admin - name: JAVA_OPTS {{- if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }} - value: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006 -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 -Dapk.jmx.metrics.enabled=true -javaagent:/home/wso2/lib/jmx_prometheus_javaagent-0.20.0.jar=18006:/tmp/metrics/prometheus-jmx-config-enforcer.yml + value: -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 -Dapk.jmx.metrics.enabled=true -javaagent:/home/wso2/lib/jmx_prometheus_javaagent-0.20.0.jar=18006:/tmp/metrics/prometheus-jmx-config-enforcer.yml {{- else }} - value: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5006 -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 + value: -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 {{- end }} {{- if and .Values.wso2.apk.dp.gatewayRuntime.analytics .Values.wso2.apk.dp.gatewayRuntime.analytics.publishers }} {{- $defaultPublisherSecretName := "" }}