From 849498fd48f2219c8a985c461828f8658d850cb3 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Mon, 25 Sep 2023 14:22:26 +0530 Subject: [PATCH 01/24] Resolving changes with the main branch --- .../operator/apis/dp/v1alpha1/api_types.go | 5 +++ .../config/crd/bases/dp.wso2.com_apis.yaml | 3 ++ .../internal/config/default_config.go | 1 + common-controller/internal/config/types.go | 3 +- .../operator/apis/dp/v1alpha1/api_types.go | 6 ++++ .../operator/apis/dp/v1alpha1/api_webhook.go | 7 ++++- .../internal/operator/utils/utils.go | 31 +++++++++++++++++++ 7 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 common-controller/internal/operator/utils/utils.go diff --git a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go index cc9ed6e76..8d890813d 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go @@ -109,6 +109,11 @@ type APISpec struct { // +optional // +nullable APIProperties []Property `json:"apiProperties,omitempty"` + + // Environment denotes the environment of the API. + // + // +optional + Environment string `json:"environment"` } // Property holds key value pair of APIProperties diff --git a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml index 8a98f9e3a..0afaad5f8 100644 --- a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml +++ b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml @@ -95,6 +95,9 @@ spec: description: DefinitionPath contains the path to expose the API definition. minLength: 1 type: string + environment: + description: Environment denotes the environment of the API. + type: string isDefaultVersion: description: IsDefaultVersion indicates whether this API version should be used as a default API diff --git a/common-controller/internal/config/default_config.go b/common-controller/internal/config/default_config.go index 64ef5f510..58bf768ea 100644 --- a/common-controller/internal/config/default_config.go +++ b/common-controller/internal/config/default_config.go @@ -33,5 +33,6 @@ var defaultConfig = &Config{ Truststore: truststore{ Location: "/home/wso2/security/truststore", }, + Environment: "Default", }, } diff --git a/common-controller/internal/config/types.go b/common-controller/internal/config/types.go index f04601736..cffb79abf 100644 --- a/common-controller/internal/config/types.go +++ b/common-controller/internal/config/types.go @@ -39,7 +39,8 @@ type commoncontroller struct { Server server Operator operator // Trusted Certificates - Truststore truststore + Truststore truststore + Environment string } type keystore struct { diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go b/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go index cc9ed6e76..aca647837 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go @@ -109,6 +109,12 @@ type APISpec struct { // +optional // +nullable APIProperties []Property `json:"apiProperties,omitempty"` + + // Environment denotes the environment of the API. + // This is a virtual environment on top of the segmented gateway. + // + // +optional + Environment string `json:"environment"` } // Property holds key value pair of APIProperties diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go b/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go index d69b11c7a..a6beab6c3 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go +++ b/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go @@ -26,6 +26,7 @@ import ( "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/config" "github.com/wso2/apk/common-controller/internal/loggers" + "github.com/wso2/apk/common-controller/internal/operator/utils" "golang.org/x/exp/slices" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" @@ -155,10 +156,14 @@ func (r *API) validateAPIBasePathExistsAndDefaultVersion() *field.Error { } currentAPIBasePathWithoutVersion := getBasePathWithoutVersion(r.Spec.BasePath) + incomingAPIEnvironment := utils.GetEnvironment(r.Spec.Environment) for _, api := range apiList { if (types.NamespacedName{Namespace: r.Namespace, Name: r.Name} != types.NamespacedName{Namespace: api.Namespace, Name: api.Name}) { - if api.Spec.Organization == r.Spec.Organization && api.Spec.BasePath == r.Spec.BasePath { + + existingAPIEnvironment := utils.GetEnvironment(api.Spec.Environment) + if api.Spec.Organization == r.Spec.Organization && api.Spec.BasePath == r.Spec.BasePath && + incomingAPIEnvironment == existingAPIEnvironment { return &field.Error{ Type: field.ErrorTypeDuplicate, Field: field.NewPath("spec").Child("basePath").String(), diff --git a/common-controller/internal/operator/utils/utils.go b/common-controller/internal/operator/utils/utils.go new file mode 100644 index 000000000..28e2bb513 --- /dev/null +++ b/common-controller/internal/operator/utils/utils.go @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package utils + +import ( + "github.com/wso2/apk/common-controller/internal/config" +) + +// GetEnvironment takes the environment of the API. If the value is empty, +// it will return the default environment that is set in the config of the common controller. +func GetEnvironment(environment string) string { + if environment != "" { + return environment + } + return config.ReadConfigs().CommonController.Environment +} From d085009b0351829685021c9c0f73fd7c07e913ac Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Mon, 28 Aug 2023 10:34:53 +0530 Subject: [PATCH 02/24] Adding the changed API crd --- helm-charts/crds/dp.wso2.com_apis.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helm-charts/crds/dp.wso2.com_apis.yaml b/helm-charts/crds/dp.wso2.com_apis.yaml index 8a98f9e3a..52f18e26f 100644 --- a/helm-charts/crds/dp.wso2.com_apis.yaml +++ b/helm-charts/crds/dp.wso2.com_apis.yaml @@ -95,6 +95,10 @@ spec: description: DefinitionPath contains the path to expose the API definition. minLength: 1 type: string + environment: + description: Environment denotes the environment of the API. This + is a virtual environment on top of the segmented gateway. + type: string isDefaultVersion: description: IsDefaultVersion indicates whether this API version should be used as a default API From a7e3ba0f5124fca7d3de8ac99ee53a34cb1b4b07 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 29 Aug 2023 12:48:42 +0530 Subject: [PATCH 03/24] Passing environment field from Adapter to Enforcer --- .../api/proto/wso2/discovery/api/api.proto | 1 + adapter/config/default_config.go | 1 + adapter/config/types.go | 2 + .../internal/oasparser/config_generator.go | 1 + .../envoyconf/routes_with_clusters_test.go | 86 +++++++++++ .../oasparser/model/adapter_internal_api.go | 11 ++ .../operator/apis/dp/v1alpha1/api_types.go | 3 +- .../operator/synchronizer/synchronizer.go | 8 + .../api/wso2/discovery/api/api.pb.go | 28 ++-- .../operator/apis/dp/v1alpha1/api_types.go | 3 +- .../apk/enforcer/commons/model/APIConfig.java | 15 ++ .../org/wso2/apk/enforcer/api/RestAPI.java | 2 +- .../wso2/apk/enforcer/discovery/api/Api.java | 138 ++++++++++++++++++ .../enforcer/discovery/api/ApiOrBuilder.java | 12 ++ .../apk/enforcer/discovery/api/ApiProto.java | 12 +- helm-charts/crds/dp.wso2.com_apis.yaml | 1 + 16 files changed, 306 insertions(+), 18 deletions(-) diff --git a/adapter/api/proto/wso2/discovery/api/api.proto b/adapter/api/proto/wso2/discovery/api/api.proto index ef315612a..5688b1cc6 100644 --- a/adapter/api/proto/wso2/discovery/api/api.proto +++ b/adapter/api/proto/wso2/discovery/api/api.proto @@ -54,4 +54,5 @@ message Api { bool systemAPI = 24; BackendJWTTokenInfo backendJWTTokenInfo = 25; bytes apiDefinitionFile = 26; + string environment = 27; } diff --git a/adapter/config/default_config.go b/adapter/config/default_config.go index a99115552..5a2dc0808 100644 --- a/adapter/config/default_config.go +++ b/adapter/config/default_config.go @@ -42,6 +42,7 @@ var defaultConfig = &Config{ Operator: operator{ Namespaces: nil, }, + Environment: "default", }, Envoy: envoy{ ListenerCodecType: "AUTO", diff --git a/adapter/config/types.go b/adapter/config/types.go index 1f2dc978a..6ed5852e2 100644 --- a/adapter/config/types.go +++ b/adapter/config/types.go @@ -93,6 +93,8 @@ type adapter struct { SoapErrorInXMLEnabled bool // Operator represents the operator related configurations Operator operator + // Environment of the Adapter + Environment string } // Envoy Listener Component related configurations. diff --git a/adapter/internal/oasparser/config_generator.go b/adapter/internal/oasparser/config_generator.go index 14aac9338..5042bddb3 100644 --- a/adapter/internal/oasparser/config_generator.go +++ b/adapter/internal/oasparser/config_generator.go @@ -213,6 +213,7 @@ func GetEnforcerAPI(adapterInternalAPI model.AdapterInternalAPI, vhost string) * // GraphqlComplexityInfo: adapterInternalAPI.GraphQLComplexities.Data.List, SystemAPI: adapterInternalAPI.IsSystemAPI, ApiDefinitionFile: adapterInternalAPI.GetAPIDefinitionFile(), + Environment: adapterInternalAPI.GetEnvironment(), } } diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go index e096a266d..026338929 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go @@ -156,6 +156,92 @@ func TestCreateRoutesWithClustersWithExactAndRegularExpressionRules(t *testing.T "The route regex for the two paths should not be the same") } +func TestGenerateAdapterInternalAPIForDefaultCase(t *testing.T) { + + apiState := generateSampleAPI("test-api-1", "1.0.0", "/test-api/1.0.0") + httpRouteState := synchronizer.HTTPRouteState{} + httpRouteState = *apiState.ProdHTTPRoute + + adapterInternalAPI, err := synchronizer.GenerateAdapterInternalAPI(apiState, &httpRouteState, constants.Production) + assert.Nil(t, err, "Error should not be present when apiState is converted to a AdapterInternalAPI object") + assert.Equal(t, "default", adapterInternalAPI.GetEnvironment(), "Environment is incorrect.") +} + +func TestGenerateAdapterInternalAPIForSpecificEnvironment(t *testing.T) { + + apiState := generateSampleAPI("test-api-2", "1.0.0", "/test-api2/1.0.0") + httpRouteState := synchronizer.HTTPRouteState{} + httpRouteState = *apiState.ProdHTTPRoute + apiState.APIDefinition.Spec.Environment = "dev" + + adapterInternalAPI, err := synchronizer.GenerateAdapterInternalAPI(apiState, &httpRouteState, constants.Production) + assert.Nil(t, err, "Error should not be present when apiState is converted to a AdapterInternalAPI object") + assert.Equal(t, "dev", adapterInternalAPI.GetEnvironment(), "Environment is incorrect.") +} + +func generateSampleAPI(apiName string, apiVersion string, apiContext string) synchronizer.APIState { + + apiState := synchronizer.APIState{} + apiDefinition := v1alpha1.API{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "default", + Name: apiName, + }, + Spec: v1alpha1.APISpec{ + APIDisplayName: apiName, + APIVersion: apiVersion, + Context: apiContext, + Production: []v1alpha1.EnvConfig{ + { + HTTPRouteRefs: []string{ + apiName + "-prod-http-route", + }, + }, + }, + }, + } + apiState.APIDefinition = &apiDefinition + httpRouteState := synchronizer.HTTPRouteState{} + methodTypeGet := gwapiv1b1.HTTPMethodGet + + httpRoute := gwapiv1b1.HTTPRoute{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "default", + Name: apiName + "-prod-http-route", + }, + Spec: gwapiv1b1.HTTPRouteSpec{ + Hostnames: []gwapiv1b1.Hostname{"prod.gw.wso2.com"}, + CommonRouteSpec: createDefaultCommonRouteSpec(), + Rules: []gwapiv1b1.HTTPRouteRule{ + { + Matches: []gwapiv1b1.HTTPRouteMatch{ + { + Path: &gwapiv1b1.HTTPPathMatch{ + Type: operatorutils.PathMatchTypePtr(gwapiv1b1.PathMatchExact), + Value: operatorutils.StringPtr("/exact-path-api/2.0.0/(.*)/exact-path"), + }, + Method: &methodTypeGet, + }, + }, + BackendRefs: []gwapiv1b1.HTTPBackendRef{ + createDefaultBackendRef(apiName + "backend-1"), + }, + }, + }, + }, + } + + httpRouteState.HTTPRouteCombined = &httpRoute + + backendMapping := make(map[string]*v1alpha1.ResolvedBackend) + backendMapping[k8types.NamespacedName{Namespace: "default", Name: apiName + "backend-1"}.String()] = + &v1alpha1.ResolvedBackend{Services: []v1alpha1.Service{{Host: "test-service-1.default", Port: 7001}}, Protocol: v1alpha1.HTTPProtocol} + httpRouteState.BackendMapping = backendMapping + + apiState.ProdHTTPRoute = &httpRouteState + return apiState +} + // TODO: Fix this test case func TestCreateRoutesWithClustersWithMultiplePathPrefixRules(t *testing.T) { apiState := synchronizer.APIState{} diff --git a/adapter/internal/oasparser/model/adapter_internal_api.go b/adapter/internal/oasparser/model/adapter_internal_api.go index 30371fbcb..66833965c 100644 --- a/adapter/internal/oasparser/model/adapter_internal_api.go +++ b/adapter/internal/oasparser/model/adapter_internal_api.go @@ -70,6 +70,7 @@ type AdapterInternalAPI struct { // GraphQLComplexities GraphQLComplexityYaml IsSystemAPI bool RateLimitPolicy *RateLimitPolicy + environment string } // BackendJWTTokenInfo represents the object structure holding the information related to the JWT Generator @@ -390,6 +391,16 @@ func (swagger *AdapterInternalAPI) GetOrganizationID() string { return swagger.OrganizationID } +// SetEnvironment sets the environment of the API. +func (swagger *AdapterInternalAPI) SetEnvironment(environment string) { + swagger.environment = environment +} + +// GetEnvironment returns the environment of the API +func (swagger *AdapterInternalAPI) GetEnvironment() string { + return swagger.environment +} + // Validate method confirms that the adapterInternalAPI has all required fields in the required format. // This needs to be checked prior to generate router/enforcer related resources. func (swagger *AdapterInternalAPI) Validate() error { diff --git a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go index 8d890813d..afc61a6b8 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go @@ -113,7 +113,8 @@ type APISpec struct { // Environment denotes the environment of the API. // // +optional - Environment string `json:"environment"` + // +nullable + Environment string `json:"environment,omitempty"` } // Property holds key value pair of APIProperties diff --git a/adapter/internal/operator/synchronizer/synchronizer.go b/adapter/internal/operator/synchronizer/synchronizer.go index 3b1ea19a6..ce22c4ea9 100644 --- a/adapter/internal/operator/synchronizer/synchronizer.go +++ b/adapter/internal/operator/synchronizer/synchronizer.go @@ -158,6 +158,14 @@ func GenerateAdapterInternalAPI(apiState APIState, httpRoute *HTTPRouteState, en adapterInternalAPI.SetAPIDefinitionFile(apiState.APIDefinitionFile) adapterInternalAPI.SetAPIDefinitionEndpoint(apiState.APIDefinition.Spec.DefinitionPath) adapterInternalAPI.EnvType = envType + + environment := apiState.APIDefinition.Spec.Environment + if environment == "" { + conf := config.ReadConfigs() + environment = conf.Adapter.Environment + } + adapterInternalAPI.SetEnvironment(environment) + resourceParams := model.ResourceParams{ AuthSchemes: apiState.Authentications, ResourceAuthSchemes: apiState.ResourceAuthentications, diff --git a/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go b/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go index 25f867493..d031764f0 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/api/api.pb.go @@ -64,6 +64,7 @@ type Api struct { SystemAPI bool `protobuf:"varint,24,opt,name=systemAPI,proto3" json:"systemAPI,omitempty"` BackendJWTTokenInfo *BackendJWTTokenInfo `protobuf:"bytes,25,opt,name=backendJWTTokenInfo,proto3" json:"backendJWTTokenInfo,omitempty"` ApiDefinitionFile []byte `protobuf:"bytes,26,opt,name=apiDefinitionFile,proto3" json:"apiDefinitionFile,omitempty"` + Environment string `protobuf:"bytes,27,opt,name=environment,proto3" json:"environment,omitempty"` } func (x *Api) Reset() { @@ -231,6 +232,13 @@ func (x *Api) GetApiDefinitionFile() []byte { return nil } +func (x *Api) GetEnvironment() string { + if x != nil { + return x.Environment + } + return "" +} + var File_wso2_discovery_api_api_proto protoreflect.FileDescriptor var file_wso2_discovery_api_api_proto_rawDesc = []byte{ @@ -244,7 +252,7 @@ var file_wso2_discovery_api_api_proto_rawDesc = []byte{ 0x69, 0x63, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x2c, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4a, 0x57, 0x54, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x49, - 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x05, 0x0a, 0x03, 0x41, 0x70, + 0x6e, 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x99, 0x06, 0x0a, 0x03, 0x41, 0x70, 0x69, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, @@ -292,14 +300,16 @@ var file_wso2_discovery_api_api_proto_rawDesc = []byte{ 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2c, 0x0a, 0x11, 0x61, 0x70, 0x69, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x69, 0x6c, 0x65, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x11, 0x61, 0x70, 0x69, 0x44, 0x65, 0x66, 0x69, 0x6e, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x46, - 0x69, 0x6c, 0x65, 0x42, 0x70, 0x0a, 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, - 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x08, 0x41, 0x70, 0x69, 0x50, - 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, - 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, - 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, - 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x61, 0x70, - 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x6c, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, + 0x6e, 0x74, 0x18, 0x1b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, + 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x70, 0x0a, 0x23, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, + 0x32, 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, + 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x61, 0x70, 0x69, 0x42, 0x08, 0x41, 0x70, + 0x69, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x3d, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, + 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, + 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, + 0x61, 0x70, 0x69, 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go b/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go index aca647837..6ed612360 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go @@ -114,7 +114,8 @@ type APISpec struct { // This is a virtual environment on top of the segmented gateway. // // +optional - Environment string `json:"environment"` + // +nullable + Environment string `json:"environment,omitempty"` } // Property holds key value pair of APIProperties diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java index 3e9b5fc15..789b51481 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java @@ -53,6 +53,7 @@ public class APIConfig { private JWTConfigurationDto jwtConfigurationDto; private boolean systemAPI; private byte[] apiDefinition; + private String environment; /** * getApiType returns the API type. This could be one of the following. * HTTP, WS, WEBHOOK @@ -235,6 +236,14 @@ public JWTConfigurationDto getJwtConfigurationDto() { return jwtConfigurationDto; } + /** + * Returns the environment of the API. + * @return String. + */ + public String getEnvironment() { + return environment; + } + /** * Implements builder pattern to build an API Config object. */ @@ -262,6 +271,7 @@ public static class Builder { private boolean systemAPI; private byte[] apiDefinition; private JWTConfigurationDto jwtConfigurationDto; + private String environment; public Builder(String name) { this.name = name; } @@ -368,6 +378,10 @@ public Builder apiDefinition(byte[] apiDefinition) { this.apiDefinition = apiDefinition; return this; } + public Builder environment(String environment) { + this.environment = environment; + return this; + } public APIConfig build() { APIConfig apiConfig = new APIConfig(); apiConfig.name = this.name; @@ -392,6 +406,7 @@ public APIConfig build() { apiConfig.systemAPI = this.systemAPI; apiConfig.jwtConfigurationDto = this.jwtConfigurationDto; apiConfig.apiDefinition = this.apiDefinition; + apiConfig.environment = this.environment; return apiConfig; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java index d89356f7f..aaf33ad06 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java @@ -145,7 +145,7 @@ public String init(Api api) { .disableScopes(api.getDisableScopes()).trustStore(trustStore).organizationId(api.getOrganizationId()) .mtlsCertificateTiers(mtlsCertificateTiers).mutualSSL(mutualSSL).systemAPI(api.getSystemAPI()) .applicationSecurity(applicationSecurity).jwtConfigurationDto(jwtConfigurationDto) - .apiDefinition(apiDefinition).build(); + .apiDefinition(apiDefinition).environment(api.getEnvironment()).build(); initFilters(); return basePath; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Api.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Api.java index 0a9c010ab..51b7d871a 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Api.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/Api.java @@ -34,6 +34,7 @@ private Api() { clientCertificates_ = java.util.Collections.emptyList(); mutualSSL_ = ""; apiDefinitionFile_ = com.google.protobuf.ByteString.EMPTY; + environment_ = ""; } @java.lang.Override @@ -189,6 +190,12 @@ private Api( apiDefinitionFile_ = input.readBytes(); break; } + case 218: { + java.lang.String s = input.readStringRequireUtf8(); + + environment_ = s; + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -831,6 +838,44 @@ public com.google.protobuf.ByteString getApiDefinitionFile() { return apiDefinitionFile_; } + public static final int ENVIRONMENT_FIELD_NUMBER = 27; + private volatile java.lang.Object environment_; + /** + * string environment = 27; + * @return The environment. + */ + @java.lang.Override + public java.lang.String getEnvironment() { + java.lang.Object ref = environment_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + environment_ = s; + return s; + } + } + /** + * string environment = 27; + * @return The bytes for environment. + */ + @java.lang.Override + public com.google.protobuf.ByteString + getEnvironmentBytes() { + java.lang.Object ref = environment_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + environment_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -902,6 +947,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) if (!apiDefinitionFile_.isEmpty()) { output.writeBytes(26, apiDefinitionFile_); } + if (!getEnvironmentBytes().isEmpty()) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 27, environment_); + } unknownFields.writeTo(output); } @@ -976,6 +1024,9 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeBytesSize(26, apiDefinitionFile_); } + if (!getEnvironmentBytes().isEmpty()) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(27, environment_); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -1032,6 +1083,8 @@ public boolean equals(final java.lang.Object obj) { } if (!getApiDefinitionFile() .equals(other.getApiDefinitionFile())) return false; + if (!getEnvironment() + .equals(other.getEnvironment())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -1091,6 +1144,8 @@ public int hashCode() { } hash = (37 * hash) + APIDEFINITIONFILE_FIELD_NUMBER; hash = (53 * hash) + getApiDefinitionFile().hashCode(); + hash = (37 * hash) + ENVIRONMENT_FIELD_NUMBER; + hash = (53 * hash) + getEnvironment().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -1280,6 +1335,8 @@ public Builder clear() { } apiDefinitionFile_ = com.google.protobuf.ByteString.EMPTY; + environment_ = ""; + return this; } @@ -1346,6 +1403,7 @@ public org.wso2.apk.enforcer.discovery.api.Api buildPartial() { result.backendJWTTokenInfo_ = backendJWTTokenInfoBuilder_.build(); } result.apiDefinitionFile_ = apiDefinitionFile_; + result.environment_ = environment_; onBuilt(); return result; } @@ -1508,6 +1566,10 @@ public Builder mergeFrom(org.wso2.apk.enforcer.discovery.api.Api other) { if (other.getApiDefinitionFile() != com.google.protobuf.ByteString.EMPTY) { setApiDefinitionFile(other.getApiDefinitionFile()); } + if (!other.getEnvironment().isEmpty()) { + environment_ = other.environment_; + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -3217,6 +3279,82 @@ public Builder clearApiDefinitionFile() { onChanged(); return this; } + + private java.lang.Object environment_ = ""; + /** + * string environment = 27; + * @return The environment. + */ + public java.lang.String getEnvironment() { + java.lang.Object ref = environment_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + environment_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * string environment = 27; + * @return The bytes for environment. + */ + public com.google.protobuf.ByteString + getEnvironmentBytes() { + java.lang.Object ref = environment_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8( + (java.lang.String) ref); + environment_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * string environment = 27; + * @param value The environment to set. + * @return This builder for chaining. + */ + public Builder setEnvironment( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + + environment_ = value; + onChanged(); + return this; + } + /** + * string environment = 27; + * @return This builder for chaining. + */ + public Builder clearEnvironment() { + + environment_ = getDefaultInstance().getEnvironment(); + onChanged(); + return this; + } + /** + * string environment = 27; + * @param value The bytes for environment to set. + * @return This builder for chaining. + */ + public Builder setEnvironmentBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + + environment_ = value; + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiOrBuilder.java index 891a11238..9656c6f27 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiOrBuilder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiOrBuilder.java @@ -256,4 +256,16 @@ org.wso2.apk.enforcer.discovery.api.CertificateOrBuilder getClientCertificatesOr * @return The apiDefinitionFile. */ com.google.protobuf.ByteString getApiDefinitionFile(); + + /** + * string environment = 27; + * @return The environment. + */ + java.lang.String getEnvironment(); + /** + * string environment = 27; + * @return The bytes for environment. + */ + com.google.protobuf.ByteString + getEnvironmentBytes(); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiProto.java index 9ea5a8435..485076d63 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/api/ApiProto.java @@ -32,7 +32,7 @@ public static void registerAllExtensions( "covery.api\032!wso2/discovery/api/Resource." + "proto\032$wso2/discovery/api/Certificate.pr" + "oto\032,wso2/discovery/api/BackendJWTTokenI" + - "nfo.proto\"\376\003\n\003Api\022\n\n\002id\030\001 \001(\t\022\r\n\005title\030\002" + + "nfo.proto\"\223\004\n\003Api\022\n\n\002id\030\001 \001(\t\022\r\n\005title\030\002" + " \001(\t\022\017\n\007version\030\003 \001(\t\022\017\n\007apiType\030\004 \001(\t\022\036" + "\n\026disableAuthentications\030\005 \001(\010\022\025\n\rdisabl" + "eScopes\030\006 \001(\010\022\017\n\007envType\030\007 \001(\t\022/\n\tresour" + @@ -45,10 +45,10 @@ public static void registerAllExtensions( "\030\020 \001(\010\022\021\n\tsystemAPI\030\030 \001(\010\022D\n\023backendJWTT" + "okenInfo\030\031 \001(\0132\'.wso2.discovery.api.Back" + "endJWTTokenInfo\022\031\n\021apiDefinitionFile\030\032 \001" + - "(\014Bp\n#org.wso2.apk.enforcer.discovery.ap" + - "iB\010ApiProtoP\001Z=github.com/envoyproxy/go-" + - "control-plane/wso2/discovery/api;apib\006pr" + - "oto3" + "(\014\022\023\n\013environment\030\033 \001(\tBp\n#org.wso2.apk." + + "enforcer.discovery.apiB\010ApiProtoP\001Z=gith" + + "ub.com/envoyproxy/go-control-plane/wso2/" + + "discovery/api;apib\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -62,7 +62,7 @@ public static void registerAllExtensions( internal_static_wso2_discovery_api_Api_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_api_Api_descriptor, - new java.lang.String[] { "Id", "Title", "Version", "ApiType", "DisableAuthentications", "DisableScopes", "EnvType", "Resources", "BasePath", "Tier", "ApiLifeCycleState", "Vhost", "OrganizationId", "ClientCertificates", "MutualSSL", "ApplicationSecurity", "SystemAPI", "BackendJWTTokenInfo", "ApiDefinitionFile", }); + new java.lang.String[] { "Id", "Title", "Version", "ApiType", "DisableAuthentications", "DisableScopes", "EnvType", "Resources", "BasePath", "Tier", "ApiLifeCycleState", "Vhost", "OrganizationId", "ClientCertificates", "MutualSSL", "ApplicationSecurity", "SystemAPI", "BackendJWTTokenInfo", "ApiDefinitionFile", "Environment", }); org.wso2.apk.enforcer.discovery.api.ResourceProto.getDescriptor(); org.wso2.apk.enforcer.discovery.api.CertificateProto.getDescriptor(); org.wso2.apk.enforcer.discovery.api.BackendJWTTokenInfoProto.getDescriptor(); diff --git a/helm-charts/crds/dp.wso2.com_apis.yaml b/helm-charts/crds/dp.wso2.com_apis.yaml index 52f18e26f..77406468b 100644 --- a/helm-charts/crds/dp.wso2.com_apis.yaml +++ b/helm-charts/crds/dp.wso2.com_apis.yaml @@ -98,6 +98,7 @@ spec: environment: description: Environment denotes the environment of the API. This is a virtual environment on top of the segmented gateway. + nullable: true type: string isDefaultVersion: description: IsDefaultVersion indicates whether this API version should From 52d92add5ba8254cf0fc1afc6f3776bb1cc2c09f Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Thu, 31 Aug 2023 14:01:05 +0530 Subject: [PATCH 04/24] Adding environment ID for Choreo Analytics --- adapter/config/default_config.go | 2 +- .../envoyconf/routes_with_clusters_test.go | 2 +- .../analytics/publishers/dto/ExtendedAPI.java | 10 ++++- .../apk/enforcer/commons/model/APIConfig.java | 8 ++-- .../enforcer/commons/model/Environment.java | 37 +++++++++++++++++++ .../enforcer/analytics/AnalyticsFilter.java | 11 +++++- .../analytics/ChoreoAnalyticsProvider.java | 1 + .../org/wso2/apk/enforcer/api/RestAPI.java | 7 +++- .../apk/enforcer/constants/APIConstants.java | 2 + .../enforcer/constants/MetadataConstants.java | 3 ++ 10 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java diff --git a/adapter/config/default_config.go b/adapter/config/default_config.go index 5a2dc0808..820a3a86d 100644 --- a/adapter/config/default_config.go +++ b/adapter/config/default_config.go @@ -42,7 +42,7 @@ var defaultConfig = &Config{ Operator: operator{ Namespaces: nil, }, - Environment: "default", + Environment: "Default", }, Envoy: envoy{ ListenerCodecType: "AUTO", diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go index 026338929..842c09b9d 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go @@ -164,7 +164,7 @@ func TestGenerateAdapterInternalAPIForDefaultCase(t *testing.T) { adapterInternalAPI, err := synchronizer.GenerateAdapterInternalAPI(apiState, &httpRouteState, constants.Production) assert.Nil(t, err, "Error should not be present when apiState is converted to a AdapterInternalAPI object") - assert.Equal(t, "default", adapterInternalAPI.GetEnvironment(), "Environment is incorrect.") + assert.Equal(t, "Default", adapterInternalAPI.GetEnvironment(), "Environment is incorrect.") } func TestGenerateAdapterInternalAPIForSpecificEnvironment(t *testing.T) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java index 9ab6877f2..783288a54 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java @@ -22,7 +22,7 @@ */ public class ExtendedAPI extends API { private String organizationId; - + private String environmentId; private String apiContext; public String getOrganizationId() { @@ -40,4 +40,12 @@ public String getApiContext() { public void setApiContext(String apiContext) { this.apiContext = apiContext; } + + public String getEnvironment() { + return environmentId; + } + + public void setEnvironmentId(String environmentId) { + this.environmentId = environmentId; + } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java index 789b51481..3e617cba1 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java @@ -53,7 +53,7 @@ public class APIConfig { private JWTConfigurationDto jwtConfigurationDto; private boolean systemAPI; private byte[] apiDefinition; - private String environment; + private Environment environment; /** * getApiType returns the API type. This could be one of the following. * HTTP, WS, WEBHOOK @@ -240,7 +240,7 @@ public JWTConfigurationDto getJwtConfigurationDto() { * Returns the environment of the API. * @return String. */ - public String getEnvironment() { + public Environment getEnvironment() { return environment; } @@ -271,7 +271,7 @@ public static class Builder { private boolean systemAPI; private byte[] apiDefinition; private JWTConfigurationDto jwtConfigurationDto; - private String environment; + private Environment environment; public Builder(String name) { this.name = name; } @@ -378,7 +378,7 @@ public Builder apiDefinition(byte[] apiDefinition) { this.apiDefinition = apiDefinition; return this; } - public Builder environment(String environment) { + public Builder environment(Environment environment) { this.environment = environment; return this; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java new file mode 100644 index 000000000..cc4afc4e4 --- /dev/null +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.wso2.apk.enforcer.commons.model; + +public class Environment { + + private String name; + private String id; + + public Environment(String name, String id) { + this.name = name; + this.id = id; + } + + public String getName() { + return name; + } + + public String getId() { + return id; + } +} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java index f7c109d60..13106f227 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java @@ -202,6 +202,15 @@ public void handleSuccessRequest(RequestContext requestContext) { endUserName == null ? APIConstants.END_USER_UNKNOWN : endUserName); requestContext.addMetadataToMap(MetadataConstants.API_CONTEXT_KEY, requestContext.getMatchedAPI().getBasePath()); + requestContext.addMetadataToMap(MetadataConstants.API_ENVIRONMENT_NAME, + requestContext.getMatchedAPI().getEnvironment().getName() == null + ? APIConstants.DEFAULT_ENVIRONMENT_NAME + : requestContext.getMatchedAPI().getEnvironment().getName()); + requestContext.addMetadataToMap(MetadataConstants.API_ENVIRONMENT_ID, + requestContext.getMatchedAPI().getEnvironment().getId() == null + ? APIConstants.DEFAULT_ENVIRONMENT_ID + : requestContext.getMatchedAPI().getEnvironment().getId()); + } finally { if (Utils.tracingEnabled()) { analyticsSpanScope.close(); @@ -280,7 +289,7 @@ private static AnalyticsEventPublisher loadAnalyticsPublisher(String className, logger.error("Error while loading the custom analytics publisher class.", ErrorDetails.errorLog(LoggingConstants.Severity.MAJOR, 5105), e); } catch (InstantiationException | IllegalAccessException | InvocationTargetException - | NoSuchMethodException e) { + | NoSuchMethodException e) { logger.error("Error while generating AnalyticsEventPublisherInstance from the class", ErrorDetails.errorLog(LoggingConstants.Severity.CRITICAL, 5106), e); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java index 30e843e2a..7d00549f1 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java @@ -118,6 +118,7 @@ public API getApi() { api.setApiCreatorTenantDomain(getValueAsString(fieldsMap, MetadataConstants.API_CREATOR_TENANT_DOMAIN_KEY)); api.setOrganizationId(getValueAsString(fieldsMap, MetadataConstants.API_ORGANIZATION_ID)); api.setApiContext(getValueAsString(fieldsMap, MetadataConstants.API_CONTEXT_KEY)); + api.setEnvironmentId(getValueAsString(fieldsMap, MetadataConstants.API_ENVIRONMENT_ID)); return api; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java index aaf33ad06..3596c9268 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java @@ -32,6 +32,7 @@ import org.wso2.apk.enforcer.analytics.AnalyticsFilter; import org.wso2.apk.enforcer.commons.Filter; import org.wso2.apk.enforcer.commons.model.APIConfig; +import org.wso2.apk.enforcer.commons.model.Environment; import org.wso2.apk.enforcer.commons.model.MockedApiConfig; import org.wso2.apk.enforcer.commons.model.MockedContentExamples; import org.wso2.apk.enforcer.commons.model.MockedHeaderConfig; @@ -138,6 +139,10 @@ public String init(Api api) { apiDefinition = api.getApiDefinitionFile().toByteArray(); } + // TODO(Pubudu) Resolve EnvironmentId from the Control Plane. Based on the environment defined + // in the API, relevant environment Id should be retrieved per user. + Environment environment = new Environment(api.getEnvironment(), APIConstants.DEFAULT_ENVIRONMENT_ID); + this.apiLifeCycleState = api.getApiLifeCycleState(); this.apiConfig = new APIConfig.Builder(name).uuid(api.getId()).vhost(vhost).basePath(basePath).version(version) .resources(resources).apiType(apiType).apiLifeCycleState(apiLifeCycleState).tier(api.getTier()) @@ -145,7 +150,7 @@ public String init(Api api) { .disableScopes(api.getDisableScopes()).trustStore(trustStore).organizationId(api.getOrganizationId()) .mtlsCertificateTiers(mtlsCertificateTiers).mutualSSL(mutualSSL).systemAPI(api.getSystemAPI()) .applicationSecurity(applicationSecurity).jwtConfigurationDto(jwtConfigurationDto) - .apiDefinition(apiDefinition).environment(api.getEnvironment()).build(); + .apiDefinition(apiDefinition).environment(environment).build(); initFilters(); return basePath; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java index d2e69757b..9cdc764e2 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java @@ -45,6 +45,8 @@ public class APIConstants { public static final String AUTHORIZATION_BEARER = "Bearer "; public static final String API_KEY_TYPE_PRODUCTION = "PRODUCTION"; public static final String API_KEY_TYPE_SANDBOX = "SANDBOX"; + public static final String DEFAULT_ENVIRONMENT_NAME = "Default"; + public static final String DEFAULT_ENVIRONMENT_ID = "Default-ID"; public static final String AUTHORIZATION_HEADER_BASIC = "Basic"; public static final String API_SECURITY_OAUTH2 = "oauth2"; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java index 20f9aa86e..376ec976e 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java @@ -55,4 +55,7 @@ public class MetadataConstants { public static final String ERROR_CODE_KEY = "ErrorCode"; public static final String CHOREO_CONNECT_ENFORCER_REPLY = "apk-enforcer-reply"; public static final String RATELIMIT_WSO2_ORG_PREFIX = "customorg"; + public static final String API_ENVIRONMENT_NAME = WSO2_METADATA_PREFIX + "api-environment-name"; + public static final String API_ENVIRONMENT_ID = WSO2_METADATA_PREFIX + "api-environment-id"; + } From 723ef7a26c535616d93ecfaebbc8e71f8cdb3929 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 1 Sep 2023 14:55:11 +0530 Subject: [PATCH 05/24] Changing vhost to environment for rate limiting in the common controller --- .../apis/dp/v1alpha1/resolveRatelimit.go | 2 +- .../apis/dp/v1alpha1/zz_generated.deepcopy.go | 5 - .../controller/ratelimitpolicy_controller.go | 82 +++++--------- .../internal/xds/ratelimiter_cache.go | 101 +++++++++--------- common-controller/internal/xds/server.go | 12 +-- 5 files changed, 84 insertions(+), 118 deletions(-) diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go b/common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go index bb8c319be..e3787acc0 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go +++ b/common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go @@ -24,9 +24,9 @@ type ResolveRateLimitAPIPolicy struct { API ResolveRateLimit `json:"api,omitempty"` Resources []ResolveResource `json:"resourceList,omitempty"` Organization string `json:"organization,omitempty"` - Vhost []string `json:"vhost,omitempty"` BasePath string `json:"basePath,omitempty"` UUID string `json:"uuid,omitempty"` + Environment string `json:"environment,omitempty"` } // ResolveRateLimit is the rate limit value for the applied policy diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go b/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go index f71f26347..9fc6c5768 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go +++ b/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go @@ -997,11 +997,6 @@ func (in *ResolveRateLimitAPIPolicy) DeepCopyInto(out *ResolveRateLimitAPIPolicy *out = make([]ResolveResource, len(*in)) copy(*out, *in) } - if in.Vhost != nil { - in, out := &in.Vhost, &out.Vhost - *out = make([]string, len(*in)) - copy(*out, *in) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResolveRateLimitAPIPolicy. diff --git a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go index 7b33e76ba..7bc8b6b69 100644 --- a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go +++ b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go @@ -18,8 +18,10 @@ package controller import ( "context" + "fmt" logger "github.com/sirupsen/logrus" + "github.com/wso2/apk/common-controller/internal/operator/utils" k8error "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/fields" "k8s.io/apimachinery/pkg/runtime" @@ -151,17 +153,21 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) Reconcile(ctx context.Cont } return ctrl.Result{}, nil } - var vhost, resolveRatelimit = ratelimitReconsiler.marshelRateLimit(ctx, ratelimitKey, ratelimitPolicy) - var customRateLimitPolicy = ratelimitReconsiler.marshelCustomRateLimit(ctx, ratelimitKey, ratelimitPolicy) - if vhost == nil && customRateLimitPolicy.Key == "" { - return ctrl.Result{}, nil + if ratelimitPolicy.Spec.Override != nil && ratelimitPolicy.Spec.Override.Custom != nil { + var customRateLimitPolicy = ratelimitReconsiler.marshelCustomRateLimit(ctx, ratelimitKey, ratelimitPolicy) + ratelimitReconsiler.ods.AddorUpdateCustomRatelimitToStore(ratelimitKey, customRateLimitPolicy) + xds.UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicy) + } else { + + if resolveRatelimit, err := ratelimitReconsiler.marshelRateLimit(ctx, ratelimitKey, ratelimitPolicy); err != nil { + return ctrl.Result{}, err + } else if resolveRatelimit != nil { + ratelimitReconsiler.ods.AddorUpdateResolveRatelimitToStore(ratelimitKey, *resolveRatelimit) + xds.UpdateRateLimitXDSCache(*resolveRatelimit) + xds.UpdateRateLimiterPolicies(conf.CommonController.Server.Label) + } } - ratelimitReconsiler.ods.AddorUpdateResolveRatelimitToStore(ratelimitKey, resolveRatelimit) - ratelimitReconsiler.ods.AddorUpdateCustomRatelimitToStore(ratelimitKey, customRateLimitPolicy) - xds.UpdateRateLimitXDSCache(vhost, resolveRatelimit) - xds.UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicy) - xds.UpdateRateLimiterPolicies(conf.CommonController.Server.Label) return ctrl.Result{}, nil } @@ -233,9 +239,8 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) getRatelimitForHTTPRoute(c } func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx context.Context, ratelimitKey types.NamespacedName, - ratelimitPolicy dpv1alpha1.RateLimitPolicy) ([]string, dpv1alpha1.ResolveRateLimitAPIPolicy) { + ratelimitPolicy dpv1alpha1.RateLimitPolicy) (*dpv1alpha1.ResolveRateLimitAPIPolicy, error) { var api dpv1alpha1.API - var vhost []string var resolveResourceList []dpv1alpha1.ResolveResource var resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy // API Level Rate limit policy @@ -244,41 +249,11 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte Namespace: ratelimitKey.Namespace, Name: string(ratelimitPolicy.Spec.TargetRef.Name)}, &api); err != nil { - return nil, resolveRatelimit + return nil, fmt.Errorf("error while getting API : %v, %s", string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) } var organization = api.Spec.Organization var basePath = api.Spec.BasePath - var httpRoute gwapiv1b1.HTTPRoute - if len(api.Spec.Production) > 0 { - for _, ref := range api.Spec.Production[0].HTTPRouteRefs { - if ref != "" { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: ref}, - &httpRoute); err != nil { - return nil, resolveRatelimit - } - for _, hostName := range httpRoute.Spec.Hostnames { - vhost = append(vhost, string(hostName)) - } - } - } - } - if len(api.Spec.Sandbox) > 0 { - for _, ref := range api.Spec.Sandbox[0].HTTPRouteRefs { - if ref != "" { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: ref}, - &httpRoute); err != nil { - return nil, resolveRatelimit - } - for _, hostName := range httpRoute.Spec.Hostnames { - vhost = append(vhost, string(hostName)) - } - } - } - } + if ratelimitPolicy.Spec.Override != nil { resolveRatelimit.API.RequestsPerUnit = ratelimitPolicy.Spec.Override.API.RequestsPerUnit resolveRatelimit.API.Unit = ratelimitPolicy.Spec.Override.API.Unit @@ -286,7 +261,8 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte resolveRatelimit.API.RequestsPerUnit = ratelimitPolicy.Spec.Default.API.RequestsPerUnit resolveRatelimit.API.Unit = ratelimitPolicy.Spec.Default.API.Unit } - resolveRatelimit.Vhost = vhost + + resolveRatelimit.Environment = utils.GetEnvironment(api.Spec.Environment) resolveRatelimit.Organization = organization resolveRatelimit.BasePath = basePath resolveRatelimit.UUID = string(api.ObjectMeta.UID) @@ -298,7 +274,7 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte Namespace: ratelimitKey.Namespace, Name: string(ratelimitPolicy.Spec.TargetRef.Name)}, &api); err != nil { - return nil, resolveRatelimit + return nil, fmt.Errorf("error while getting API : %v, %s", string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) } var organization = api.Spec.Organization var basePath = api.Spec.BasePath @@ -310,7 +286,8 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte Namespace: ratelimitKey.Namespace, Name: ref}, &httpRoute); err != nil { - return nil, resolveRatelimit + return nil, fmt.Errorf("error while getting HTTPRoute : %v for API : %v, %s", string(ref), + string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) } for _, rule := range httpRoute.Spec.Rules { for _, filter := range rule.Filters { @@ -333,9 +310,6 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte } resolveResourceList = append(resolveResourceList, resolveResource) } - for _, hostName := range httpRoute.Spec.Hostnames { - vhost = append(vhost, string(hostName)) - } } } @@ -350,7 +324,8 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte Namespace: ratelimitKey.Namespace, Name: ref}, &httpRoute); err != nil { - return nil, resolveRatelimit + return nil, fmt.Errorf("error while getting HTTPRoute : %v for API : %v, %s", string(ref), + string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) } for _, rule := range httpRoute.Spec.Rules { for _, filter := range rule.Filters { @@ -373,9 +348,6 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte } resolveResourceList = append(resolveResourceList, resolveResource) } - for _, hostName := range httpRoute.Spec.Hostnames { - vhost = append(vhost, string(hostName)) - } } } @@ -386,10 +358,10 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte resolveRatelimit.Organization = organization resolveRatelimit.BasePath = basePath resolveRatelimit.UUID = string(api.ObjectMeta.UID) - resolveRatelimit.Vhost = vhost + resolveRatelimit.Environment = utils.GetEnvironment(api.Spec.Environment) resolveRatelimit.Resources = resolveResourceList } - return vhost, resolveRatelimit + return &resolveRatelimit, nil } func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelCustomRateLimit(ctx context.Context, ratelimitKey types.NamespacedName, diff --git a/common-controller/internal/xds/ratelimiter_cache.go b/common-controller/internal/xds/ratelimiter_cache.go index a3ab11ecf..a540cbc16 100644 --- a/common-controller/internal/xds/ratelimiter_cache.go +++ b/common-controller/internal/xds/ratelimiter_cache.go @@ -38,7 +38,7 @@ import ( const ( DescriptorKeyForOrg = "org" OrgMetadataKey = "customorg" - DescriptorKeyForVhost = "vhost" + DescriptorKeyForEnvironment = "environment" DescriptorKeyForPath = "path" DescriptorKeyForMethod = "method" DescriptorValueForAPIMethod = "ALL" @@ -65,7 +65,7 @@ type rateLimitPolicyCache struct { // TODO: (renuka) move both 'apiLevelRateLimitPolicies' and 'apiLevelMu' to a new struct when doing the App level rate limiting // So app level rate limits are in a new struct and refer in this struct. - // org -> vhost -> API-Identifier (i.e. Vhost:API-UUID) -> Rate Limit Configs + // org -> environment -> API-Identifier (i.e. Environment:API-UUID) -> Rate Limit Configs apiLevelRateLimitPolicies map[string]map[string]map[string]map[string]*rls_config.RateLimitDescriptor // org -> Custom Rate Limit Configs @@ -76,7 +76,7 @@ type rateLimitPolicyCache struct { } // AddAPILevelRateLimitPolicies adds inline Rate Limit policies in APIs to be updated in the Rate Limiter service. -func (r *rateLimitPolicyCache) AddAPILevelRateLimitPolicies(vHosts []string, resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { +func (r *rateLimitPolicyCache) AddAPILevelRateLimitPolicies(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { rlsConfigs := rls_config.RateLimitDescriptor{} httpMethods := []string{"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"} @@ -104,16 +104,17 @@ func (r *rateLimitPolicyCache) AddAPILevelRateLimitPolicies(vHosts []string, res if _, ok := r.apiLevelRateLimitPolicies[org]; !ok { r.apiLevelRateLimitPolicies[org] = make(map[string]map[string]map[string]*rls_config.RateLimitDescriptor) } - for _, vHost := range vHosts { - if _, ok := r.apiLevelRateLimitPolicies[org][vHost]; !ok { - r.apiLevelRateLimitPolicies[org][vHost] = make(map[string]map[string]*rls_config.RateLimitDescriptor) - } - if _, ok := r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path]; !ok { - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path] = make(map[string]*rls_config.RateLimitDescriptor) - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][httpMethod] = rlConf - } else { - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][httpMethod] = rlConf - } + + environment := resolveRatelimit.Environment + if _, ok := r.apiLevelRateLimitPolicies[org][environment]; !ok { + r.apiLevelRateLimitPolicies[org][environment] = make(map[string]map[string]*rls_config.RateLimitDescriptor) + } + + if _, ok := r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path]; !ok { + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path] = make(map[string]*rls_config.RateLimitDescriptor) + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][httpMethod] = rlConf + } else { + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][httpMethod] = rlConf } } } else { @@ -128,16 +129,17 @@ func (r *rateLimitPolicyCache) AddAPILevelRateLimitPolicies(vHosts []string, res if _, ok := r.apiLevelRateLimitPolicies[org]; !ok { r.apiLevelRateLimitPolicies[org] = make(map[string]map[string]map[string]*rls_config.RateLimitDescriptor) } - for _, vHost := range vHosts { - if _, ok := r.apiLevelRateLimitPolicies[org][vHost]; !ok { - r.apiLevelRateLimitPolicies[org][vHost] = make(map[string]map[string]*rls_config.RateLimitDescriptor) - } - if _, ok := r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path]; !ok { - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path] = make(map[string]*rls_config.RateLimitDescriptor) - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][method] = rlConf - } else { - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][method] = rlConf - } + + environment := resolveRatelimit.Environment + if _, ok := r.apiLevelRateLimitPolicies[org][environment]; !ok { + r.apiLevelRateLimitPolicies[org][environment] = make(map[string]map[string]*rls_config.RateLimitDescriptor) + } + + if _, ok := r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path]; !ok { + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path] = make(map[string]*rls_config.RateLimitDescriptor) + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][method] = rlConf + } else { + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath+resolveRatelimit.BasePath+resource.Path][method] = rlConf } } } @@ -158,40 +160,36 @@ func (r *rateLimitPolicyCache) AddAPILevelRateLimitPolicies(vHosts []string, res if _, ok := r.apiLevelRateLimitPolicies[org]; !ok { r.apiLevelRateLimitPolicies[org] = make(map[string]map[string]map[string]*rls_config.RateLimitDescriptor) } - for _, vHost := range vHosts { - if _, ok := r.apiLevelRateLimitPolicies[org][vHost]; !ok { - r.apiLevelRateLimitPolicies[org][vHost] = make(map[string]map[string]*rls_config.RateLimitDescriptor) - } - if _, ok := r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath]; !ok { - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath] = make(map[string]*rls_config.RateLimitDescriptor) - } - r.apiLevelRateLimitPolicies[org][vHost][resolveRatelimit.BasePath][DescriptorValueForAPIMethod] = &rlsConfigs + + environment := resolveRatelimit.Environment + if _, ok := r.apiLevelRateLimitPolicies[org][environment]; !ok { + r.apiLevelRateLimitPolicies[org][environment] = make(map[string]map[string]*rls_config.RateLimitDescriptor) + } + if _, ok := r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath]; !ok { + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath] = make(map[string]*rls_config.RateLimitDescriptor) } + r.apiLevelRateLimitPolicies[org][environment][resolveRatelimit.BasePath][DescriptorValueForAPIMethod] = &rlsConfigs } } // DeleteAPILevelRateLimitPolicies deletes inline Rate Limit policies added with the API. -func (r *rateLimitPolicyCache) DeleteAPILevelRateLimitPolicies(org string, vHosts []string, basePath string) { +func (r *rateLimitPolicyCache) DeleteAPILevelRateLimitPolicies(org string, environment string, basePath string) { r.apiLevelMu.Lock() defer r.apiLevelMu.Unlock() - for _, vHost := range vHosts { - delete(r.apiLevelRateLimitPolicies[org][vHost][basePath], DescriptorValueForAPIMethod) - } + delete(r.apiLevelRateLimitPolicies[org][environment][basePath], DescriptorValueForAPIMethod) } // DeleteAPILevelRateLimitPolicies deletes inline Rate Limit policies added with the API. -func (r *rateLimitPolicyCache) DeleteResourceLevelRateLimitPolicies(org string, vHosts []string, basePath string, path string, method string) { +func (r *rateLimitPolicyCache) DeleteResourceLevelRateLimitPolicies(org string, environment string, basePath string, path string, method string) { httpMethods := []string{"GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"} r.apiLevelMu.Lock() defer r.apiLevelMu.Unlock() - for _, vHost := range vHosts { - if method == constants.All { - for _, httpMethod := range httpMethods { - delete(r.apiLevelRateLimitPolicies[org][vHost][basePath+basePath+path], httpMethod) - } - } else { - delete(r.apiLevelRateLimitPolicies[org][vHost][basePath+basePath+path], method) + if method == constants.All { + for _, httpMethod := range httpMethods { + delete(r.apiLevelRateLimitPolicies[org][environment][basePath+basePath+path], httpMethod) } + } else { + delete(r.apiLevelRateLimitPolicies[org][environment][basePath+basePath+path], method) } } @@ -209,10 +207,10 @@ func (r *rateLimitPolicyCache) generateRateLimitConfig() *rls_config.RateLimitCo defer r.apiLevelMu.RUnlock() // Generate API level rate limit configurations for org, orgPolicies := range r.apiLevelRateLimitPolicies { - var vHostDescriptors []*rls_config.RateLimitDescriptor - for vHost, vHostPolicies := range orgPolicies { + var envDescriptors []*rls_config.RateLimitDescriptor + for env, envPolicies := range orgPolicies { var apiPathDiscriptors []*rls_config.RateLimitDescriptor - for path, apiPathPolicies := range vHostPolicies { + for path, apiPathPolicies := range envPolicies { // Configure API Level rate limit policies only if, the API is deployed to the gateway label // Check API deployed to the gateway label var methodDescriptors []*rls_config.RateLimitDescriptor @@ -228,17 +226,18 @@ func (r *rateLimitPolicyCache) generateRateLimitConfig() *rls_config.RateLimitCo apiPathDiscriptors = append(apiPathDiscriptors, apiPathDiscriptor) } - vHostDescriptor := &rls_config.RateLimitDescriptor{ - Key: DescriptorKeyForVhost, - Value: vHost, + envDescriptor := &rls_config.RateLimitDescriptor{ + Key: DescriptorKeyForEnvironment, + Value: env, Descriptors: apiPathDiscriptors, } - vHostDescriptors = append(vHostDescriptors, vHostDescriptor) + envDescriptors = append(envDescriptors, envDescriptor) } + orgDescriptor := &rls_config.RateLimitDescriptor{ Key: DescriptorKeyForOrg, Value: org, - Descriptors: vHostDescriptors, + Descriptors: envDescriptors, } orgDescriptors = append(orgDescriptors, orgDescriptor) } diff --git a/common-controller/internal/xds/server.go b/common-controller/internal/xds/server.go index d92f4f175..7a3782043 100644 --- a/common-controller/internal/xds/server.go +++ b/common-controller/internal/xds/server.go @@ -55,9 +55,9 @@ func GetRateLimiterCache() envoy_cachev3.SnapshotCache { } // UpdateRateLimitXDSCache updates the xDS cache of the RateLimiter. -func UpdateRateLimitXDSCache(vhosts []string, resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { +func UpdateRateLimitXDSCache(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { // Add Rate Limit inline policies in API to the cache - rlsPolicyCache.AddAPILevelRateLimitPolicies(vhosts, resolveRatelimit) + rlsPolicyCache.AddAPILevelRateLimitPolicies(resolveRatelimit) } // UpdateRateLimitXDSCacheForCustomPolicies updates the xDS cache of the RateLimiter for custom policies. @@ -70,19 +70,19 @@ func UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicies dpv1alpha1 // DeleteAPILevelRateLimitPolicies delete the ratelimit xds cache func DeleteAPILevelRateLimitPolicies(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { var org = resolveRatelimit.Organization - var vhost = resolveRatelimit.Vhost + var environment = resolveRatelimit.Environment var basePath = resolveRatelimit.BasePath - rlsPolicyCache.DeleteAPILevelRateLimitPolicies(org, vhost, basePath) + rlsPolicyCache.DeleteAPILevelRateLimitPolicies(org, environment, basePath) } // DeleteResourceLevelRateLimitPolicies delete the ratelimit xds cache func DeleteResourceLevelRateLimitPolicies(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { var org = resolveRatelimit.Organization - var vhost = resolveRatelimit.Vhost + var environment = resolveRatelimit.Environment var basePath = resolveRatelimit.BasePath var path = resolveRatelimit.Resources[0].Path var method = resolveRatelimit.Resources[0].Method - rlsPolicyCache.DeleteResourceLevelRateLimitPolicies(org, vhost, basePath, path, method) + rlsPolicyCache.DeleteResourceLevelRateLimitPolicies(org, environment, basePath, path, method) } // DeleteCustomRateLimitPolicies delete the ratelimit xds cache From f41db36deee871137a1c0bc136d41517661ba205 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 1 Sep 2023 15:59:03 +0530 Subject: [PATCH 06/24] Updating Router configs for rate limiting --- adapter/internal/oasparser/envoyconf/internal_dtos.go | 5 +++-- adapter/internal/oasparser/envoyconf/routes_configs.go | 4 ++-- adapter/internal/oasparser/envoyconf/routes_with_clusters.go | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/adapter/internal/oasparser/envoyconf/internal_dtos.go b/adapter/internal/oasparser/envoyconf/internal_dtos.go index 1a43584d0..7c8248fb7 100644 --- a/adapter/internal/oasparser/envoyconf/internal_dtos.go +++ b/adapter/internal/oasparser/envoyconf/internal_dtos.go @@ -42,13 +42,14 @@ type routeCreateParams struct { isDefaultVersion bool createDefaultPath bool apiLevelRateLimitPolicy *model.RateLimitPolicy - apiProperties []dpv1alpha1.Property + apiProperties []dpv1alpha1.Property + environment string } // RatelimitCriteria criterias of rate limiting type ratelimitCriteria struct { level string organizationID string - vHost string basePathForRLService string + environment string } diff --git a/adapter/internal/oasparser/envoyconf/routes_configs.go b/adapter/internal/oasparser/envoyconf/routes_configs.go index 3259ff672..ac27af9a8 100644 --- a/adapter/internal/oasparser/envoyconf/routes_configs.go +++ b/adapter/internal/oasparser/envoyconf/routes_configs.go @@ -125,8 +125,8 @@ func generateRateLimitPolicy(ratelimitCriteria *ratelimitCriteria) []*routev3.Ra { ActionSpecifier: &routev3.RateLimit_Action_GenericKey_{ GenericKey: &routev3.RateLimit_Action_GenericKey{ - DescriptorKey: DescriptorKeyForVhost, - DescriptorValue: ratelimitCriteria.vHost, + DescriptorKey: DescriptorKeyForEnvironment, + DescriptorValue: ratelimitCriteria.environment, }, }, }, diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go index 80cce383e..da527f358 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go @@ -77,7 +77,7 @@ type CombinedTemplateValues struct { const ( DescriptorKeyForOrg = "org" OrgMetadataKey = "customorg" - DescriptorKeyForVhost = "vhost" + DescriptorKeyForEnvironment = "environment" DescriptorKeyForPath = "path" DescriptorKeyForMethod = "method" DescriptorValueForAPIMethod = "ALL" @@ -816,8 +816,8 @@ func createRoutes(params *routeCreateParams) (routes []*routev3.Route, err error rateLimitPolicyCriteria = &ratelimitCriteria{ level: rateLimitPolicyLevel, organizationID: params.organizationID, - vHost: vHost, basePathForRLService: basePathForRLService, + environment: params.environment, } } var ( @@ -1528,6 +1528,7 @@ func genRouteCreateParams(swagger *model.AdapterInternalAPI, resource *model.Res apiProperties: swagger.APIProperties, routeConfig: resource.GetEndpoints().Config, createDefaultPath: createDefaultPath, + environment: swagger.GetEnvironment(), } return params } From 0a5c537e25cace5f84a5a5536fa0e514f1167e9d Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 12 Sep 2023 12:13:32 +0530 Subject: [PATCH 07/24] Removing Environment data model --- .../apk/enforcer/commons/model/APIConfig.java | 8 ++-- .../enforcer/commons/model/Environment.java | 37 ------------------- .../enforcer/analytics/AnalyticsFilter.java | 10 ++--- .../analytics/ChoreoAnalyticsProvider.java | 2 +- .../org/wso2/apk/enforcer/api/RestAPI.java | 7 +--- .../enforcer/constants/MetadataConstants.java | 3 +- 6 files changed, 10 insertions(+), 57 deletions(-) delete mode 100644 gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java index 3e617cba1..789b51481 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/APIConfig.java @@ -53,7 +53,7 @@ public class APIConfig { private JWTConfigurationDto jwtConfigurationDto; private boolean systemAPI; private byte[] apiDefinition; - private Environment environment; + private String environment; /** * getApiType returns the API type. This could be one of the following. * HTTP, WS, WEBHOOK @@ -240,7 +240,7 @@ public JWTConfigurationDto getJwtConfigurationDto() { * Returns the environment of the API. * @return String. */ - public Environment getEnvironment() { + public String getEnvironment() { return environment; } @@ -271,7 +271,7 @@ public static class Builder { private boolean systemAPI; private byte[] apiDefinition; private JWTConfigurationDto jwtConfigurationDto; - private Environment environment; + private String environment; public Builder(String name) { this.name = name; } @@ -378,7 +378,7 @@ public Builder apiDefinition(byte[] apiDefinition) { this.apiDefinition = apiDefinition; return this; } - public Builder environment(Environment environment) { + public Builder environment(String environment) { this.environment = environment; return this; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java deleted file mode 100644 index cc4afc4e4..000000000 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/model/Environment.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org). - * - * WSO2 LLC. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.wso2.apk.enforcer.commons.model; - -public class Environment { - - private String name; - private String id; - - public Environment(String name, String id) { - this.name = name; - this.id = id; - } - - public String getName() { - return name; - } - - public String getId() { - return id; - } -} diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java index 13106f227..c4bffeac6 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/AnalyticsFilter.java @@ -202,14 +202,10 @@ public void handleSuccessRequest(RequestContext requestContext) { endUserName == null ? APIConstants.END_USER_UNKNOWN : endUserName); requestContext.addMetadataToMap(MetadataConstants.API_CONTEXT_KEY, requestContext.getMatchedAPI().getBasePath()); - requestContext.addMetadataToMap(MetadataConstants.API_ENVIRONMENT_NAME, - requestContext.getMatchedAPI().getEnvironment().getName() == null + requestContext.addMetadataToMap(MetadataConstants.API_ENVIRONMENT, + requestContext.getMatchedAPI().getEnvironment() == null ? APIConstants.DEFAULT_ENVIRONMENT_NAME - : requestContext.getMatchedAPI().getEnvironment().getName()); - requestContext.addMetadataToMap(MetadataConstants.API_ENVIRONMENT_ID, - requestContext.getMatchedAPI().getEnvironment().getId() == null - ? APIConstants.DEFAULT_ENVIRONMENT_ID - : requestContext.getMatchedAPI().getEnvironment().getId()); + : requestContext.getMatchedAPI().getEnvironment()); } finally { if (Utils.tracingEnabled()) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java index 7d00549f1..657bfe834 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/analytics/ChoreoAnalyticsProvider.java @@ -118,7 +118,7 @@ public API getApi() { api.setApiCreatorTenantDomain(getValueAsString(fieldsMap, MetadataConstants.API_CREATOR_TENANT_DOMAIN_KEY)); api.setOrganizationId(getValueAsString(fieldsMap, MetadataConstants.API_ORGANIZATION_ID)); api.setApiContext(getValueAsString(fieldsMap, MetadataConstants.API_CONTEXT_KEY)); - api.setEnvironmentId(getValueAsString(fieldsMap, MetadataConstants.API_ENVIRONMENT_ID)); + api.setEnvironmentId(getValueAsString(fieldsMap, MetadataConstants.API_ENVIRONMENT)); return api; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java index 3596c9268..aaf33ad06 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/api/RestAPI.java @@ -32,7 +32,6 @@ import org.wso2.apk.enforcer.analytics.AnalyticsFilter; import org.wso2.apk.enforcer.commons.Filter; import org.wso2.apk.enforcer.commons.model.APIConfig; -import org.wso2.apk.enforcer.commons.model.Environment; import org.wso2.apk.enforcer.commons.model.MockedApiConfig; import org.wso2.apk.enforcer.commons.model.MockedContentExamples; import org.wso2.apk.enforcer.commons.model.MockedHeaderConfig; @@ -139,10 +138,6 @@ public String init(Api api) { apiDefinition = api.getApiDefinitionFile().toByteArray(); } - // TODO(Pubudu) Resolve EnvironmentId from the Control Plane. Based on the environment defined - // in the API, relevant environment Id should be retrieved per user. - Environment environment = new Environment(api.getEnvironment(), APIConstants.DEFAULT_ENVIRONMENT_ID); - this.apiLifeCycleState = api.getApiLifeCycleState(); this.apiConfig = new APIConfig.Builder(name).uuid(api.getId()).vhost(vhost).basePath(basePath).version(version) .resources(resources).apiType(apiType).apiLifeCycleState(apiLifeCycleState).tier(api.getTier()) @@ -150,7 +145,7 @@ public String init(Api api) { .disableScopes(api.getDisableScopes()).trustStore(trustStore).organizationId(api.getOrganizationId()) .mtlsCertificateTiers(mtlsCertificateTiers).mutualSSL(mutualSSL).systemAPI(api.getSystemAPI()) .applicationSecurity(applicationSecurity).jwtConfigurationDto(jwtConfigurationDto) - .apiDefinition(apiDefinition).environment(environment).build(); + .apiDefinition(apiDefinition).environment(api.getEnvironment()).build(); initFilters(); return basePath; diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java index 376ec976e..d847bed15 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/MetadataConstants.java @@ -55,7 +55,6 @@ public class MetadataConstants { public static final String ERROR_CODE_KEY = "ErrorCode"; public static final String CHOREO_CONNECT_ENFORCER_REPLY = "apk-enforcer-reply"; public static final String RATELIMIT_WSO2_ORG_PREFIX = "customorg"; - public static final String API_ENVIRONMENT_NAME = WSO2_METADATA_PREFIX + "api-environment-name"; - public static final String API_ENVIRONMENT_ID = WSO2_METADATA_PREFIX + "api-environment-id"; + public static final String API_ENVIRONMENT = WSO2_METADATA_PREFIX + "api-environment"; } From 75de949450c2df60719f01c33695c8cc7a36168d Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 15 Sep 2023 10:27:05 +0530 Subject: [PATCH 08/24] Adding environment field to APK Conf --- .../ballerina/APIClient.bal | 3 +- .../ballerina/modules/model/API.bal | 1 + .../modules/org.wso2.apk.config.model/API.bal | 26 +++++++ .../ballerina/resources/apk-conf-schema.yaml | 4 ++ .../ballerina/tests/APIClientTest.bal | 70 +++++++++++++++++++ .../ballerina/tests/resources/apk-schema.json | 4 ++ .../tests/resources/basicAPI.apk-conf | 15 ++++ .../tests/resources/multiEnv.apk-conf | 17 +++++ .../ballerina/types.bal | 2 + .../config-deployer/conf/apk-schema.json | 4 ++ .../java/org/wso2/apk/config/model/API.java | 9 +++ runtime/runtime-ui/schema/apk-schema.json | 4 ++ 12 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf create mode 100644 runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf diff --git a/runtime/config-deployer-service/ballerina/APIClient.bal b/runtime/config-deployer-service/ballerina/APIClient.bal index 1203e3201..483d6a3a5 100644 --- a/runtime/config-deployer-service/ballerina/APIClient.bal +++ b/runtime/config-deployer-service/ballerina/APIClient.bal @@ -387,7 +387,8 @@ public class APIClient { basePath: self.returnFullBasePath(apkConf.basePath, apkConf.'version), isDefaultVersion: apkConf.defaultVersion, organization: organization.name, - definitionPath: apkConf.definitionPath + definitionPath: apkConf.definitionPath, + environment: apkConf.environment } }; model:ConfigMap? definition = apiArtifact?.definition; diff --git a/runtime/config-deployer-service/ballerina/modules/model/API.bal b/runtime/config-deployer-service/ballerina/modules/model/API.bal index 1e9dd20fa..1f71e6430 100644 --- a/runtime/config-deployer-service/ballerina/modules/model/API.bal +++ b/runtime/config-deployer-service/ballerina/modules/model/API.bal @@ -32,6 +32,7 @@ public type APISpec record {| string organization; boolean isDefaultVersion?; string definitionFileRef?; + string environment?; string definitionPath?; EnvConfig[]|() production = (); EnvConfig[]|() sandbox = (); diff --git a/runtime/config-deployer-service/ballerina/modules/org.wso2.apk.config.model/API.bal b/runtime/config-deployer-service/ballerina/modules/org.wso2.apk.config.model/API.bal index 15e992070..0728ee0eb 100644 --- a/runtime/config-deployer-service/ballerina/modules/org.wso2.apk.config.model/API.bal +++ b/runtime/config-deployer-service/ballerina/modules/org.wso2.apk.config.model/API.bal @@ -63,6 +63,13 @@ public distinct class API { return java:toString(org_wso2_apk_config_model_API_getEndpoint(self.jObj)) ?: ""; } + # The function that maps to the `getEnvironment` method of `org.wso2.apk.config.model.API`. + # + # + return - The `string` value returning from the Java mapping. + public isolated function getEnvironment() returns string { + return java:toString(org_wso2_apk_config_model_API_getEnvironment(self.jObj)) ?: ""; + } + # The function that maps to the `getGraphQLSchema` method of `org.wso2.apk.config.model.API`. # # + return - The `string` value returning from the Java mapping. @@ -162,6 +169,13 @@ public distinct class API { org_wso2_apk_config_model_API_setEndpoint(self.jObj, java:fromString(arg0)); } + # The function that maps to the `setEnvironment` method of `org.wso2.apk.config.model.API`. + # + # + arg0 - The `string` value required to map with the Java method parameter. + public function setEnvironment(string arg0) { + org_wso2_apk_config_model_API_setEnvironment(self.jObj, java:fromString(arg0)); + } + # The function that maps to the `setGraphQLSchema` method of `org.wso2.apk.config.model.API`. # # + arg0 - The `string` value required to map with the Java method parameter. @@ -302,6 +316,12 @@ isolated function org_wso2_apk_config_model_API_getEndpoint(handle receiver) ret paramTypes: [] } external; +isolated function org_wso2_apk_config_model_API_getEnvironment(handle receiver) returns handle = @java:Method { + name: "getEnvironment", + 'class: "org.wso2.apk.config.model.API", + paramTypes: [] +} external; + function org_wso2_apk_config_model_API_getGraphQLSchema(handle receiver) returns handle = @java:Method { name: "getGraphQLSchema", 'class: "org.wso2.apk.config.model.API", @@ -380,6 +400,12 @@ function org_wso2_apk_config_model_API_setEndpoint(handle receiver, handle arg0) paramTypes: ["java.lang.String"] } external; +function org_wso2_apk_config_model_API_setEnvironment(handle receiver, handle arg0) = @java:Method { + name: "setEnvironment", + 'class: "org.wso2.apk.config.model.API", + paramTypes: ["java.lang.String"] +} external; + function org_wso2_apk_config_model_API_setGraphQLSchema(handle receiver, handle arg0) = @java:Method { name: "setGraphQLSchema", 'class: "org.wso2.apk.config.model.API", diff --git a/runtime/config-deployer-service/ballerina/resources/apk-conf-schema.yaml b/runtime/config-deployer-service/ballerina/resources/apk-conf-schema.yaml index dea5ae8eb..74345b156 100644 --- a/runtime/config-deployer-service/ballerina/resources/apk-conf-schema.yaml +++ b/runtime/config-deployer-service/ballerina/resources/apk-conf-schema.yaml @@ -45,6 +45,10 @@ components: type: boolean description: | Is this the default version of the API + environment: + type: string + description: | + Environment of the API endpointConfigurations: $ref: "#/components/schemas/EndpointConfigurations" operations: diff --git a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal index e76b00165..a9f6a6057 100644 --- a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal +++ b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal @@ -573,6 +573,76 @@ public function testAPIKeyAndJWTEnable() returns error? { } } +@test:Config {} +public function testEnvironmentGenerationFromAPKConf() returns error? { + + GenerateK8sResourcesBody body = {}; + body.apkConfiguration = {fileName: "multiEnv.apk-conf", fileContent: check io:fileReadBytes("./tests/resources/multiEnv.apk-conf")}; + body.definitionFile = {fileName: "api.yaml", fileContent: check io:fileReadBytes("./tests/resources/api.yaml")}; + body.apiType = "REST"; + APIClient apiClient = new; + + model:APIArtifact apiArtifact = check apiClient.prepareArtifact(body.apkConfiguration, body.definitionFile, organization); + model:API? api = apiArtifact.api; + + if api is model:API { + model:APISpec apiSpec = api.spec; + + if apiSpec.environment != () { + test:assertEquals(apiSpec.environment, "dev", "Environment of the API is not equal to expected environment"); + } else { + test:assertFail("Environment of the API should not be nil"); + } + + } else { + test:assertFail("API is not equal to expected API Config"); + } + +} + +@test:Config {} +public function testBasicAPIFromAPKConf() returns error? { + + string apiType = "REST"; + GenerateK8sResourcesBody body = {}; + body.apkConfiguration = {fileName: "basicAPI.apk-conf", fileContent: check io:fileReadBytes("./tests/resources/basicAPI.apk-conf")}; + body.definitionFile = {fileName: "api.yaml", fileContent: check io:fileReadBytes("./tests/resources/api.yaml")}; + body.apiType = apiType; + APIClient apiClient = new; + + model:APIArtifact apiArtifact = check apiClient.prepareArtifact(body.apkConfiguration, body.definitionFile, organization); + + model:API? api = apiArtifact.api; + + if api is model:API { + model:APISpec apiSpec = api.spec; + + string? definitionFileRef = apiSpec.definitionFileRef; + if definitionFileRef is string && definitionFileRef == "" { + test:assertFail("Definition file ref is not equal to expected definition file ref"); + } + + test:assertEquals(apiSpec.apiType, apiType, "API type is not equal to expected API type"); + + if apiSpec.isDefaultVersion == () { + test:assertFail("The field isDefaultVersion of the API should not be nil"); + } + test:assertFalse(apiSpec.isDefaultVersion, "The field isDefaultVersion of the API should be false"); + + if apiSpec.systemAPI != () { + test:assertFail("The field systemAPI of the API should be nil"); + } + + if apiSpec.environment != () { + test:assertFail("Environment of the API should be nil"); + } + + } else { + test:assertFail("API is not equal to expected API Config"); + } + +} + public function APIToAPKConfDataProvider() returns map<[runtimeModels:API, APKConf]>|error { runtimeModels:API api = runtimeModels:newAPI1(); api.setName("testAPI"); diff --git a/runtime/config-deployer-service/ballerina/tests/resources/apk-schema.json b/runtime/config-deployer-service/ballerina/tests/resources/apk-schema.json index 84f322ea6..c4128641f 100644 --- a/runtime/config-deployer-service/ballerina/tests/resources/apk-schema.json +++ b/runtime/config-deployer-service/ballerina/tests/resources/apk-schema.json @@ -43,6 +43,10 @@ "type": "boolean", "description": "Is this the default version of the API" }, + "environment": { + "type": "string", + "description": "Environment of the API" + }, "endpointConfigurations": { "$ref": "#/schemas/EndpointConfigurations", "description": "Configuration for different endpoints of the API." diff --git a/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf b/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf new file mode 100644 index 000000000..05a9f3943 --- /dev/null +++ b/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf @@ -0,0 +1,15 @@ +name: api1 +version: 1.0.0 +context: /api1/1.0.0 +type: REST +endpointConfigurations: + production: + endpoint: http://backend.test-apk.svc.cluster.local:80 + sandbox: + endpoint: http://backend.test-apk.svc.cluster.local:80 +operations: +- target: /get + verb: GET + authTypeEnabled: false +- target: /get + verb: POST diff --git a/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf b/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf new file mode 100644 index 000000000..4af1651c5 --- /dev/null +++ b/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf @@ -0,0 +1,17 @@ +name: api1 +version: 1.0.0 +context: /api1/1.0.0 +type: REST +defaultVersion: true +environment: dev +endpointConfigurations: + production: + endpoint: http://backend.test-apk.svc.cluster.local:80 + sandbox: + endpoint: http://backend.test-apk.svc.cluster.local:80 +operations: +- target: /get + verb: GET + authTypeEnabled: false +- target: /get + verb: POST diff --git a/runtime/config-deployer-service/ballerina/types.bal b/runtime/config-deployer-service/ballerina/types.bal index 4eb6dcceb..6699de307 100644 --- a/runtime/config-deployer-service/ballerina/types.bal +++ b/runtime/config-deployer-service/ballerina/types.bal @@ -211,6 +211,8 @@ public type APKConf record { string definitionPath?; # Is this the default version of the API boolean defaultVersion = false; + # Environment of the API + string environment?; EndpointConfigurations endpointConfigurations?; APKOperations[] operations?; APIOperationPolicies apiPolicies?; diff --git a/runtime/config-deployer-service/docker/config-deployer/conf/apk-schema.json b/runtime/config-deployer-service/docker/config-deployer/conf/apk-schema.json index e62515efb..ffedf045c 100644 --- a/runtime/config-deployer-service/docker/config-deployer/conf/apk-schema.json +++ b/runtime/config-deployer-service/docker/config-deployer/conf/apk-schema.json @@ -43,6 +43,10 @@ "type": "boolean", "description": "Is this the default version of the API" }, + "environment": { + "type": "string", + "description": "Environment of the API" + }, "endpointConfigurations": { "$ref": "#/schemas/EndpointConfigurations", "description": "Configuration for different endpoints of the API." diff --git a/runtime/config-deployer-service/java/src/main/java/org/wso2/apk/config/model/API.java b/runtime/config-deployer-service/java/src/main/java/org/wso2/apk/config/model/API.java index b8fc70f0a..e8060a658 100644 --- a/runtime/config-deployer-service/java/src/main/java/org/wso2/apk/config/model/API.java +++ b/runtime/config-deployer-service/java/src/main/java/org/wso2/apk/config/model/API.java @@ -14,6 +14,7 @@ public class API { private String[] scopes; private String graphQLSchema; private String swaggerDefinition; + private String environment; public String getType() { return type; @@ -107,4 +108,12 @@ public void setEndpoint(String endpoint) { this.endpoint = endpoint; } + + public String getEnvironment() { + return environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } } diff --git a/runtime/runtime-ui/schema/apk-schema.json b/runtime/runtime-ui/schema/apk-schema.json index 84f322ea6..c4128641f 100644 --- a/runtime/runtime-ui/schema/apk-schema.json +++ b/runtime/runtime-ui/schema/apk-schema.json @@ -43,6 +43,10 @@ "type": "boolean", "description": "Is this the default version of the API" }, + "environment": { + "type": "string", + "description": "Environment of the API" + }, "endpointConfigurations": { "$ref": "#/schemas/EndpointConfigurations", "description": "Configuration for different endpoints of the API." From 1baf50a5a4c1605bf8ad9aa09a318c99810a4f45 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 15 Sep 2023 10:45:09 +0530 Subject: [PATCH 09/24] Fixing compiler hints on Ballerina --- .../ballerina/ConfigGenreatorClient.bal | 10 ++++------ .../ballerina/tests/APIClientTest.bal | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/runtime/config-deployer-service/ballerina/ConfigGenreatorClient.bal b/runtime/config-deployer-service/ballerina/ConfigGenreatorClient.bal index da7df6fca..b5033d528 100644 --- a/runtime/config-deployer-service/ballerina/ConfigGenreatorClient.bal +++ b/runtime/config-deployer-service/ballerina/ConfigGenreatorClient.bal @@ -124,7 +124,7 @@ public class ConfigGeneratorClient { } return e909044(); } - public isolated function getGeneratedK8sResources(http:Request request,commons:Organization organization) returns http:Response|BadRequestError|InternalServerErrorError|commons:APKError { + public isolated function getGeneratedK8sResources(http:Request request, commons:Organization organization) returns http:Response|BadRequestError|InternalServerErrorError|commons:APKError { GenerateK8sResourcesBody body = {}; do { mime:Entity[] payload = check request.getBodyParts(); @@ -142,7 +142,7 @@ public class ConfigGeneratorClient { } } APIClient apiclient = new (); - model:APIArtifact apiArtifact = check apiclient.prepareArtifact(body.apkConfiguration, body.definitionFile,organization); + model:APIArtifact apiArtifact = check apiclient.prepareArtifact(body.apkConfiguration, body.definitionFile, organization); [string, string] zipName = check self.zipAPIArtifact(apiArtifact.uniqueId, apiArtifact); http:Response response = new; response.setFileAsPayload(zipName[1]); @@ -219,10 +219,8 @@ public class ConfigGeneratorClient { } private isolated function storeFile(string jsonString, string fileName, string? directroy = ()) returns error? { string fullPath = directroy ?: ""; - if jsonString is string { - fullPath = fullPath + file:pathSeparator + fileName + ".yaml"; - _ = check io:fileWriteString(fullPath, jsonString); - } + fullPath = fullPath + file:pathSeparator + fileName + ".yaml"; + _ = check io:fileWriteString(fullPath, jsonString); } private isolated function zipDirectory(string zipfileName, string directoryPath) returns [string, string]|error { diff --git a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal index a9f6a6057..263fca92a 100644 --- a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal +++ b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal @@ -139,7 +139,6 @@ public function testInterceptorConfigGenerationFromAPKConf() returns error? { test:assertEquals(apiArtifact.interceptorServices.length(), 2, "Required Interceptor services not defined"); foreach model:InterceptorService interceptorService in apiArtifact.interceptorServices { - test:assertTrue(interceptorService is model:InterceptorService); string interceptorName = interceptorService.metadata.name; model:InterceptorReference interceptorReference = {name: interceptorName}; if (interceptorName.startsWith("request-interceptor")) { From 44f68f61d32d068b698fc03f789434c353a400b7 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 19 Sep 2023 14:20:36 +0530 Subject: [PATCH 10/24] Adding integration tests for multi environment feature --- .../ballerina/APIClient.bal | 8 +++- .../ballerina/tests/APIClientTest.bal | 11 +++++- .../multi-env/employees_conf_dev.yaml | 28 ++++++++++++++ .../multi-env/employees_conf_qa.yaml | 28 ++++++++++++++ .../tests/api/MultiEnvironment.feature | 37 +++++++++++++++++++ 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml create mode 100644 test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml create mode 100644 test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature diff --git a/runtime/config-deployer-service/ballerina/APIClient.bal b/runtime/config-deployer-service/ballerina/APIClient.bal index 483d6a3a5..995737006 100644 --- a/runtime/config-deployer-service/ballerina/APIClient.bal +++ b/runtime/config-deployer-service/ballerina/APIClient.bal @@ -164,10 +164,16 @@ public class APIClient { //todo: need to implement vhost feature Vhost[] globalVhosts = vhosts; string[] hosts = []; + string environment = apkConf.environment ?: ""; + string orgAndEnv = organization.name; + if environment != "" { + orgAndEnv = string:concat(orgAndEnv, "-", environment); + } + foreach Vhost vhost in globalVhosts { if vhost.'type == endpointType { foreach string host in vhost.hosts { - hosts.push(string:concat(organization.name, ".", host)); + hosts.push(string:concat(orgAndEnv, ".", host)); } } } diff --git a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal index 263fca92a..b1857323d 100644 --- a/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal +++ b/runtime/config-deployer-service/ballerina/tests/APIClientTest.bal @@ -597,6 +597,11 @@ public function testEnvironmentGenerationFromAPKConf() returns error? { test:assertFail("API is not equal to expected API Config"); } + model:Httproute[] productionRoutes = apiArtifact.productionRoute; + foreach var route in productionRoutes { + test:assertEquals(route.spec.hostnames, ["default-dev.gw.wso2.com"], "Production endpoint vhost mismatch"); + } + } @test:Config {} @@ -610,7 +615,6 @@ public function testBasicAPIFromAPKConf() returns error? { APIClient apiClient = new; model:APIArtifact apiArtifact = check apiClient.prepareArtifact(body.apkConfiguration, body.definitionFile, organization); - model:API? api = apiArtifact.api; if api is model:API { @@ -640,6 +644,11 @@ public function testBasicAPIFromAPKConf() returns error? { test:assertFail("API is not equal to expected API Config"); } + model:Httproute[] productionRoutes = apiArtifact.productionRoute; + foreach var route in productionRoutes { + test:assertEquals(route.spec.hostnames, ["default.gw.wso2.com"], "Production endpoint vhost mismatch"); + } + } public function APIToAPKConfDataProvider() returns map<[runtimeModels:API, APKConf]>|error { diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml new file mode 100644 index 000000000..ac7c2340f --- /dev/null +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml @@ -0,0 +1,28 @@ +--- +name: "EmployeeServiceAPIDev" +context: "/multienv" +version: "3.14" +id: "multi-env-dev-api" +type: "REST" +defaultVersion: false +environment: "dev" +endpointConfigurations: + production: + endpoint: "http://backend:80/anything" +operations: + - target: "/employee" + verb: "GET" + authTypeEnabled: true + scopes: [] + - target: "/employee" + verb: "POST" + authTypeEnabled: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "PUT" + authTypeEnabled: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "DELETE" + authTypeEnabled: true + scopes: [] diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml new file mode 100644 index 000000000..a6863b156 --- /dev/null +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml @@ -0,0 +1,28 @@ +--- +name: "EmployeeServiceAPIQA" +context: "/multienv" +version: "3.14" +id: "multi-env-qa-api" +type: "REST" +defaultVersion: false +environment: "qa" +endpointConfigurations: + production: + endpoint: "http://backend:80/anything" +operations: + - target: "/employee" + verb: "GET" + authTypeEnabled: true + scopes: [] + - target: "/employee" + verb: "POST" + authTypeEnabled: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "PUT" + authTypeEnabled: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "DELETE" + authTypeEnabled: true + scopes: [] diff --git a/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature new file mode 100644 index 000000000..614178a4d --- /dev/null +++ b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature @@ -0,0 +1,37 @@ +Feature: Deploy APIs in multiple environments + Scenario: Deploying an API in Dev Environment for Organization, test123 + Given The system is ready + And I have a valid subscription + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_dev.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${accessToken}| + And I send "GET" request to "https://default-dev.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |429| + + Scenario: Deploying the same API in QA Environment for Organization, test123 + Given The system is ready + And I have a valid subscription + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_qa.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${accessToken}| + And I send "GET" request to "https://default-qa.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |429| + + Scenario Outline: Undeploy API + Given The system is ready + And I have a valid subscription + When I undeploy the API whose ID is "" + Then the response status code should be + + Examples: + | apiID | expectedStatusCode | + | multi-env-dev-api | 202 | + | multi-env-qa-api | 202 | From 6693597a25f1b22540a25e300c79b815218e2019 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 26 Sep 2023 12:01:17 +0530 Subject: [PATCH 11/24] Changing to new schemas --- .../envoyconf/routes_with_clusters_test.go | 38 +++++++++---------- .../tests/resources/basicAPI.apk-conf | 4 +- .../tests/resources/multiEnv.apk-conf | 4 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go index 842c09b9d..c59dc4b33 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go @@ -40,9 +40,9 @@ func TestCreateRoutesWithClustersWithExactAndRegularExpressionRules(t *testing.T Name: "test-api-2", }, Spec: v1alpha1.APISpec{ - APIName: "test-api-2", - APIVersion: "2.0.0", - BasePath: "/test-api/2.0.0", + APIName: "test-api-2", + APIVersion: "2.0.0", + BasePath: "/test-api/2.0.0", Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ @@ -179,7 +179,7 @@ func TestGenerateAdapterInternalAPIForSpecificEnvironment(t *testing.T) { assert.Equal(t, "dev", adapterInternalAPI.GetEnvironment(), "Environment is incorrect.") } -func generateSampleAPI(apiName string, apiVersion string, apiContext string) synchronizer.APIState { +func generateSampleAPI(apiName string, apiVersion string, basePath string) synchronizer.APIState { apiState := synchronizer.APIState{} apiDefinition := v1alpha1.API{ @@ -188,9 +188,9 @@ func generateSampleAPI(apiName string, apiVersion string, apiContext string) syn Name: apiName, }, Spec: v1alpha1.APISpec{ - APIDisplayName: apiName, - APIVersion: apiVersion, - Context: apiContext, + APIName: apiName, + APIVersion: apiVersion, + BasePath: basePath, Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ @@ -251,9 +251,9 @@ func TestCreateRoutesWithClustersWithMultiplePathPrefixRules(t *testing.T) { Name: "test-api-1", }, Spec: v1alpha1.APISpec{ - APIName: "test-api", - APIVersion: "1.0.0", - BasePath: "/test-api/1.0.0", + APIName: "test-api", + APIVersion: "1.0.0", + BasePath: "/test-api/1.0.0", Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ @@ -398,9 +398,9 @@ func TestCreateRoutesWithClustersWithBackendTLSConfigs(t *testing.T) { Name: "test-api-3", }, Spec: v1alpha1.APISpec{ - APIName: "test-api-3", - APIVersion: "1.0.0", - BasePath: "/test-api-3/1.0.0", + APIName: "test-api-3", + APIVersion: "1.0.0", + BasePath: "/test-api-3/1.0.0", Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ @@ -704,9 +704,9 @@ func TestCreateRoutesWithClustersDifferentBackendRefs(t *testing.T) { Name: "test-api-different-backendrefs", }, Spec: v1alpha1.APISpec{ - APIName: "test-api-different-backendrefs", - APIVersion: "1.0.0", - BasePath: "/test-api-different-backendrefs/1.0.0", + APIName: "test-api-different-backendrefs", + APIVersion: "1.0.0", + BasePath: "/test-api-different-backendrefs/1.0.0", Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ @@ -794,9 +794,9 @@ func TestCreateRoutesWithClustersSameBackendRefs(t *testing.T) { Name: "test-api-same-backendrefs", }, Spec: v1alpha1.APISpec{ - APIName: "test-api-same-backendrefs", - APIVersion: "1.0.0", - BasePath: "/test-api-same-backendrefs/1.0.0", + APIName: "test-api-same-backendrefs", + APIVersion: "1.0.0", + BasePath: "/test-api-same-backendrefs/1.0.0", Production: []v1alpha1.EnvConfig{ { HTTPRouteRefs: []string{ diff --git a/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf b/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf index 05a9f3943..f6f67c635 100644 --- a/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf +++ b/runtime/config-deployer-service/ballerina/tests/resources/basicAPI.apk-conf @@ -1,6 +1,6 @@ name: api1 version: 1.0.0 -context: /api1/1.0.0 +basePath: /api1/1.0.0 type: REST endpointConfigurations: production: @@ -10,6 +10,6 @@ endpointConfigurations: operations: - target: /get verb: GET - authTypeEnabled: false + secured: false - target: /get verb: POST diff --git a/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf b/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf index 4af1651c5..76e27b9b3 100644 --- a/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf +++ b/runtime/config-deployer-service/ballerina/tests/resources/multiEnv.apk-conf @@ -1,6 +1,6 @@ name: api1 version: 1.0.0 -context: /api1/1.0.0 +basePath: /api1/1.0.0 type: REST defaultVersion: true environment: dev @@ -12,6 +12,6 @@ endpointConfigurations: operations: - target: /get verb: GET - authTypeEnabled: false + secured: false - target: /get verb: POST From 8aab9125854b318e32393af080997260d9e80114 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Wed, 27 Sep 2023 11:49:55 +0530 Subject: [PATCH 12/24] Fixing multi-env test cases --- .../apk-confs/multi-env/employees_conf_dev.yaml | 10 +++++----- .../apk-confs/multi-env/employees_conf_qa.yaml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml index ac7c2340f..be7d92970 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_dev.yaml @@ -1,6 +1,6 @@ --- name: "EmployeeServiceAPIDev" -context: "/multienv" +basePath: "/multienv" version: "3.14" id: "multi-env-dev-api" type: "REST" @@ -12,17 +12,17 @@ endpointConfigurations: operations: - target: "/employee" verb: "GET" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee" verb: "POST" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee/{employeeId}" verb: "PUT" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee/{employeeId}" verb: "DELETE" - authTypeEnabled: true + secured: true scopes: [] diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml index a6863b156..7d6c9512a 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf_qa.yaml @@ -1,6 +1,6 @@ --- name: "EmployeeServiceAPIQA" -context: "/multienv" +basePath: "/multienv" version: "3.14" id: "multi-env-qa-api" type: "REST" @@ -12,17 +12,17 @@ endpointConfigurations: operations: - target: "/employee" verb: "GET" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee" verb: "POST" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee/{employeeId}" verb: "PUT" - authTypeEnabled: true + secured: true scopes: [] - target: "/employee/{employeeId}" verb: "DELETE" - authTypeEnabled: true + secured: true scopes: [] From e45256a76f7a31f3c9df15b0bb84e82eddacfd76 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Wed, 27 Sep 2023 16:21:35 +0530 Subject: [PATCH 13/24] Adding missing vhosts --- test/cucumber-tests/scripts/setup-hosts.sh | 2 ++ .../src/test/java/org/wso2/apk/integration/api/BaseSteps.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test/cucumber-tests/scripts/setup-hosts.sh b/test/cucumber-tests/scripts/setup-hosts.sh index 8eb4dc657..b57d5703a 100644 --- a/test/cucumber-tests/scripts/setup-hosts.sh +++ b/test/cucumber-tests/scripts/setup-hosts.sh @@ -15,5 +15,7 @@ sudo echo "$IP default.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org1.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org2.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP default-qa.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP default-dev.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "255.255.255.255 broadcasthost" | sudo tee -a /etc/hosts sudo echo "::1 localhost" | sudo tee -a /etc/hosts diff --git a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java index c19592166..6d7e446b5 100644 --- a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java +++ b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java @@ -229,7 +229,7 @@ public void waitForNextMinuteStrictly() throws InterruptedException { LocalDateTime now = LocalDateTime.now(); LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - Thread.sleep((secondsToWait+1) * 1000); + Thread.sleep((secondsToWait+2) * 1000); logger.info("Current time: " + LocalDateTime.now()); } From cac99a0e3d581f35402a32fd21c0f0423a73a8d0 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 3 Oct 2023 17:59:39 +0530 Subject: [PATCH 14/24] Adding environment field for TokenIssuer --- .../discovery/subscription/jwtIssuer.proto | 1 + .../apis/dp/v1alpha1/resolvedJWTIssuer.go | 1 + .../apis/dp/v1alpha1/tokenIssuer_types.go | 6 + .../apis/dp/v1alpha1/zz_generated.deepcopy.go | 10 + .../crd/bases/dp.wso2.com_tokenissuers.yaml | 7 + .../controllers/dp/tokenissuer_controller.go | 16 ++ .../discovery/subscription/jwtIssuer.pb.go | 60 +++--- .../apk/enforcer/constants/Constants.java | 4 + .../discovery/subscription/JWTIssuer.java | 192 ++++++++++++++++++ .../subscription/JWTIssuerOrBuilder.java | 25 +++ .../subscription/JWTIssuerProto.java | 23 ++- .../security/jwt/JWTAuthenticator.java | 8 +- .../subscription/SubscriptionDataStore.java | 3 +- .../SubscriptionDataStoreImpl.java | 77 +++++-- .../org/wso2/apk/enforcer/util/JWTUtils.java | 4 +- .../crds/dp.wso2.com_tokenissuers.yaml | 11 +- 16 files changed, 387 insertions(+), 61 deletions(-) diff --git a/adapter/api/proto/wso2/discovery/subscription/jwtIssuer.proto b/adapter/api/proto/wso2/discovery/subscription/jwtIssuer.proto index bdaf1c71a..4b8a8f79e 100644 --- a/adapter/api/proto/wso2/discovery/subscription/jwtIssuer.proto +++ b/adapter/api/proto/wso2/discovery/subscription/jwtIssuer.proto @@ -35,6 +35,7 @@ message JWTIssuer { string consumerKeyClaim = 6; string scopesClaim = 7; map claimMapping = 8; + repeated string environments = 9; } message Certificate { string certificate = 1; diff --git a/adapter/internal/operator/apis/dp/v1alpha1/resolvedJWTIssuer.go b/adapter/internal/operator/apis/dp/v1alpha1/resolvedJWTIssuer.go index 1271b0c01..ed387cf44 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/resolvedJWTIssuer.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/resolvedJWTIssuer.go @@ -31,6 +31,7 @@ type ResolvedJWTIssuer struct { ScopesClaim string SignatureValidation ResolvedSignatureValidation ClaimMappings map[string]string + Environments []string } // ResolvedSignatureValidation holds the resolved properties of SignatureValidation diff --git a/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go b/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go index 9c20f4919..1aeeb7959 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go @@ -62,6 +62,12 @@ type TokenIssuerSpec struct { // TargetRef denotes the reference to the which gateway it applies to TargetRef *gwapiv1b1.PolicyTargetReference `json:"targetRef,omitempty"` + + // Environments denotes the environments that are applicable for the token issuer. + // + // +optional + // +nullable + Environments []string `json:"environments,omitempty"` } // ClaimMapping defines the reference configuration diff --git a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go index 4f8965be4..154577d6a 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go @@ -1319,6 +1319,11 @@ func (in *ResolvedJWTIssuer) DeepCopyInto(out *ResolvedJWTIssuer) { (*out)[key] = val } } + if in.Environments != nil { + in, out := &in.Environments, &out.Environments + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResolvedJWTIssuer. @@ -1727,6 +1732,11 @@ func (in *TokenIssuerSpec) DeepCopyInto(out *TokenIssuerSpec) { *out = new(v1alpha2.PolicyTargetReference) (*in).DeepCopyInto(*out) } + if in.Environments != nil { + in, out := &in.Environments, &out.Environments + *out = make([]string, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuerSpec. diff --git a/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml b/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml index f87896ddd..325ff1a2a 100644 --- a/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml +++ b/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml @@ -56,6 +56,13 @@ spec: key. minLength: 1 type: string + environments: + description: Environments denotes the environments that are applicable + for the token issuer. + items: + type: string + nullable: true + type: array issuer: description: Issuer denotes the issuer of the Token Issuer. minLength: 1 diff --git a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go index c717ebf19..1a4ba09f7 100644 --- a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go +++ b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go @@ -45,6 +45,7 @@ const ( tokenIssuerIndex = "tokenIssuerIndex" secretTokenIssuerIndex = "secretTokenIssuerIndex" configmapIssuerIndex = "configmapIssuerIndex" + defaultAllEnvironments = "*" ) // TokenssuerReconciler reconciles a TokenIssuer object @@ -192,6 +193,7 @@ func marshalJWTIssuerList(jwtIssuerMapping dpv1alpha1.JWTIssuerMapping) *subscri } jwtIssuer.ClaimMapping = internalJWTIssuer.ClaimMappings jwtIssuer.Certificate = certificate + jwtIssuer.Environments = internalJWTIssuer.Environments jwtIssuers = append(jwtIssuers, jwtIssuer) } @@ -213,6 +215,8 @@ func getJWTIssuers(ctx context.Context, client k8client.Client, namespace types. resolvedJwtIssuer.ConsumerKeyClaim = jwtIssuer.Spec.ConsumerKeyClaim resolvedJwtIssuer.ScopesClaim = jwtIssuer.Spec.ScopesClaim resolvedJwtIssuer.Organization = jwtIssuer.Spec.Organization + resolvedJwtIssuer.Environments = getTokenIssuerEnvironments(jwtIssuer.Spec.Environments) + signatureValidation := dpv1alpha1.ResolvedSignatureValidation{} if jwtIssuer.Spec.SignatureValidation.JWKS != nil && len(jwtIssuer.Spec.SignatureValidation.JWKS.URL) > 0 { jwks := &dpv1alpha1.ResolvedJWKS{} @@ -256,3 +260,15 @@ func getResolvedClaimMapping(claimMappings []dpv1alpha1.ClaimMapping) map[string } return resolvedClaimMappings } + +func getTokenIssuerEnvironments(environments []string) []string { + + resolvedEnvirenvironments := []string{} + if len(environments) == 0 { + resolvedEnvirenvironments = append(resolvedEnvirenvironments, defaultAllEnvironments) + } else { + resolvedEnvirenvironments = environments + } + + return resolvedEnvirenvironments +} diff --git a/adapter/pkg/discovery/api/wso2/discovery/subscription/jwtIssuer.pb.go b/adapter/pkg/discovery/api/wso2/discovery/subscription/jwtIssuer.pb.go index 4e097261d..5b28d8c8d 100644 --- a/adapter/pkg/discovery/api/wso2/discovery/subscription/jwtIssuer.pb.go +++ b/adapter/pkg/discovery/api/wso2/discovery/subscription/jwtIssuer.pb.go @@ -50,6 +50,7 @@ type JWTIssuer struct { ConsumerKeyClaim string `protobuf:"bytes,6,opt,name=consumerKeyClaim,proto3" json:"consumerKeyClaim,omitempty"` ScopesClaim string `protobuf:"bytes,7,opt,name=scopesClaim,proto3" json:"scopesClaim,omitempty"` ClaimMapping map[string]string `protobuf:"bytes,8,rep,name=claimMapping,proto3" json:"claimMapping,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + Environments []string `protobuf:"bytes,9,rep,name=environments,proto3" json:"environments,omitempty"` } func (x *JWTIssuer) Reset() { @@ -140,6 +141,13 @@ func (x *JWTIssuer) GetClaimMapping() map[string]string { return nil } +func (x *JWTIssuer) GetEnvironments() []string { + if x != nil { + return x.Environments + } + return nil +} + type Certificate struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -257,7 +265,7 @@ var file_wso2_discovery_subscription_jwtIssuer_proto_rawDesc = []byte{ 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x6a, 0x77, 0x74, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xae, 0x03, 0x0a, 0x09, 0x4a, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd2, 0x03, 0x0a, 0x09, 0x4a, 0x57, 0x54, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, @@ -280,30 +288,32 @@ var file_wso2_discovery_subscription_jwtIssuer_proto_rawDesc = []byte{ 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x57, 0x54, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0c, 0x63, 0x6c, - 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x1a, 0x3f, 0x0a, 0x11, 0x43, 0x6c, - 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x66, 0x0a, 0x0b, 0x43, - 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x65, - 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x04, - 0x6a, 0x77, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x77, 0x73, 0x6f, - 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x57, 0x4b, 0x53, 0x52, 0x04, 0x6a, - 0x77, 0x6b, 0x73, 0x22, 0x2a, 0x0a, 0x04, 0x4a, 0x57, 0x4b, 0x53, 0x12, 0x10, 0x0a, 0x03, 0x75, - 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, 0x6c, 0x12, 0x10, 0x0a, - 0x03, 0x74, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x42, - 0x91, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x61, 0x70, 0x6b, - 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x42, 0x0e, 0x4a, 0x57, 0x54, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, 0x2d, 0x63, 0x6f, 0x6e, - 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, 0x73, 0x6f, 0x32, 0x2f, - 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, - 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x22, 0x0a, 0x0c, 0x65, 0x6e, + 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x0c, 0x65, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x1a, 0x3f, + 0x0a, 0x11, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x45, 0x6e, + 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, + 0x66, 0x0a, 0x0b, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x12, 0x20, + 0x0a, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x65, + 0x12, 0x35, 0x0a, 0x04, 0x6a, 0x77, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, + 0x2e, 0x77, 0x73, 0x6f, 0x32, 0x2e, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, + 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x57, 0x4b, + 0x53, 0x52, 0x04, 0x6a, 0x77, 0x6b, 0x73, 0x22, 0x2a, 0x0a, 0x04, 0x4a, 0x57, 0x4b, 0x53, 0x12, + 0x10, 0x0a, 0x03, 0x75, 0x72, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x72, + 0x6c, 0x12, 0x10, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x74, 0x6c, 0x73, 0x42, 0x91, 0x01, 0x0a, 0x2c, 0x6f, 0x72, 0x67, 0x2e, 0x77, 0x73, 0x6f, 0x32, + 0x2e, 0x61, 0x70, 0x6b, 0x2e, 0x65, 0x6e, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x72, 0x2e, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0e, 0x4a, 0x57, 0x54, 0x49, 0x73, 0x73, 0x75, 0x65, 0x72, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x65, 0x6e, 0x76, 0x6f, 0x79, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2f, 0x67, 0x6f, + 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2d, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x77, + 0x73, 0x6f, 0x32, 0x2f, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x2f, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java index 26d0ba0af..14a6f0f1c 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java @@ -76,4 +76,8 @@ since new lines in different OSs differ (Linux: \n, Windows: \r\n) */ public static final String PROP_CON_FACTORY = "connectionfactory.TopicConnectionFactory"; public static final String DEFAULT_DESTINATION_TYPE = "Topic"; public static final String DEFAULT_CON_FACTORY_JNDI_NAME = "TopicConnectionFactory"; + + // multi-env constants + public static final String DEFAULT_ENVIRONMENT_TOKEN_ISSUER = "*"; + public static final String DEFAULT_ENVIRONMENT = "Default"; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuer.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuer.java index 7ed78a54c..d36ddcc76 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuer.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuer.java @@ -26,6 +26,7 @@ private JWTIssuer() { issuer_ = ""; consumerKeyClaim_ = ""; scopesClaim_ = ""; + environments_ = com.google.protobuf.LazyStringArrayList.EMPTY; } @java.lang.Override @@ -121,6 +122,15 @@ private JWTIssuer( claimMapping__.getKey(), claimMapping__.getValue()); break; } + case 74: { + java.lang.String s = input.readStringRequireUtf8(); + if (!((mutable_bitField0_ & 0x00000002) != 0)) { + environments_ = new com.google.protobuf.LazyStringArrayList(); + mutable_bitField0_ |= 0x00000002; + } + environments_.add(s); + break; + } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { @@ -136,6 +146,9 @@ private JWTIssuer( throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { + if (((mutable_bitField0_ & 0x00000002) != 0)) { + environments_ = environments_.getUnmodifiableView(); + } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } @@ -500,6 +513,41 @@ public java.lang.String getClaimMappingOrThrow( return map.get(key); } + public static final int ENVIRONMENTS_FIELD_NUMBER = 9; + private com.google.protobuf.LazyStringList environments_; + /** + * repeated string environments = 9; + * @return A list containing the environments. + */ + public com.google.protobuf.ProtocolStringList + getEnvironmentsList() { + return environments_; + } + /** + * repeated string environments = 9; + * @return The count of environments. + */ + public int getEnvironmentsCount() { + return environments_.size(); + } + /** + * repeated string environments = 9; + * @param index The index of the element to return. + * @return The environments at the given index. + */ + public java.lang.String getEnvironments(int index) { + return environments_.get(index); + } + /** + * repeated string environments = 9; + * @param index The index of the value to return. + * @return The bytes of the environments at the given index. + */ + public com.google.protobuf.ByteString + getEnvironmentsBytes(int index) { + return environments_.getByteString(index); + } + private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { @@ -541,6 +589,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) internalGetClaimMapping(), ClaimMappingDefaultEntryHolder.defaultEntry, 8); + for (int i = 0; i < environments_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 9, environments_.getRaw(i)); + } unknownFields.writeTo(output); } @@ -582,6 +633,14 @@ public int getSerializedSize() { size += com.google.protobuf.CodedOutputStream .computeMessageSize(8, claimMapping__); } + { + int dataSize = 0; + for (int i = 0; i < environments_.size(); i++) { + dataSize += computeStringSizeNoTag(environments_.getRaw(i)); + } + size += dataSize; + size += 1 * getEnvironmentsList().size(); + } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; @@ -616,6 +675,8 @@ public boolean equals(final java.lang.Object obj) { .equals(other.getScopesClaim())) return false; if (!internalGetClaimMapping().equals( other.internalGetClaimMapping())) return false; + if (!getEnvironmentsList() + .equals(other.getEnvironmentsList())) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @@ -647,6 +708,10 @@ public int hashCode() { hash = (37 * hash) + CLAIMMAPPING_FIELD_NUMBER; hash = (53 * hash) + internalGetClaimMapping().hashCode(); } + if (getEnvironmentsCount() > 0) { + hash = (37 * hash) + ENVIRONMENTS_FIELD_NUMBER; + hash = (53 * hash) + getEnvironmentsList().hashCode(); + } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; @@ -825,6 +890,8 @@ public Builder clear() { scopesClaim_ = ""; internalGetMutableClaimMapping().clear(); + environments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); return this; } @@ -865,6 +932,11 @@ public org.wso2.apk.enforcer.discovery.subscription.JWTIssuer buildPartial() { result.scopesClaim_ = scopesClaim_; result.claimMapping_ = internalGetClaimMapping(); result.claimMapping_.makeImmutable(); + if (((bitField0_ & 0x00000002) != 0)) { + environments_ = environments_.getUnmodifiableView(); + bitField0_ = (bitField0_ & ~0x00000002); + } + result.environments_ = environments_; onBuilt(); return result; } @@ -942,6 +1014,16 @@ public Builder mergeFrom(org.wso2.apk.enforcer.discovery.subscription.JWTIssuer } internalGetMutableClaimMapping().mergeFrom( other.internalGetClaimMapping()); + if (!other.environments_.isEmpty()) { + if (environments_.isEmpty()) { + environments_ = other.environments_; + bitField0_ = (bitField0_ & ~0x00000002); + } else { + ensureEnvironmentsIsMutable(); + environments_.addAll(other.environments_); + } + onChanged(); + } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; @@ -1674,6 +1756,116 @@ public Builder putAllClaimMapping( .putAll(values); return this; } + + private com.google.protobuf.LazyStringList environments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + private void ensureEnvironmentsIsMutable() { + if (!((bitField0_ & 0x00000002) != 0)) { + environments_ = new com.google.protobuf.LazyStringArrayList(environments_); + bitField0_ |= 0x00000002; + } + } + /** + * repeated string environments = 9; + * @return A list containing the environments. + */ + public com.google.protobuf.ProtocolStringList + getEnvironmentsList() { + return environments_.getUnmodifiableView(); + } + /** + * repeated string environments = 9; + * @return The count of environments. + */ + public int getEnvironmentsCount() { + return environments_.size(); + } + /** + * repeated string environments = 9; + * @param index The index of the element to return. + * @return The environments at the given index. + */ + public java.lang.String getEnvironments(int index) { + return environments_.get(index); + } + /** + * repeated string environments = 9; + * @param index The index of the value to return. + * @return The bytes of the environments at the given index. + */ + public com.google.protobuf.ByteString + getEnvironmentsBytes(int index) { + return environments_.getByteString(index); + } + /** + * repeated string environments = 9; + * @param index The index to set the value at. + * @param value The environments to set. + * @return This builder for chaining. + */ + public Builder setEnvironments( + int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureEnvironmentsIsMutable(); + environments_.set(index, value); + onChanged(); + return this; + } + /** + * repeated string environments = 9; + * @param value The environments to add. + * @return This builder for chaining. + */ + public Builder addEnvironments( + java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureEnvironmentsIsMutable(); + environments_.add(value); + onChanged(); + return this; + } + /** + * repeated string environments = 9; + * @param values The environments to add. + * @return This builder for chaining. + */ + public Builder addAllEnvironments( + java.lang.Iterable values) { + ensureEnvironmentsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, environments_); + onChanged(); + return this; + } + /** + * repeated string environments = 9; + * @return This builder for chaining. + */ + public Builder clearEnvironments() { + environments_ = com.google.protobuf.LazyStringArrayList.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * repeated string environments = 9; + * @param value The bytes of the environments to add. + * @return This builder for chaining. + */ + public Builder addEnvironmentsBytes( + com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureEnvironmentsIsMutable(); + environments_.add(value); + onChanged(); + return this; + } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerOrBuilder.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerOrBuilder.java index 84618a8ee..421995fec 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerOrBuilder.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerOrBuilder.java @@ -127,4 +127,29 @@ java.lang.String getClaimMappingOrDefault( java.lang.String getClaimMappingOrThrow( java.lang.String key); + + /** + * repeated string environments = 9; + * @return A list containing the environments. + */ + java.util.List + getEnvironmentsList(); + /** + * repeated string environments = 9; + * @return The count of environments. + */ + int getEnvironmentsCount(); + /** + * repeated string environments = 9; + * @param index The index of the element to return. + * @return The environments at the given index. + */ + java.lang.String getEnvironments(int index); + /** + * repeated string environments = 9; + * @param index The index of the value to return. + * @return The bytes of the environments at the given index. + */ + com.google.protobuf.ByteString + getEnvironmentsBytes(int index); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerProto.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerProto.java index 52b7e4bfc..705c0d9bc 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerProto.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/discovery/subscription/JWTIssuerProto.java @@ -44,22 +44,23 @@ public static void registerAllExtensions( static { java.lang.String[] descriptorData = { "\n+wso2/discovery/subscription/jwtIssuer." + - "proto\022\033wso2.discovery.subscription\"\303\002\n\tJ" + + "proto\022\033wso2.discovery.subscription\"\331\002\n\tJ" + "WTIssuer\022\017\n\007eventId\030\001 \001(\t\022\014\n\004name\030\002 \001(\t\022" + "\024\n\014organization\030\003 \001(\t\022\016\n\006issuer\030\004 \001(\t\022=\n" + "\013certificate\030\005 \001(\0132(.wso2.discovery.subs" + "cription.Certificate\022\030\n\020consumerKeyClaim" + "\030\006 \001(\t\022\023\n\013scopesClaim\030\007 \001(\t\022N\n\014claimMapp" + "ing\030\010 \003(\01328.wso2.discovery.subscription." + - "JWTIssuer.ClaimMappingEntry\0323\n\021ClaimMapp" + - "ingEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t:\0028\001" + - "\"S\n\013Certificate\022\023\n\013certificate\030\001 \001(\t\022/\n\004" + - "jwks\030\002 \001(\0132!.wso2.discovery.subscription" + - ".JWKS\" \n\004JWKS\022\013\n\003url\030\001 \001(\t\022\013\n\003tls\030\002 \001(\tB" + - "\221\001\n,org.wso2.apk.enforcer.discovery.subs" + - "criptionB\016JWTIssuerProtoP\001ZOgithub.com/e" + - "nvoyproxy/go-control-plane/wso2/discover" + - "y/subscription;subscriptionb\006proto3" + "JWTIssuer.ClaimMappingEntry\022\024\n\014environme" + + "nts\030\t \003(\t\0323\n\021ClaimMappingEntry\022\013\n\003key\030\001 " + + "\001(\t\022\r\n\005value\030\002 \001(\t:\0028\001\"S\n\013Certificate\022\023\n" + + "\013certificate\030\001 \001(\t\022/\n\004jwks\030\002 \001(\0132!.wso2." + + "discovery.subscription.JWKS\" \n\004JWKS\022\013\n\003u" + + "rl\030\001 \001(\t\022\013\n\003tls\030\002 \001(\tB\221\001\n,org.wso2.apk.e" + + "nforcer.discovery.subscriptionB\016JWTIssue" + + "rProtoP\001ZOgithub.com/envoyproxy/go-contr" + + "ol-plane/wso2/discovery/subscription;sub" + + "scriptionb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, @@ -70,7 +71,7 @@ public static void registerAllExtensions( internal_static_wso2_discovery_subscription_JWTIssuer_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_wso2_discovery_subscription_JWTIssuer_descriptor, - new java.lang.String[] { "EventId", "Name", "Organization", "Issuer", "Certificate", "ConsumerKeyClaim", "ScopesClaim", "ClaimMapping", }); + new java.lang.String[] { "EventId", "Name", "Organization", "Issuer", "Certificate", "ConsumerKeyClaim", "ScopesClaim", "ClaimMapping", "Environments", }); internal_static_wso2_discovery_subscription_JWTIssuer_ClaimMappingEntry_descriptor = internal_static_wso2_discovery_subscription_JWTIssuer_descriptor.getNestedTypes().get(0); internal_static_wso2_discovery_subscription_JWTIssuer_ClaimMappingEntry_fieldAccessorTable = new diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java index 5411cde9c..4954995fe 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/jwt/JWTAuthenticator.java @@ -134,6 +134,7 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws String envType = requestContext.getMatchedAPI().getEnvType(); String version = requestContext.getMatchedAPI().getVersion(); String organization = requestContext.getMatchedAPI().getOrganizationId(); + String environment = requestContext.getMatchedAPI().getEnvironment(); context = context + "/" + version; SignedJWTInfo signedJWTInfo; Scope decodeTokenHeaderSpanScope = null; @@ -171,7 +172,7 @@ public AuthenticationContext authenticate(RequestContext requestContext) throws } } - JWTValidationInfo validationInfo = getJwtValidationInfo(signedJWTInfo, jwtTokenIdentifier, organization); + JWTValidationInfo validationInfo = getJwtValidationInfo(signedJWTInfo, jwtTokenIdentifier, organization, environment); if (validationInfo != null) { if (validationInfo.isValid()) { // Validate token type @@ -496,7 +497,8 @@ private JSONObject validateSubscriptionFromClaim(String name, String version, JW return api; } - private JWTValidationInfo getJwtValidationInfo(SignedJWTInfo signedJWTInfo, String jti, String organization) throws APISecurityException { + private JWTValidationInfo getJwtValidationInfo(SignedJWTInfo signedJWTInfo, String jti, String organization, String environment) + throws APISecurityException { String jwtHeader = signedJWTInfo.getSignedJWT().getHeader().toString(); JWTValidationInfo jwtValidationInfo = null; @@ -524,7 +526,7 @@ private JWTValidationInfo getJwtValidationInfo(SignedJWTInfo signedJWTInfo, Stri if (jwtValidationInfo == null) { try { - jwtValidationInfo = JWTUtils.validateJWTToken(signedJWTInfo, organization); + jwtValidationInfo = JWTUtils.validateJWTToken(signedJWTInfo, organization, environment); signedJWTInfo.setValidationStatus(jwtValidationInfo.isValid() ? SignedJWTInfo.ValidationStatus.VALID : SignedJWTInfo.ValidationStatus.INVALID); if (isGatewayTokenCacheEnabled) { diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java index 8bba329be..371bf9c21 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStore.java @@ -75,7 +75,8 @@ void addApplicationKeyMappings( /** * Returns the JWTValidator based on Issuer * @param issuer issuer in JWT + * @param environment environment of the Issuer * @return JWTValidator Implementation */ - JWTValidator getJWTValidatorByIssuer(String issuer,String organization); + JWTValidator getJWTValidatorByIssuer(String issuer, String organization, String environment); } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index f541ed5ed..98cbf20e6 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -25,6 +25,7 @@ import org.wso2.apk.enforcer.commons.dto.JWKSConfigurationDTO; import org.wso2.apk.enforcer.commons.exception.EnforcerException; import org.wso2.apk.enforcer.config.dto.ExtendedTokenIssuerDto; +import org.wso2.apk.enforcer.constants.Constants; import org.wso2.apk.enforcer.discovery.ApiListDiscoveryClient; import org.wso2.apk.enforcer.discovery.ApplicationDiscoveryClient; import org.wso2.apk.enforcer.discovery.ApplicationKeyMappingDiscoveryClient; @@ -145,7 +146,7 @@ public void addSubscriptions(List apisList) { for (APIs api : apisList) { API newApi = new API(); - //newApi.setApiId(Integer.parseInt(api.getApiId())); + // newApi.setApiId(Integer.parseInt(api.getApiId())); newApi.setApiName(api.getName()); newApi.setApiProvider(api.getProvider()); newApi.setApiType(api.getApiType()); @@ -204,8 +205,7 @@ public void addApplicationPolicies( Map newAppPolicyMap = new ConcurrentHashMap<>(); - for (org.wso2.apk.enforcer.discovery.subscription.ApplicationPolicy applicationPolicy : - applicationPolicyList) { + for (org.wso2.apk.enforcer.discovery.subscription.ApplicationPolicy applicationPolicy : applicationPolicyList) { ApplicationPolicy newApplicationPolicy = new ApplicationPolicy(); newApplicationPolicy.setId(applicationPolicy.getId()); newApplicationPolicy.setQuotaType(applicationPolicy.getQuotaType()); @@ -225,8 +225,7 @@ public void addSubscriptionPolicies( Map newSubscriptionPolicyMap = new ConcurrentHashMap<>(); - for (org.wso2.apk.enforcer.discovery.subscription.SubscriptionPolicy subscriptionPolicy : - subscriptionPolicyList) { + for (org.wso2.apk.enforcer.discovery.subscription.SubscriptionPolicy subscriptionPolicy : subscriptionPolicyList) { SubscriptionPolicy newSubscriptionPolicy = new SubscriptionPolicy(); newSubscriptionPolicy.setId(subscriptionPolicy.getId()); newSubscriptionPolicy.setQuotaType(subscriptionPolicy.getQuotaType()); @@ -249,11 +248,9 @@ public void addSubscriptionPolicies( public void addApplicationKeyMappings( List applicationKeyMappingList) { - Map newApplicationKeyMappingMap = - new ConcurrentHashMap<>(); + Map newApplicationKeyMappingMap = new ConcurrentHashMap<>(); - for (org.wso2.apk.enforcer.discovery.subscription.ApplicationKeyMapping applicationKeyMapping : - applicationKeyMappingList) { + for (org.wso2.apk.enforcer.discovery.subscription.ApplicationKeyMapping applicationKeyMapping : applicationKeyMappingList) { ApplicationKeyMapping mapping = new ApplicationKeyMapping(); mapping.setApplicationId(applicationKeyMapping.getApplicationId()); mapping.setApplicationUUID(applicationKeyMapping.getApplicationUUID()); @@ -283,8 +280,8 @@ public void addJWTIssuers(List jwtIssuers) { if (StringUtils.isNotEmpty(certificate.getJwks().getUrl())) { JWKSConfigurationDTO jwksConfigurationDTO = new JWKSConfigurationDTO(); if (StringUtils.isNotEmpty(certificate.getJwks().getTls())) { - java.security.cert.Certificate tlsCertificate = - TLSUtils.getCertificateFromContent(certificate.getJwks().getTls()); + java.security.cert.Certificate tlsCertificate = TLSUtils + .getCertificateFromContent(certificate.getJwks().getTls()); jwksConfigurationDTO.setCertificate(tlsCertificate); } jwksConfigurationDTO.setUrl(certificate.getJwks().getUrl()); @@ -292,8 +289,8 @@ public void addJWTIssuers(List jwtIssuers) { tokenIssuerDto.setJwksConfigurationDTO(jwksConfigurationDTO); } if (StringUtils.isNotEmpty(certificate.getCertificate())) { - java.security.cert.Certificate signingCertificate = - TLSUtils.getCertificateFromContent(certificate.getCertificate()); + java.security.cert.Certificate signingCertificate = TLSUtils + .getCertificateFromContent(certificate.getCertificate()); tokenIssuerDto.setCertificate(signingCertificate); } Map claimMappingMap = jwtIssuer.getClaimMappingMap(); @@ -307,7 +304,13 @@ public void addJWTIssuers(List jwtIssuers) { if (jwtValidatorMap.containsKey(jwtIssuer.getOrganization())) { orgBasedJWTValidatorMap = jwtValidatorMap.get(jwtIssuer.getOrganization()); } - orgBasedJWTValidatorMap.put(jwtIssuer.getIssuer(), jwtValidator); + + List environments = getEnvironments(jwtIssuer); + for (String environment : environments) { + String mapKey = getMapKey(environment, jwtIssuer.getIssuer()); + orgBasedJWTValidatorMap.put(mapKey, jwtValidator); + } + jwtValidatorMap.put(jwtIssuer.getOrganization(), orgBasedJWTValidatorMap); this.jwtValidatorMap = jwtValidatorMap; } catch (EnforcerException | CertificateException | IOException e) { @@ -317,12 +320,52 @@ public void addJWTIssuers(List jwtIssuers) { } @Override - public JWTValidator getJWTValidatorByIssuer(String issuer, String organization) { + public JWTValidator getJWTValidatorByIssuer(String issuer, String organization, String environment) { Map orgBaseJWTValidators = jwtValidatorMap.get(organization); + if (orgBaseJWTValidators != null) { - return orgBaseJWTValidators.get(issuer); + + String mapKey; + if (environment.equals(Constants.DEFAULT_ENVIRONMENT)) { + mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer); + } else { + mapKey = getMapKey(environment, issuer); + } + + JWTValidator jwtValidator = orgBaseJWTValidators.get(mapKey); + if (jwtValidator != null) { + return jwtValidator; + } + + // Fall back to the default environment if the validator is not found + if (!environment.equals(Constants.DEFAULT_ENVIRONMENT)) { + mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer); + return orgBaseJWTValidators.get(mapKey); + } } + return null; } + + private List getEnvironments(JWTIssuer jwtIssuer) { + + List environmentsList = new ArrayList<>(); + int environmentCount = jwtIssuer.getEnvironmentsCount(); + + if (environmentCount > 0) { + for (int i = 0; i < environmentCount; i++) { + environmentsList.add(jwtIssuer.getEnvironments(i)); + } + } else { + environmentsList.add(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER); + } + return environmentsList; + } + + private String getMapKey(String environment, String issuer) { + return environment + DELEM_PERIOD + issuer; + } + + } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/JWTUtils.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/JWTUtils.java index db3513bb2..5c4971322 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/JWTUtils.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/util/JWTUtils.java @@ -264,12 +264,12 @@ public static void updateApplicationNameForSubscriptionDisabledKM(APIKeyValidati apiKeyValidationInfoDTO.setApplicationTier(APIConstants.UNLIMITED_TIER); } - public static JWTValidationInfo validateJWTToken(SignedJWTInfo signedJWTInfo, String organization) throws EnforcerException { + public static JWTValidationInfo validateJWTToken(SignedJWTInfo signedJWTInfo, String organization, String environment) throws EnforcerException { JWTValidationInfo jwtValidationInfo = new JWTValidationInfo(); String issuer = signedJWTInfo.getJwtClaimsSet().getIssuer(); JWTValidator jwtValidator = SubscriptionDataStoreImpl.getInstance().getJWTValidatorByIssuer(issuer, - organization); + organization, environment); if (jwtValidator != null) { return jwtValidator.validateJWTToken(signedJWTInfo); } diff --git a/helm-charts/crds/dp.wso2.com_tokenissuers.yaml b/helm-charts/crds/dp.wso2.com_tokenissuers.yaml index ed973f384..325ff1a2a 100644 --- a/helm-charts/crds/dp.wso2.com_tokenissuers.yaml +++ b/helm-charts/crds/dp.wso2.com_tokenissuers.yaml @@ -56,8 +56,15 @@ spec: key. minLength: 1 type: string + environments: + description: Environments denotes the environments that are applicable + for the token issuer. + items: + type: string + nullable: true + type: array issuer: - description: Issuer denotes the issuer of the JWT Issuer. + description: Issuer denotes the issuer of the Token Issuer. minLength: 1 type: string name: @@ -67,7 +74,7 @@ spec: minLength: 1 type: string organization: - description: Organization denotes the organization of the JWT Issuer. + description: Organization denotes the organization of the Token Issuer. minLength: 1 type: string scopesClaim: From 276309199c1c2a882caff929d4fffc56d6116f59 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Thu, 5 Oct 2023 17:18:47 +0530 Subject: [PATCH 15/24] Adding test cases for token issuer with environments --- build-apk.sh | 2 + test/cucumber-tests/CRs/artifacts.yaml | 48 +++++++++ test/cucumber-tests/scripts/setup-hosts.sh | 6 +- .../apk-confs/multi-env/employees_conf.yaml | 27 +++++ .../tests/api/MultiEnvironment.feature | 101 +++++++++++++++--- 5 files changed, 167 insertions(+), 17 deletions(-) create mode 100644 test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf.yaml diff --git a/build-apk.sh b/build-apk.sh index d4b1c655f..ae3cbc247 100755 --- a/build-apk.sh +++ b/build-apk.sh @@ -14,6 +14,8 @@ cd gateway/router;./gradlew build; cd $current_dir; cd gateway/enforcer;./gradlew build; cd $current_dir; +cd common-controller;./gradlew build; +cd $current_dir; cd idp/idp-domain-service;./gradlew build; cd $current_dir; cd idp/idp-ui;./gradlew build; diff --git a/test/cucumber-tests/CRs/artifacts.yaml b/test/cucumber-tests/CRs/artifacts.yaml index a6d401c52..b969f7f78 100644 --- a/test/cucumber-tests/CRs/artifacts.yaml +++ b/test/cucumber-tests/CRs/artifacts.yaml @@ -578,6 +578,54 @@ spec: kind: Gateway name: default --- +kind: TokenIssuer +apiVersion: dp.wso2.com/v1alpha1 +metadata: + name: multi-env-token-issuer-all-envs + namespace: apk-integration-test +spec: + consumerKeyClaim: azp + issuer: https://idp1.com + name: idp-all-env + organization: org3 + scopesClaim: scope + environments: + - "*" + signatureValidation: + jwks: + url: "http://dynamic-backend-service:8080/idp1/jwks" + claimMappings: + - remoteClaim: "organization" + localClaim: "x-wso2-organization" + targetRef: + group: gateway.networking.k8s.io + kind: Gateway + name: default +--- +kind: TokenIssuer +apiVersion: dp.wso2.com/v1alpha1 +metadata: + name: multi-env-token-issuer-dev-env + namespace: apk-integration-test +spec: + consumerKeyClaim: azp + issuer: https://idp1.com + name: idp-dev-only + organization: org4 + scopesClaim: scope + environments: + - "dev" + signatureValidation: + jwks: + url: "http://dynamic-backend-service:8080/idp1/jwks" + claimMappings: + - remoteClaim: "organization" + localClaim: "x-wso2-organization" + targetRef: + group: gateway.networking.k8s.io + kind: Gateway + name: default +--- # We have removed the Envoy admin interface port from our helm gateway service yaml. So we need this one here. apiVersion: v1 kind: Service diff --git a/test/cucumber-tests/scripts/setup-hosts.sh b/test/cucumber-tests/scripts/setup-hosts.sh index b57d5703a..abec38beb 100644 --- a/test/cucumber-tests/scripts/setup-hosts.sh +++ b/test/cucumber-tests/scripts/setup-hosts.sh @@ -14,8 +14,12 @@ sudo echo "$IP api.am.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org1.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org2.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP org3.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP org4.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts -sudo echo "$IP default-qa.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default-dev.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP org3-qa.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP org4-qa.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP org4-dev.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "255.255.255.255 broadcasthost" | sudo tee -a /etc/hosts sudo echo "::1 localhost" | sudo tee -a /etc/hosts diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf.yaml new file mode 100644 index 000000000..190a9fd33 --- /dev/null +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/multi-env/employees_conf.yaml @@ -0,0 +1,27 @@ +--- +name: "EmployeeServiceAPIDev" +basePath: "/withoutenv" +version: "3.14" +id: "without-env-api" +type: "REST" +defaultVersion: false +endpointConfigurations: + production: + endpoint: "http://backend:80/anything" +operations: + - target: "/employee" + verb: "GET" + secured: true + scopes: [] + - target: "/employee" + verb: "POST" + secured: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "PUT" + secured: true + scopes: [] + - target: "/employee/{employeeId}" + verb: "DELETE" + secured: true + scopes: [] diff --git a/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature index 614178a4d..d57664c83 100644 --- a/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature +++ b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature @@ -1,37 +1,106 @@ Feature: Deploy APIs in multiple environments - Scenario: Deploying an API in Dev Environment for Organization, test123 + Scenario: Deploying an API without specifing an Environment and token issuer has no environments. Given The system is ready And I have a valid subscription - When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_dev.yaml" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf.yaml" And the definition file "artifacts/definitions/employees_api.json" And make the API deployment request Then the response status code should be 200 Then I set headers |Authorization|bearer ${accessToken}| - And I send "GET" request to "https://default-dev.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I send "GET" request to "https://default.gw.wso2.com:9095/withoutenv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |429| + When I undeploy the API whose ID is "without-env-api" + Then the response status code should be 202 + + Scenario: Deploying an API without specifing an Environment and token issuer has all(*) environments. + Given The system is ready + And I have a valid token for organization "org3" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request for organization "org3" + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${org3}| + And I send "GET" request to "https://org3.gw.wso2.com:9095/withoutenv/3.14/employee/" with body "" And I eventually receive 200 response code, not accepting |429| - - Scenario: Deploying the same API in QA Environment for Organization, test123 + When I undeploy the API whose ID is "without-env-api" and organization "org3" + Then the response status code should be 202 + + Scenario: Deploying an API without specifing an Environment and token issuer has only dev environment. + Given The system is ready + And I have a valid token for organization "org4" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request for organization "org4" + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${org4}| + And I send "GET" request to "https://org4.gw.wso2.com:9095/withoutenv/3.14/employee/" with body "" + And I eventually receive 401 response code, not accepting + |200| + When I undeploy the API whose ID is "without-env-api" and organization "org4" + Then the response status code should be 202 + + Scenario: Deploying an API in Dev environment and token issuer has no environments. Given The system is ready And I have a valid subscription - When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_qa.yaml" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_dev.yaml" And the definition file "artifacts/definitions/employees_api.json" And make the API deployment request Then the response status code should be 200 Then I set headers |Authorization|bearer ${accessToken}| - And I send "GET" request to "https://default-qa.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I send "GET" request to "https://default-dev.gw.wso2.com:9095/multienv/3.14/employee/" with body "" And I eventually receive 200 response code, not accepting |429| - - Scenario Outline: Undeploy API + When I undeploy the API whose ID is "multi-env-dev-api" + Then the response status code should be 202 + + Scenario: Deploying an API in QA environment and token issuer has all(*) environments. Given The system is ready - And I have a valid subscription - When I undeploy the API whose ID is "" - Then the response status code should be + And I have a valid token for organization "org3" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_qa.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request for organization "org3" + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${org3}| + And I send "GET" request to "https://org3-qa.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |401| + When I undeploy the API whose ID is "multi-env-qa-api" and organization "org3" + Then the response status code should be 202 + + Scenario: Deploying an API in QA environment and token issuer has only Dev environment. + Given The system is ready + And I have a valid token for organization "org4" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_qa.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request for organization "org4" + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${org4}| + And I send "GET" request to "https://org4-qa.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 401 response code, not accepting + |200| + When I undeploy the API whose ID is "multi-env-qa-api" and organization "org4" + Then the response status code should be 202 - Examples: - | apiID | expectedStatusCode | - | multi-env-dev-api | 202 | - | multi-env-qa-api | 202 | + Scenario: Deploying an API in Dev environment and token issuer has only Dev environment. + Given The system is ready + And I have a valid token for organization "org4" + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_dev.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request for organization "org4" + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${org4}| + And I send "GET" request to "https://org4-dev.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |401| + When I undeploy the API whose ID is "multi-env-dev-api" and organization "org4" + Then the response status code should be 202 + \ No newline at end of file From 4052297944b98bc0511eb95040581e03c05e7587 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 6 Oct 2023 17:51:24 +0530 Subject: [PATCH 16/24] Adding environment field to the helm chart --- .../wso2/apk/enforcer/constants/Constants.java | 3 +-- .../subscription/SubscriptionDataStoreImpl.java | 17 ++++------------- helm-charts/README.md | 1 + .../gateway-components/common-log-conf.yaml | 3 +++ .../data-plane/gateway-components/log-conf.yaml | 3 +++ helm-charts/values.yaml.template | 2 ++ .../org/wso2/apk/integration/api/BaseSteps.java | 2 +- 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java index 14a6f0f1c..a79f31108 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/Constants.java @@ -78,6 +78,5 @@ since new lines in different OSs differ (Linux: \n, Windows: \r\n) */ public static final String DEFAULT_CON_FACTORY_JNDI_NAME = "TopicConnectionFactory"; // multi-env constants - public static final String DEFAULT_ENVIRONMENT_TOKEN_ISSUER = "*"; - public static final String DEFAULT_ENVIRONMENT = "Default"; + public static final String DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER = "*"; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index 98cbf20e6..a6db55d51 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -326,23 +326,14 @@ public JWTValidator getJWTValidatorByIssuer(String issuer, String organization, if (orgBaseJWTValidators != null) { - String mapKey; - if (environment.equals(Constants.DEFAULT_ENVIRONMENT)) { - mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer); - } else { - mapKey = getMapKey(environment, issuer); - } - + String mapKey = getMapKey(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER, issuer); JWTValidator jwtValidator = orgBaseJWTValidators.get(mapKey); if (jwtValidator != null) { return jwtValidator; } - // Fall back to the default environment if the validator is not found - if (!environment.equals(Constants.DEFAULT_ENVIRONMENT)) { - mapKey = getMapKey(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER, issuer); - return orgBaseJWTValidators.get(mapKey); - } + mapKey = getMapKey(environment, issuer); + return orgBaseJWTValidators.get(mapKey); } return null; @@ -358,7 +349,7 @@ private List getEnvironments(JWTIssuer jwtIssuer) { environmentsList.add(jwtIssuer.getEnvironments(i)); } } else { - environmentsList.add(Constants.DEFAULT_ENVIRONMENT_TOKEN_ISSUER); + environmentsList.add(Constants.DEFAULT_ALL_ENVIRONMENTS_TOKEN_ISSUER); } return environmentsList; } diff --git a/helm-charts/README.md b/helm-charts/README.md index 1431e7b49..2ab805647 100644 --- a/helm-charts/README.md +++ b/helm-charts/README.md @@ -40,6 +40,7 @@ A Helm chart for APK components | wso2.apk.idp.signing.secretName | string | `""` | IDP jwt signing certificate secret name | | wso2.apk.idp.signing.fileName | string | `""` | IDP jwt signing certificate file name | | wso2.apk.dp.enabled | bool | `true` | Enable the deployment of the Data Plane | +| wso2.apk.dp.environment | string | `Default` | Environment of the Data Plane | | wso2.apk.dp.gateway.listener.hostname | string | `"gw.wso2.com"` | Gateway Listener Hostname | | wso2.apk.dp.gateway.listener.secretName | string | `""` | Gateway Listener Certificate Secret Name | | wso2.apk.dp.gateway.listener.dns | list | `["*.gw.wso2.com","*.sandbox.gw.wso2.com","prod.gw.wso2.com"]` | DNS entries for gateway listener certificate | diff --git a/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml index 2a0421060..7c2eaf8c3 100644 --- a/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml @@ -7,6 +7,9 @@ metadata: data: config.toml: | [commoncontroller] + {{- if .Values.wso2.apk.dp.environment }} + environment = "{{ .Values.wso2.apk.dp.environment }}" + {{- end }} [commoncontroller.server] label = "ratelimiter" {{ if and .Values.wso2.apk.dp.commonController.configs .Values.wso2.apk.dp.commonController.configs.apiNamespaces }} diff --git a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml index e42fb2599..9344b8022 100644 --- a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml @@ -7,6 +7,9 @@ metadata: data: config.toml: | [adapter] + {{- if .Values.wso2.apk.dp.environment }} + environment = "{{ .Values.wso2.apk.dp.environment }}" + {{- end }} {{ if and .Values.wso2.apk.dp.adapter.configs .Values.wso2.apk.dp.adapter.configs.apiNamespaces }} [adapter.operator] namespaces = [{{ include "commaJoinedQuotedList" .Values.wso2.apk.dp.adapter.configs.apiNamespaces}}] diff --git a/helm-charts/values.yaml.template b/helm-charts/values.yaml.template index 691baefce..454c50d60 100644 --- a/helm-charts/values.yaml.template +++ b/helm-charts/values.yaml.template @@ -243,6 +243,8 @@ wso2: dp: # -- Enable the deployment of the Data Plane enabled: true + # -- Environment Name of the Data Plane + environment: "Development" gateway: listener: # -- Gateway Listener Hostname diff --git a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java index 6d7e446b5..c19592166 100644 --- a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java +++ b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java @@ -229,7 +229,7 @@ public void waitForNextMinuteStrictly() throws InterruptedException { LocalDateTime now = LocalDateTime.now(); LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - Thread.sleep((secondsToWait+2) * 1000); + Thread.sleep((secondsToWait+1) * 1000); logger.info("Current time: " + LocalDateTime.now()); } From 5e8a89698a545c3bd5db69c8a171e921ea0caaa2 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Fri, 13 Oct 2023 15:29:37 +0530 Subject: [PATCH 17/24] Moving environment as an object in the helm chart --- .../operator/config/crd/bases/dp.wso2.com_apis.yaml | 1 + .../operator/controllers/dp/tokenissuer_controller.go | 8 ++++---- .../commons/analytics/publishers/dto/ExtendedAPI.java | 2 +- .../org/wso2/apk/enforcer/constants/APIConstants.java | 1 - helm-charts/README.md | 2 +- .../data-plane/gateway-components/common-log-conf.yaml | 4 ++-- .../templates/data-plane/gateway-components/log-conf.yaml | 4 ++-- helm-charts/values.yaml.template | 5 +++-- 8 files changed, 14 insertions(+), 13 deletions(-) diff --git a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml index 0afaad5f8..552612ff9 100644 --- a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml +++ b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml @@ -97,6 +97,7 @@ spec: type: string environment: description: Environment denotes the environment of the API. + nullable: true type: string isDefaultVersion: description: IsDefaultVersion indicates whether this API version should diff --git a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go index 1a4ba09f7..bc60713ef 100644 --- a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go +++ b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go @@ -263,12 +263,12 @@ func getResolvedClaimMapping(claimMappings []dpv1alpha1.ClaimMapping) map[string func getTokenIssuerEnvironments(environments []string) []string { - resolvedEnvirenvironments := []string{} + resolvedEnvironments := []string{} if len(environments) == 0 { - resolvedEnvirenvironments = append(resolvedEnvirenvironments, defaultAllEnvironments) + resolvedEnvironments = append(resolvedEnvironments, defaultAllEnvironments) } else { - resolvedEnvirenvironments = environments + resolvedEnvironments = environments } - return resolvedEnvirenvironments + return resolvedEnvironments } diff --git a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java index 783288a54..8ab5c77aa 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java +++ b/gateway/enforcer/org.wso2.apk.enforcer.commons/src/main/java/org/wso2/apk/enforcer/commons/analytics/publishers/dto/ExtendedAPI.java @@ -41,7 +41,7 @@ public void setApiContext(String apiContext) { this.apiContext = apiContext; } - public String getEnvironment() { + public String getEnvironmentId() { return environmentId; } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java index 9cdc764e2..539d2dfc4 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/APIConstants.java @@ -46,7 +46,6 @@ public class APIConstants { public static final String API_KEY_TYPE_PRODUCTION = "PRODUCTION"; public static final String API_KEY_TYPE_SANDBOX = "SANDBOX"; public static final String DEFAULT_ENVIRONMENT_NAME = "Default"; - public static final String DEFAULT_ENVIRONMENT_ID = "Default-ID"; public static final String AUTHORIZATION_HEADER_BASIC = "Basic"; public static final String API_SECURITY_OAUTH2 = "oauth2"; diff --git a/helm-charts/README.md b/helm-charts/README.md index 2ab805647..e7786dbbf 100644 --- a/helm-charts/README.md +++ b/helm-charts/README.md @@ -40,7 +40,7 @@ A Helm chart for APK components | wso2.apk.idp.signing.secretName | string | `""` | IDP jwt signing certificate secret name | | wso2.apk.idp.signing.fileName | string | `""` | IDP jwt signing certificate file name | | wso2.apk.dp.enabled | bool | `true` | Enable the deployment of the Data Plane | -| wso2.apk.dp.environment | string | `Default` | Environment of the Data Plane | +| wso2.apk.dp.environment.name | string | `Default` | Environment of the Data Plane | | wso2.apk.dp.gateway.listener.hostname | string | `"gw.wso2.com"` | Gateway Listener Hostname | | wso2.apk.dp.gateway.listener.secretName | string | `""` | Gateway Listener Certificate Secret Name | | wso2.apk.dp.gateway.listener.dns | list | `["*.gw.wso2.com","*.sandbox.gw.wso2.com","prod.gw.wso2.com"]` | DNS entries for gateway listener certificate | diff --git a/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml index 7c2eaf8c3..64c9fe76b 100644 --- a/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/common-log-conf.yaml @@ -7,8 +7,8 @@ metadata: data: config.toml: | [commoncontroller] - {{- if .Values.wso2.apk.dp.environment }} - environment = "{{ .Values.wso2.apk.dp.environment }}" + {{- if and .Values.wso2.apk.dp.environment .Values.wso2.apk.dp.environment.name }} + environment = "{{ .Values.wso2.apk.dp.environment.name }}" {{- end }} [commoncontroller.server] label = "ratelimiter" diff --git a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml index 9344b8022..50130ba18 100644 --- a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml @@ -7,8 +7,8 @@ metadata: data: config.toml: | [adapter] - {{- if .Values.wso2.apk.dp.environment }} - environment = "{{ .Values.wso2.apk.dp.environment }}" + {{- if and .Values.wso2.apk.dp.environment .Values.wso2.apk.dp.environment.name }} + environment = "{{ .Values.wso2.apk.dp.environment.name }}" {{- end }} {{ if and .Values.wso2.apk.dp.adapter.configs .Values.wso2.apk.dp.adapter.configs.apiNamespaces }} [adapter.operator] diff --git a/helm-charts/values.yaml.template b/helm-charts/values.yaml.template index 454c50d60..a02b6538c 100644 --- a/helm-charts/values.yaml.template +++ b/helm-charts/values.yaml.template @@ -243,8 +243,9 @@ wso2: dp: # -- Enable the deployment of the Data Plane enabled: true - # -- Environment Name of the Data Plane - environment: "Development" + environment: + # -- Environment Name of the Data Plane + name: "Development" gateway: listener: # -- Gateway Listener Hostname From fe82a1cbe877159ad9e021447a88bec8a4dd7d3b Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Tue, 17 Oct 2023 15:43:13 +0530 Subject: [PATCH 18/24] Adding resource level rate limit support for sandbox routes --- .../oasparser/envoyconf/internal_dtos.go | 2 + .../oasparser/envoyconf/routes_configs.go | 8 +- .../envoyconf/routes_with_clusters.go | 2 + common-controller/internal/cache/datastore.go | 14 +- .../controller/ratelimitpolicy_controller.go | 194 +++++++++--------- common-controller/internal/xds/server.go | 43 ++-- .../artifacts/apk-confs/simple_rl_conf.yaml | 2 + .../apk-confs/simple_rl_resource_conf.yaml | 2 + .../tests/api/SimpleRateLimit.feature | 8 + 9 files changed, 151 insertions(+), 124 deletions(-) diff --git a/adapter/internal/oasparser/envoyconf/internal_dtos.go b/adapter/internal/oasparser/envoyconf/internal_dtos.go index 7c8248fb7..fd4242b27 100644 --- a/adapter/internal/oasparser/envoyconf/internal_dtos.go +++ b/adapter/internal/oasparser/envoyconf/internal_dtos.go @@ -44,6 +44,7 @@ type routeCreateParams struct { apiLevelRateLimitPolicy *model.RateLimitPolicy apiProperties []dpv1alpha1.Property environment string + envType string } // RatelimitCriteria criterias of rate limiting @@ -52,4 +53,5 @@ type ratelimitCriteria struct { organizationID string basePathForRLService string environment string + envType string } diff --git a/adapter/internal/oasparser/envoyconf/routes_configs.go b/adapter/internal/oasparser/envoyconf/routes_configs.go index ac27af9a8..20e54fc36 100644 --- a/adapter/internal/oasparser/envoyconf/routes_configs.go +++ b/adapter/internal/oasparser/envoyconf/routes_configs.go @@ -34,6 +34,7 @@ import ( logger "github.com/wso2/apk/adapter/internal/loggers" "github.com/wso2/apk/adapter/internal/oasparser/constants" "github.com/wso2/apk/adapter/internal/oasparser/model" + opConstants "github.com/wso2/apk/adapter/internal/operator/constants" "google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/durationpb" "google.golang.org/protobuf/types/known/wrapperspb" @@ -112,6 +113,11 @@ func generateRouteAction(apiType string, routeConfig *model.EndpointConfig, rate func generateRateLimitPolicy(ratelimitCriteria *ratelimitCriteria) []*routev3.RateLimit { + environmentValue := ratelimitCriteria.environment + if ratelimitCriteria.level != RateLimitPolicyAPILevel && ratelimitCriteria.envType == opConstants.Sandbox { + environmentValue += "_sandbox" + } + rateLimit := routev3.RateLimit{ Actions: []*routev3.RateLimit_Action{ { @@ -126,7 +132,7 @@ func generateRateLimitPolicy(ratelimitCriteria *ratelimitCriteria) []*routev3.Ra ActionSpecifier: &routev3.RateLimit_Action_GenericKey_{ GenericKey: &routev3.RateLimit_Action_GenericKey{ DescriptorKey: DescriptorKeyForEnvironment, - DescriptorValue: ratelimitCriteria.environment, + DescriptorValue: environmentValue, }, }, }, diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go index da527f358..1792b3181 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go @@ -818,6 +818,7 @@ func createRoutes(params *routeCreateParams) (routes []*routev3.Route, err error organizationID: params.organizationID, basePathForRLService: basePathForRLService, environment: params.environment, + envType: params.envType, } } var ( @@ -1529,6 +1530,7 @@ func genRouteCreateParams(swagger *model.AdapterInternalAPI, resource *model.Res routeConfig: resource.GetEndpoints().Config, createDefaultPath: createDefaultPath, environment: swagger.GetEnvironment(), + envType: swagger.EnvType, } return params } diff --git a/common-controller/internal/cache/datastore.go b/common-controller/internal/cache/datastore.go index 0a05be97a..528dfdd2d 100644 --- a/common-controller/internal/cache/datastore.go +++ b/common-controller/internal/cache/datastore.go @@ -28,7 +28,7 @@ import ( // RatelimitDataStore is a cache for rate limit policies. type RatelimitDataStore struct { - resolveRatelimitStore map[types.NamespacedName]*dpv1alpha1.ResolveRateLimitAPIPolicy + resolveRatelimitStore map[types.NamespacedName][]dpv1alpha1.ResolveRateLimitAPIPolicy customRatelimitStore map[types.NamespacedName]*dpv1alpha1.CustomRateLimitPolicyDef mu sync.Mutex } @@ -36,18 +36,18 @@ type RatelimitDataStore struct { // CreateNewOperatorDataStore creates a new RatelimitDataStore. func CreateNewOperatorDataStore() *RatelimitDataStore { return &RatelimitDataStore{ - resolveRatelimitStore: map[types.NamespacedName]*dpv1alpha1.ResolveRateLimitAPIPolicy{}, + resolveRatelimitStore: map[types.NamespacedName][]dpv1alpha1.ResolveRateLimitAPIPolicy{}, customRatelimitStore: map[types.NamespacedName]*dpv1alpha1.CustomRateLimitPolicyDef{}, } } // AddorUpdateResolveRatelimitToStore adds a new ratelimit to the RatelimitDataStore. func (ods *RatelimitDataStore) AddorUpdateResolveRatelimitToStore(rateLimit types.NamespacedName, - resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { + resolveRatelimitPolicyList []dpv1alpha1.ResolveRateLimitAPIPolicy) { ods.mu.Lock() defer ods.mu.Unlock() logger.Debug("Adding/Updating ratelimit to cache") - ods.resolveRatelimitStore[rateLimit] = &resolveRatelimit + ods.resolveRatelimitStore[rateLimit] = resolveRatelimitPolicyList } // AddorUpdateCustomRatelimitToStore adds a new ratelimit to the RatelimitDataStore. @@ -60,11 +60,11 @@ func (ods *RatelimitDataStore) AddorUpdateCustomRatelimitToStore(rateLimit types } // GetResolveRatelimitPolicy get cached ratelimit -func (ods *RatelimitDataStore) GetResolveRatelimitPolicy(rateLimit types.NamespacedName) (dpv1alpha1.ResolveRateLimitAPIPolicy, bool) { - var rateLimitPolicy dpv1alpha1.ResolveRateLimitAPIPolicy +func (ods *RatelimitDataStore) GetResolveRatelimitPolicy(rateLimit types.NamespacedName) ([]dpv1alpha1.ResolveRateLimitAPIPolicy, bool) { + var rateLimitPolicy []dpv1alpha1.ResolveRateLimitAPIPolicy if cachedRatelimit, found := ods.resolveRatelimitStore[rateLimit]; found { logger.Debug("Found cached ratelimit") - return *cachedRatelimit, true + return cachedRatelimit, true } return rateLimitPolicy, false } diff --git a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go index 7bc8b6b69..0205fa979 100644 --- a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go +++ b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go @@ -134,14 +134,12 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) Reconcile(ctx context.Cont // Check k8s RatelimitPolicy Availbility if err := ratelimitReconsiler.client.Get(ctx, ratelimitKey, &ratelimitPolicy); err != nil { - resolveRateLimitAPIPolicy, found := ratelimitReconsiler.ods.GetResolveRatelimitPolicy(req.NamespacedName) + resolveRateLimitAPIPolicyList, found := ratelimitReconsiler.ods.GetResolveRatelimitPolicy(req.NamespacedName) // If availble in cache Delete cache and xds if found && k8error.IsNotFound(err) { ratelimitReconsiler.ods.DeleteResolveRatelimitPolicy(req.NamespacedName) - xds.DeleteAPILevelRateLimitPolicies(resolveRateLimitAPIPolicy) - if resolveRateLimitAPIPolicy.Resources != nil { - xds.DeleteResourceLevelRateLimitPolicies(resolveRateLimitAPIPolicy) - } + xds.DeleteAPILevelRateLimitPolicies(resolveRateLimitAPIPolicyList) + xds.DeleteResourceLevelRateLimitPolicies(resolveRateLimitAPIPolicyList) xds.UpdateRateLimiterPolicies(conf.CommonController.Server.Label) } resolveCustomRateLimitPolicy, foundCustom := ratelimitReconsiler.ods.GetCachedCustomRatelimitPolicy(req.NamespacedName) @@ -160,11 +158,11 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) Reconcile(ctx context.Cont xds.UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicy) } else { - if resolveRatelimit, err := ratelimitReconsiler.marshelRateLimit(ctx, ratelimitKey, ratelimitPolicy); err != nil { + if resolveRatelimitPolicyList, err := ratelimitReconsiler.marshelRateLimit(ctx, ratelimitKey, ratelimitPolicy); err != nil { return ctrl.Result{}, err - } else if resolveRatelimit != nil { - ratelimitReconsiler.ods.AddorUpdateResolveRatelimitToStore(ratelimitKey, *resolveRatelimit) - xds.UpdateRateLimitXDSCache(*resolveRatelimit) + } else if len(resolveRatelimitPolicyList) > 0 { + ratelimitReconsiler.ods.AddorUpdateResolveRatelimitToStore(ratelimitKey, resolveRatelimitPolicyList) + xds.UpdateRateLimitXDSCache(resolveRatelimitPolicyList) xds.UpdateRateLimiterPolicies(conf.CommonController.Server.Label) } } @@ -239,21 +237,26 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) getRatelimitForHTTPRoute(c } func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx context.Context, ratelimitKey types.NamespacedName, - ratelimitPolicy dpv1alpha1.RateLimitPolicy) (*dpv1alpha1.ResolveRateLimitAPIPolicy, error) { + ratelimitPolicy dpv1alpha1.RateLimitPolicy) ([]dpv1alpha1.ResolveRateLimitAPIPolicy, error) { + + policyList := []dpv1alpha1.ResolveRateLimitAPIPolicy{} var api dpv1alpha1.API - var resolveResourceList []dpv1alpha1.ResolveResource - var resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy + + if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ + Namespace: ratelimitKey.Namespace, + Name: string(ratelimitPolicy.Spec.TargetRef.Name)}, + &api); err != nil { + return nil, fmt.Errorf("error while getting API : %v, %s", string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) + } + + organization := api.Spec.Organization + basePath := api.Spec.BasePath + environment := utils.GetEnvironment(api.Spec.Environment) + // API Level Rate limit policy if ratelimitPolicy.Spec.TargetRef.Kind == constants.KindAPI { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: string(ratelimitPolicy.Spec.TargetRef.Name)}, - &api); err != nil { - return nil, fmt.Errorf("error while getting API : %v, %s", string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) - } - var organization = api.Spec.Organization - var basePath = api.Spec.BasePath + var resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy if ratelimitPolicy.Spec.Override != nil { resolveRatelimit.API.RequestsPerUnit = ratelimitPolicy.Spec.Override.API.RequestsPerUnit resolveRatelimit.API.Unit = ratelimitPolicy.Spec.Override.API.Unit @@ -262,106 +265,95 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte resolveRatelimit.API.Unit = ratelimitPolicy.Spec.Default.API.Unit } - resolveRatelimit.Environment = utils.GetEnvironment(api.Spec.Environment) + resolveRatelimit.Environment = environment resolveRatelimit.Organization = organization resolveRatelimit.BasePath = basePath resolveRatelimit.UUID = string(api.ObjectMeta.UID) + policyList = append(policyList, resolveRatelimit) } // Resource Level Rate limit policy if ratelimitPolicy.Spec.TargetRef.Kind == constants.KindResource { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: string(ratelimitPolicy.Spec.TargetRef.Name)}, - &api); err != nil { - return nil, fmt.Errorf("error while getting API : %v, %s", string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) - } - var organization = api.Spec.Organization - var basePath = api.Spec.BasePath - var httpRoute gwapiv1b1.HTTPRoute + + var resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy + resolveRatelimit.Organization = organization + resolveRatelimit.BasePath = basePath + resolveRatelimit.UUID = string(api.ObjectMeta.UID) + resolveRatelimit.Environment = environment + if len(api.Spec.Production) > 0 { - for _, ref := range api.Spec.Production[0].HTTPRouteRefs { - if ref != "" { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: ref}, - &httpRoute); err != nil { - return nil, fmt.Errorf("error while getting HTTPRoute : %v for API : %v, %s", string(ref), - string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) - } - for _, rule := range httpRoute.Spec.Rules { - for _, filter := range rule.Filters { - if filter.ExtensionRef != nil { - if filter.ExtensionRef.Kind == constants.KindRateLimitPolicy && string(filter.ExtensionRef.Name) == ratelimitPolicy.Name { - var resolveResource dpv1alpha1.ResolveResource - resolveResource.Path = *rule.Matches[0].Path.Value - if rule.Matches[0].Method != nil { - resolveResource.Method = string(*rule.Matches[0].Method) - } else { - resolveResource.Method = constants.All - } - resolveResource.PathMatchType = *rule.Matches[0].Path.Type - if ratelimitPolicy.Spec.Override != nil { - resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Override.API.RequestsPerUnit - resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Override.API.Unit - } else { - resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Default.API.RequestsPerUnit - resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Default.API.Unit - } - resolveResourceList = append(resolveResourceList, resolveResource) - } - } - } - } - } + resolveResourceList, err := ratelimitReconsiler.getResourceList(ctx, ratelimitKey, ratelimitPolicy, api.Spec.Production[0].HTTPRouteRefs) + if err != nil { + return nil, err + } + if len(resolveResourceList) > 0 { + resolveRatelimit.Resources = resolveResourceList + policyList = append(policyList, resolveRatelimit) } } + if len(api.Spec.Sandbox) > 0 { - for _, ref := range api.Spec.Sandbox[0].HTTPRouteRefs { - if ref != "" { - if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ - Namespace: ratelimitKey.Namespace, - Name: ref}, - &httpRoute); err != nil { - return nil, fmt.Errorf("error while getting HTTPRoute : %v for API : %v, %s", string(ref), - string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) - } - for _, rule := range httpRoute.Spec.Rules { - for _, filter := range rule.Filters { - if filter.ExtensionRef != nil { - if filter.ExtensionRef.Kind == constants.KindRateLimitPolicy && string(filter.ExtensionRef.Name) == ratelimitPolicy.Name { - var resolveResource dpv1alpha1.ResolveResource - resolveResource.Path = *rule.Matches[0].Path.Value - if rule.Matches[0].Method != nil { - resolveResource.Method = string(*rule.Matches[0].Method) - } else { - resolveResource.Method = constants.All - } - resolveResource.PathMatchType = *rule.Matches[0].Path.Type - if ratelimitPolicy.Spec.Override != nil { - resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Override.API.RequestsPerUnit - resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Override.API.Unit - } else { - resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Default.API.RequestsPerUnit - resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Default.API.Unit - } - resolveResourceList = append(resolveResourceList, resolveResource) - } + + resolveResourceList, err := ratelimitReconsiler.getResourceList(ctx, ratelimitKey, ratelimitPolicy, api.Spec.Sandbox[0].HTTPRouteRefs) + if err != nil { + return nil, err + } + if len(resolveResourceList) > 0 { + resolveRatelimit.Resources = resolveResourceList + resolveRatelimit.Environment += "_sandbox" + policyList = append(policyList, resolveRatelimit) + } + } + } + + return policyList, nil +} + +func (ratelimitReconsiler *RateLimitPolicyReconciler) getResourceList(ctx context.Context, ratelimitKey types.NamespacedName, + ratelimitPolicy dpv1alpha1.RateLimitPolicy, httpRefs []string) ([]dpv1alpha1.ResolveResource, error) { + + var resolveResourceList []dpv1alpha1.ResolveResource + var httpRoute gwapiv1b1.HTTPRoute + + for _, ref := range httpRefs { + if ref != "" { + if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ + Namespace: ratelimitKey.Namespace, + Name: ref}, + &httpRoute); err != nil { + return nil, fmt.Errorf("error while getting HTTPRoute : %v for API : %v, %s", string(ref), + string(ratelimitPolicy.Spec.TargetRef.Name), err.Error()) + } + for _, rule := range httpRoute.Spec.Rules { + for _, filter := range rule.Filters { + if filter.ExtensionRef != nil { + if filter.ExtensionRef.Kind == constants.KindRateLimitPolicy && string(filter.ExtensionRef.Name) == ratelimitPolicy.Name { + var resolveResource dpv1alpha1.ResolveResource + resolveResource.Path = *rule.Matches[0].Path.Value + if rule.Matches[0].Method != nil { + resolveResource.Method = string(*rule.Matches[0].Method) + } else { + resolveResource.Method = constants.All } + resolveResource.PathMatchType = *rule.Matches[0].Path.Type + if ratelimitPolicy.Spec.Override != nil { + resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Override.API.RequestsPerUnit + resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Override.API.Unit + } else { + resolveResource.ResourceRatelimit.RequestsPerUnit = ratelimitPolicy.Spec.Default.API.RequestsPerUnit + resolveResource.ResourceRatelimit.Unit = ratelimitPolicy.Spec.Default.API.Unit + } + resolveResourceList = append(resolveResourceList, resolveResource) } - } } + } } - resolveRatelimit.Organization = organization - resolveRatelimit.BasePath = basePath - resolveRatelimit.UUID = string(api.ObjectMeta.UID) - resolveRatelimit.Environment = utils.GetEnvironment(api.Spec.Environment) - resolveRatelimit.Resources = resolveResourceList } - return &resolveRatelimit, nil + + return resolveResourceList, nil } func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelCustomRateLimit(ctx context.Context, ratelimitKey types.NamespacedName, diff --git a/common-controller/internal/xds/server.go b/common-controller/internal/xds/server.go index 7a3782043..5ed7d9960 100644 --- a/common-controller/internal/xds/server.go +++ b/common-controller/internal/xds/server.go @@ -55,9 +55,12 @@ func GetRateLimiterCache() envoy_cachev3.SnapshotCache { } // UpdateRateLimitXDSCache updates the xDS cache of the RateLimiter. -func UpdateRateLimitXDSCache(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { - // Add Rate Limit inline policies in API to the cache - rlsPolicyCache.AddAPILevelRateLimitPolicies(resolveRatelimit) +func UpdateRateLimitXDSCache(resolveRatelimitPolicyList []dpv1alpha1.ResolveRateLimitAPIPolicy) { + + for _, resolveRatelimitPolicy := range resolveRatelimitPolicyList { + // Add Rate Limit inline policies in API to the cache + rlsPolicyCache.AddAPILevelRateLimitPolicies(resolveRatelimitPolicy) + } } // UpdateRateLimitXDSCacheForCustomPolicies updates the xDS cache of the RateLimiter for custom policies. @@ -68,21 +71,31 @@ func UpdateRateLimitXDSCacheForCustomPolicies(customRateLimitPolicies dpv1alpha1 } // DeleteAPILevelRateLimitPolicies delete the ratelimit xds cache -func DeleteAPILevelRateLimitPolicies(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { - var org = resolveRatelimit.Organization - var environment = resolveRatelimit.Environment - var basePath = resolveRatelimit.BasePath - rlsPolicyCache.DeleteAPILevelRateLimitPolicies(org, environment, basePath) +func DeleteAPILevelRateLimitPolicies(resolveRatelimitPolicyList []dpv1alpha1.ResolveRateLimitAPIPolicy) { + + for _, resolveRatelimit := range resolveRatelimitPolicyList { + var org = resolveRatelimit.Organization + var environment = resolveRatelimit.Environment + var basePath = resolveRatelimit.BasePath + rlsPolicyCache.DeleteAPILevelRateLimitPolicies(org, environment, basePath) + } } // DeleteResourceLevelRateLimitPolicies delete the ratelimit xds cache -func DeleteResourceLevelRateLimitPolicies(resolveRatelimit dpv1alpha1.ResolveRateLimitAPIPolicy) { - var org = resolveRatelimit.Organization - var environment = resolveRatelimit.Environment - var basePath = resolveRatelimit.BasePath - var path = resolveRatelimit.Resources[0].Path - var method = resolveRatelimit.Resources[0].Method - rlsPolicyCache.DeleteResourceLevelRateLimitPolicies(org, environment, basePath, path, method) +func DeleteResourceLevelRateLimitPolicies(resolveRatelimitPolicyList []dpv1alpha1.ResolveRateLimitAPIPolicy) { + + for _, resolveRatelimit := range resolveRatelimitPolicyList { + + if resolveRatelimit.Resources == nil || len(resolveRatelimit.Resources) == 0 { + continue + } + var org = resolveRatelimit.Organization + var environment = resolveRatelimit.Environment + var basePath = resolveRatelimit.BasePath + var path = resolveRatelimit.Resources[0].Path + var method = resolveRatelimit.Resources[0].Method + rlsPolicyCache.DeleteResourceLevelRateLimitPolicies(org, environment, basePath, path, method) + } } // DeleteCustomRateLimitPolicies delete the ratelimit xds cache diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_conf.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_conf.yaml index 5d489245e..afcde354c 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_conf.yaml +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_conf.yaml @@ -8,6 +8,8 @@ defaultVersion: false endpointConfigurations: production: endpoint: "http://backend:80/anything" + sandbox: + endpoint: "http://backend:80/anything" operations: - target: "/employee" verb: "GET" diff --git a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_resource_conf.yaml b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_resource_conf.yaml index a5ca77745..33ec6a951 100644 --- a/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_resource_conf.yaml +++ b/test/cucumber-tests/src/test/resources/artifacts/apk-confs/simple_rl_resource_conf.yaml @@ -8,6 +8,8 @@ defaultVersion: false endpointConfigurations: production: endpoint: "http://backend:80/anything" + sandbox: + endpoint: "http://backend:80/anything" operations: - target: "/employee" verb: "GET" diff --git a/test/cucumber-tests/src/test/resources/tests/api/SimpleRateLimit.feature b/test/cucumber-tests/src/test/resources/tests/api/SimpleRateLimit.feature index c1556eb13..7b88660c5 100644 --- a/test/cucumber-tests/src/test/resources/tests/api/SimpleRateLimit.feature +++ b/test/cucumber-tests/src/test/resources/tests/api/SimpleRateLimit.feature @@ -15,6 +15,8 @@ Feature: Test simple rate limit feature |401| And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" Then the response status code should be 429 + And I send "GET" request to "https://default.sandbox.gw.wso2.com:9095/simple-rl/3.14/employee/" with body "" + Then the response status code should be 429 Scenario: Test simple rate limit api level for unsecured api Given The system is ready @@ -48,6 +50,12 @@ Feature: Test simple rate limit feature |401| And I send "POST" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" Then the response status code should be 429 + And I send "POST" request to "https://default.sandbox.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |429| + |401| + And I send "POST" request to "https://default.sandbox.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" + Then the response status code should be 429 And I wait for next minute And I send "GET" request to "https://default.gw.wso2.com:9095/simple-rl-r/3.14/employee/" with body "" Then the response status code should be 200 From a626420e564e85880eac6bda6d50ed7d59c1a161 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Wed, 18 Oct 2023 18:23:49 +0530 Subject: [PATCH 19/24] Passing environment field to the interceptors --- adapter/internal/interceptor/interceptor.go | 2 ++ adapter/internal/oasparser/envoyconf/routes_with_clusters.go | 1 + adapter/internal/operator/synchronizer/gateway_synchronizer.go | 1 + developer/resources/interceptor-service-open-api-v1.yaml | 3 +++ .../org/wso2/apk/enforcer/constants/InterceptorConstants.java | 1 + .../main/java/org/wso2/apk/enforcer/security/AuthFilter.java | 2 ++ gateway/router/resources/interceptor/lib/consts.lua | 3 ++- test/interceptor-backend/ballerina/types.bal | 1 + 8 files changed, 13 insertions(+), 1 deletion(-) diff --git a/adapter/internal/interceptor/interceptor.go b/adapter/internal/interceptor/interceptor.go index 10760a005..8c26b24c5 100644 --- a/adapter/internal/interceptor/interceptor.go +++ b/adapter/internal/interceptor/interceptor.go @@ -71,6 +71,7 @@ type InvocationContext struct { Vhost string ClusterName string APIProperties string + Environment string } var ( @@ -89,6 +90,7 @@ var ( organizationId = "{{.Context.OrganizationID}}", basePath = "{{.Context.BasePath}}", supportedMethods = "{{.Context.SupportedMethods}}", + environment = "{{.Context.Environment}}", apiName = "{{.Context.APIName}}", apiVersion = "{{.Context.APIVersion}}", pathTemplate = "{{.Context.PathTemplate}}", diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go index 1792b3181..f24b87e9e 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go @@ -766,6 +766,7 @@ func createRoutes(params *routeCreateParams) (routes []*routev3.Route, err error Vhost: contextExtensions[vHostContextExtension], ClusterName: contextExtensions[clusterNameContextExtension], APIProperties: getAPIProperties(params.apiProperties), + Environment: params.environment, } luaPerFilterConfig = lua.LuaPerRoute{ Override: &lua.LuaPerRoute_SourceCode{ diff --git a/adapter/internal/operator/synchronizer/gateway_synchronizer.go b/adapter/internal/operator/synchronizer/gateway_synchronizer.go index ac0b0789b..73d01a6cd 100644 --- a/adapter/internal/operator/synchronizer/gateway_synchronizer.go +++ b/adapter/internal/operator/synchronizer/gateway_synchronizer.go @@ -159,6 +159,7 @@ func getGlobalInterceptorScript(gatewayAPIPolicies map[string]dpv1alpha1.APIPoli OrganizationID: "", BasePath: "", SupportedMethods: "", + Environment: "", APIName: "", APIVersion: "", PathTemplate: "", diff --git a/developer/resources/interceptor-service-open-api-v1.yaml b/developer/resources/interceptor-service-open-api-v1.yaml index 90400f53a..24dbbb5d6 100644 --- a/developer/resources/interceptor-service-open-api-v1.yaml +++ b/developer/resources/interceptor-service-open-api-v1.yaml @@ -230,6 +230,9 @@ components: keyType: type: string example: PRODUCTION + environment: + type: string + example: Development InterceptorContext: title: Interceptor Context type: object diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/InterceptorConstants.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/InterceptorConstants.java index b456a1972..706efc52a 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/InterceptorConstants.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/constants/InterceptorConstants.java @@ -42,6 +42,7 @@ public static class APIMetadataFields { public static final String API_VERSION = "apiVersion"; public static final String API_VHOST = "vhost"; public static final String API_ORGANIZATION_ID = "organizationId"; + public static final String ENVIRONMENT = "environment"; } } diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/AuthFilter.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/AuthFilter.java index 59701b92b..0715006e4 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/AuthFilter.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/security/AuthFilter.java @@ -248,6 +248,8 @@ private void setInterceptorAPIMetadata(RequestContext requestContext) { Objects.toString(requestContext.getMatchedAPI().getVhost(), "")); requestContext.addMetadataToMap(InterceptorConstants.APIMetadataFields.API_ORGANIZATION_ID, Objects.toString(requestContext.getMatchedAPI().getOrganizationId(), "")); + requestContext.addMetadataToMap(InterceptorConstants.APIMetadataFields.ENVIRONMENT, + Objects.toString(requestContext.getMatchedAPI().getEnvironment(), "")); } private void populateRemoveAndProtectedAuthHeaders(RequestContext requestContext) { diff --git a/gateway/router/resources/interceptor/lib/consts.lua b/gateway/router/resources/interceptor/lib/consts.lua index e3b94a318..ea5b89bc7 100644 --- a/gateway/router/resources/interceptor/lib/consts.lua +++ b/gateway/router/resources/interceptor/lib/consts.lua @@ -52,7 +52,8 @@ INV_CONTEXT = { VHOST = "vhost", API_NAME = "apiName", API_VERSION = "apiVersion", - AUTH_CTX = "authenticationContext" + AUTH_CTX = "authenticationContext", + ENVIRONMENT = "environment" } -- keys of the payload to the auth context diff --git a/test/interceptor-backend/ballerina/types.bal b/test/interceptor-backend/ballerina/types.bal index 76ebe5010..70a90892d 100644 --- a/test/interceptor-backend/ballerina/types.bal +++ b/test/interceptor-backend/ballerina/types.bal @@ -142,6 +142,7 @@ public type InvocationContext record { string prodClusterName?; string sandClusterName?; string apiProperties?; + string environment?; InvocationContext_authenticationContext authenticationContext?; }; From 6f0c652e6028bdeb5dd6949ed75982d0d1b50498 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Sat, 21 Oct 2023 17:44:40 +0530 Subject: [PATCH 20/24] Adding v1alpha2 version for API Kind --- .../oasparser/envoyconf/internal_dtos.go | 4 +- .../envoyconf/routes_with_clusters.go | 4 +- .../envoyconf/routes_with_clusters_test.go | 37 +- .../oasparser/model/adapter_internal_api.go | 3 +- .../internal/oasparser/model/http_route.go | 3 +- adapter/internal/operator/PROJECT | 12 + .../operator/apis/dp/v1alpha1/api_types.go | 6 - .../operator/apis/dp/v1alpha2/api_types.go | 202 +++ .../apis/dp/v1alpha2/groupversion_info.go | 37 + .../apis/dp/v1alpha2/zz_generated.deepcopy.go | 195 +++ .../config/crd/bases/dp.wso2.com_apis.yaml | 172 +++ .../crd/patches/cainjection_in_dp_apis.yaml | 7 + .../crd/patches/webhook_in_dp_apis.yaml | 16 + .../config/rbac/dp_api_editor_role.yaml | 31 + .../config/rbac/dp_api_viewer_role.yaml | 27 + .../config/samples/dp_v1alpha2_api.yaml | 12 + .../operator/controllers/dp/api_controller.go | 43 +- .../internal/operator/hack/boilerplate.go.txt | 2 +- adapter/internal/operator/operator.go | 2 + .../operator/synchronizer/api_state.go | 3 +- .../synchronizer/zz_generated.deepcopy.go | 5 +- adapter/internal/operator/utils/utils.go | 23 +- common-controller/coverage.out | 1181 +++++++++-------- common-controller/go.mod | 2 +- common-controller/internal/cache/datastore.go | 2 +- common-controller/internal/operator/PROJECT | 29 +- .../operator/{apis => api}/cp/.gitKeep | 0 .../api/dp/v1alpha1/api_conversion.go | 111 ++ .../{apis => api}/dp/v1alpha1/api_types.go | 7 - .../operator/api/dp/v1alpha1/api_webhook.go | 29 + .../dp/v1alpha1/apipolicy_types.go | 0 .../dp/v1alpha1/apipolicy_webhook.go | 0 .../dp/v1alpha1/backend_types.go | 0 .../dp/v1alpha1/backend_webhook.go | 0 .../dp/v1alpha1/backendjwt_types.go | 0 .../dp/v1alpha1/backendjwt_webhook.go | 0 .../dp/v1alpha1/custom_ratelimit_policy.go | 0 .../dp/v1alpha1/groupversion_info.go | 0 .../dp/v1alpha1/interceptorservice_types.go | 0 .../dp/v1alpha1/interceptorservice_webhook.go | 0 .../dp/v1alpha1/ratelimitpolicy_types.go | 0 .../dp/v1alpha1/ratelimitpolicy_webhook.go | 0 .../dp/v1alpha1/resolveRatelimit.go | 0 .../dp/v1alpha1/webhook_suite_test.go | 0 .../dp/v1alpha1/zz_generated.deepcopy.go | 0 .../api/dp/v1alpha2/api_conversion.go | 21 + .../operator/api/dp/v1alpha2/api_types.go | 202 +++ .../dp/v1alpha2}/api_webhook.go | 20 +- .../dp/v1alpha2}/api_webhook_test.go | 4 +- .../api/dp/v1alpha2/groupversion_info.go | 37 + .../api/dp/v1alpha2/webhook_suite_test.go | 133 ++ .../api/dp/v1alpha2/zz_generated.deepcopy.go | 195 +++ .../config/certmanager/certificate.yaml | 39 + .../config/certmanager/kustomization.yaml | 5 + .../config/certmanager/kustomizeconfig.yaml | 8 + .../config/crd/bases/dp.wso2.com_apis.yaml | 176 +++ .../operator/config/crd/kustomization.yaml | 3 + .../crd/patches/cainjection_in_dp_apis.yaml | 7 + .../crd/patches/webhook_in_dp_apis.yaml | 16 + .../config/default/manager_webhook_patch.yaml | 23 + .../default/webhookcainjection_patch.yaml | 29 + .../config/rbac/dp_api_editor_role.yaml | 31 + .../config/rbac/dp_api_viewer_role.yaml | 27 + .../config/samples/dp_v1alpha2_api.yaml | 12 + .../config/samples/kustomization.yaml | 1 + .../config/webhook/kustomization.yaml | 6 + .../config/webhook/kustomizeconfig.yaml | 22 + .../operator/config/webhook/manifests.yaml | 8 +- .../operator/config/webhook/service.yaml | 20 + .../controller/ratelimitpolicy_controller.go | 9 +- .../operator/controller/suite_test.go | 2 +- .../internal/operator/hack/boilerplate.go.txt | 2 +- .../internal/operator/operator.go | 12 +- .../internal/xds/ratelimiter_cache.go | 2 +- common-controller/internal/xds/server.go | 2 +- helm-charts/crds/dp.wso2.com_apis.yaml | 175 ++- .../adapter-mutating-webhook-config.yaml | 4 +- .../adapter-validation-webhook-config.yaml | 4 +- .../ballerina/K8sClient.bal | 8 +- .../ballerina/modules/model/API.bal | 4 +- .../wso2/apk/integration/api/BaseSteps.java | 2 +- 81 files changed, 2795 insertions(+), 683 deletions(-) create mode 100644 adapter/internal/operator/apis/dp/v1alpha2/api_types.go create mode 100644 adapter/internal/operator/apis/dp/v1alpha2/groupversion_info.go create mode 100644 adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go create mode 100644 adapter/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml create mode 100644 adapter/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml create mode 100644 adapter/internal/operator/config/rbac/dp_api_editor_role.yaml create mode 100644 adapter/internal/operator/config/rbac/dp_api_viewer_role.yaml create mode 100644 adapter/internal/operator/config/samples/dp_v1alpha2_api.yaml rename common-controller/internal/operator/{apis => api}/cp/.gitKeep (100%) create mode 100644 common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/api_types.go (96%) create mode 100644 common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/apipolicy_types.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/apipolicy_webhook.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/backend_types.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/backend_webhook.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/backendjwt_types.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/backendjwt_webhook.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/custom_ratelimit_policy.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/groupversion_info.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/interceptorservice_types.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/interceptorservice_webhook.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/ratelimitpolicy_types.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/ratelimitpolicy_webhook.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/resolveRatelimit.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/webhook_suite_test.go (100%) rename common-controller/internal/operator/{apis => api}/dp/v1alpha1/zz_generated.deepcopy.go (100%) create mode 100644 common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go create mode 100644 common-controller/internal/operator/api/dp/v1alpha2/api_types.go rename common-controller/internal/operator/{apis/dp/v1alpha1 => api/dp/v1alpha2}/api_webhook.go (89%) rename common-controller/internal/operator/{apis/dp/v1alpha1 => api/dp/v1alpha2}/api_webhook_test.go (93%) create mode 100644 common-controller/internal/operator/api/dp/v1alpha2/groupversion_info.go create mode 100644 common-controller/internal/operator/api/dp/v1alpha2/webhook_suite_test.go create mode 100644 common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go create mode 100644 common-controller/internal/operator/config/certmanager/certificate.yaml create mode 100644 common-controller/internal/operator/config/certmanager/kustomization.yaml create mode 100644 common-controller/internal/operator/config/certmanager/kustomizeconfig.yaml create mode 100644 common-controller/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml create mode 100644 common-controller/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml create mode 100644 common-controller/internal/operator/config/default/manager_webhook_patch.yaml create mode 100644 common-controller/internal/operator/config/default/webhookcainjection_patch.yaml create mode 100644 common-controller/internal/operator/config/rbac/dp_api_editor_role.yaml create mode 100644 common-controller/internal/operator/config/rbac/dp_api_viewer_role.yaml create mode 100644 common-controller/internal/operator/config/samples/dp_v1alpha2_api.yaml create mode 100644 common-controller/internal/operator/config/webhook/kustomization.yaml create mode 100644 common-controller/internal/operator/config/webhook/kustomizeconfig.yaml create mode 100644 common-controller/internal/operator/config/webhook/service.yaml diff --git a/adapter/internal/oasparser/envoyconf/internal_dtos.go b/adapter/internal/oasparser/envoyconf/internal_dtos.go index fd4242b27..b8c7f11ed 100644 --- a/adapter/internal/oasparser/envoyconf/internal_dtos.go +++ b/adapter/internal/oasparser/envoyconf/internal_dtos.go @@ -19,7 +19,7 @@ package envoyconf import ( "github.com/wso2/apk/adapter/internal/oasparser/model" - dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" ) // routeCreateParams is the DTO used to provide information to the envoy route create function @@ -42,7 +42,7 @@ type routeCreateParams struct { isDefaultVersion bool createDefaultPath bool apiLevelRateLimitPolicy *model.RateLimitPolicy - apiProperties []dpv1alpha1.Property + apiProperties []dpv1alpha2.Property environment string envType string } diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go index f24b87e9e..af3975b81 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters.go @@ -52,13 +52,13 @@ import ( logging "github.com/wso2/apk/adapter/internal/logging" "github.com/wso2/apk/adapter/internal/oasparser/constants" "github.com/wso2/apk/adapter/internal/oasparser/model" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" "github.com/wso2/apk/adapter/internal/svcdiscovery" "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/any" "github.com/golang/protobuf/ptypes/wrappers" - dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -1449,7 +1449,7 @@ func getUpgradeConfig(apiType string) []*routev3.RouteAction_UpgradeConfig { return upgradeConfig } -func getAPIProperties(apiPropertiesConfig []dpv1alpha1.Property) string { +func getAPIProperties(apiPropertiesConfig []dpv1alpha2.Property) string { var apiProperties = make(map[string]string) for _, val := range apiPropertiesConfig { apiProperties[val.Name] = val.Value diff --git a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go index c59dc4b33..0c63d5fa4 100644 --- a/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go +++ b/adapter/internal/oasparser/envoyconf/routes_with_clusters_test.go @@ -24,6 +24,7 @@ import ( envoy "github.com/wso2/apk/adapter/internal/oasparser/envoyconf" "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" "github.com/wso2/apk/adapter/internal/operator/constants" "github.com/wso2/apk/adapter/internal/operator/synchronizer" operatorutils "github.com/wso2/apk/adapter/internal/operator/utils" @@ -34,16 +35,16 @@ import ( func TestCreateRoutesWithClustersWithExactAndRegularExpressionRules(t *testing.T) { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test-api-2", }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: "test-api-2", APIVersion: "2.0.0", BasePath: "/test-api/2.0.0", - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ "test-api-2-prod-http-route", @@ -182,16 +183,16 @@ func TestGenerateAdapterInternalAPIForSpecificEnvironment(t *testing.T) { func generateSampleAPI(apiName string, apiVersion string, basePath string) synchronizer.APIState { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: apiName, }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: apiName, APIVersion: apiVersion, BasePath: basePath, - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ apiName + "-prod-http-route", @@ -245,16 +246,16 @@ func generateSampleAPI(apiName string, apiVersion string, basePath string) synch // TODO: Fix this test case func TestCreateRoutesWithClustersWithMultiplePathPrefixRules(t *testing.T) { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test-api-1", }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: "test-api", APIVersion: "1.0.0", BasePath: "/test-api/1.0.0", - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ "test-api-1-prod-http-route", @@ -392,16 +393,16 @@ func TestCreateRoutesWithClustersWithMultiplePathPrefixRules(t *testing.T) { func TestCreateRoutesWithClustersWithBackendTLSConfigs(t *testing.T) { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test-api-3", }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: "test-api-3", APIVersion: "1.0.0", BasePath: "/test-api-3/1.0.0", - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ "test-api-3-prod-http-route", @@ -698,16 +699,16 @@ func TestCreateHealthEndpoint(t *testing.T) { func TestCreateRoutesWithClustersDifferentBackendRefs(t *testing.T) { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test-api-different-backendrefs", }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: "test-api-different-backendrefs", APIVersion: "1.0.0", BasePath: "/test-api-different-backendrefs/1.0.0", - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ "test-api-different-backendrefs-prod-http-route", @@ -788,16 +789,16 @@ func TestCreateRoutesWithClustersDifferentBackendRefs(t *testing.T) { func TestCreateRoutesWithClustersSameBackendRefs(t *testing.T) { apiState := synchronizer.APIState{} - apiDefinition := v1alpha1.API{ + apiDefinition := v1alpha2.API{ ObjectMeta: metav1.ObjectMeta{ Namespace: "default", Name: "test-api-same-backendrefs", }, - Spec: v1alpha1.APISpec{ + Spec: v1alpha2.APISpec{ APIName: "test-api-same-backendrefs", APIVersion: "1.0.0", BasePath: "/test-api-same-backendrefs/1.0.0", - Production: []v1alpha1.EnvConfig{ + Production: []v1alpha2.EnvConfig{ { HTTPRouteRefs: []string{ "test-api-same-backendrefs-prod-http-route", diff --git a/adapter/internal/oasparser/model/adapter_internal_api.go b/adapter/internal/oasparser/model/adapter_internal_api.go index 66833965c..b7d9f7b03 100644 --- a/adapter/internal/oasparser/model/adapter_internal_api.go +++ b/adapter/internal/oasparser/model/adapter_internal_api.go @@ -30,6 +30,7 @@ import ( logger "github.com/wso2/apk/adapter/internal/loggers" "github.com/wso2/apk/adapter/internal/oasparser/constants" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" ) // AdapterInternalAPI represents the object structure holding the information related to the @@ -65,7 +66,7 @@ type AdapterInternalAPI struct { backendJWTTokenInfo *BackendJWTTokenInfo apiDefinitionFile []byte apiDefinitionEndpoint string - APIProperties []dpv1alpha1.Property + APIProperties []dpv1alpha2.Property // GraphQLSchema string // GraphQLComplexities GraphQLComplexityYaml IsSystemAPI bool diff --git a/adapter/internal/oasparser/model/http_route.go b/adapter/internal/oasparser/model/http_route.go index af9a1e8f9..8c6fdf122 100644 --- a/adapter/internal/oasparser/model/http_route.go +++ b/adapter/internal/oasparser/model/http_route.go @@ -26,6 +26,7 @@ import ( "github.com/wso2/apk/adapter/internal/loggers" "github.com/wso2/apk/adapter/internal/oasparser/constants" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" "github.com/wso2/apk/adapter/internal/operator/utils" "golang.org/x/exp/maps" "k8s.io/apimachinery/pkg/types" @@ -631,7 +632,7 @@ func getAllowedOperations(httpMethod *gwapiv1b1.HTTPMethod, policies OperationPo } // SetInfoAPICR populates ID, ApiType, Version and XWso2BasePath of adapterInternalAPI. -func (swagger *AdapterInternalAPI) SetInfoAPICR(api dpv1alpha1.API) { +func (swagger *AdapterInternalAPI) SetInfoAPICR(api dpv1alpha2.API) { swagger.UUID = string(api.ObjectMeta.UID) swagger.title = api.Spec.APIName swagger.apiType = api.Spec.APIType diff --git a/adapter/internal/operator/PROJECT b/adapter/internal/operator/PROJECT index c76b1eb82..20893575b 100644 --- a/adapter/internal/operator/PROJECT +++ b/adapter/internal/operator/PROJECT @@ -1,3 +1,7 @@ +# Code generated by tool. DO NOT EDIT. +# This file is used to track the info used to scaffold your project +# and allow the plugins properly work. +# More info: https://book.kubebuilder.io/reference/project-config.html domain: wso2.com layout: - go.kubebuilder.io/v3 @@ -131,4 +135,12 @@ resources: defaulting: true validation: true webhookVersion: v1 +- api: + crdVersion: v1 + namespaced: true + domain: wso2.com + group: dp + kind: API + path: github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2 + version: v1alpha2 version: "3" diff --git a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go index afc61a6b8..cc9ed6e76 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/api_types.go @@ -109,12 +109,6 @@ type APISpec struct { // +optional // +nullable APIProperties []Property `json:"apiProperties,omitempty"` - - // Environment denotes the environment of the API. - // - // +optional - // +nullable - Environment string `json:"environment,omitempty"` } // Property holds key value pair of APIProperties diff --git a/adapter/internal/operator/apis/dp/v1alpha2/api_types.go b/adapter/internal/operator/apis/dp/v1alpha2/api_types.go new file mode 100644 index 000000000..9d21a2f04 --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha2/api_types.go @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// APISpec defines the desired state of API +type APISpec struct { + + // APIName is the unique name of the API + //can be used to uniquely identify an API. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=60 + // +kubebuilder:validation:Pattern="^[^~!@#;:%^*()+={}|\\<>\"'',&$\\[\\]\\/]*$" + APIName string `json:"apiName"` + + // APIVersion is the version number of the API. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=30 + // +kubebuilder:validation:Pattern="^[^~!@#;:%^*()+={}|\\<>\"'',&/$\\[\\]\\s+\\/]+$" + APIVersion string `json:"apiVersion"` + + // IsDefaultVersion indicates whether this API version should be used as a default API + // + // +optional + IsDefaultVersion bool `json:"isDefaultVersion"` + + // DefinitionFileRef contains the OpenAPI 3 or Swagger + // definition of the API in a ConfigMap. + // + // +optional + DefinitionFileRef string `json:"definitionFileRef"` + + // DefinitionPath contains the path to expose the API definition. + // + // +kubebuilder:default:=/api-definition + // +kubebuilder:validation:MinLength=1 + DefinitionPath string `json:"definitionPath"` + + // Production contains a list of references to HttpRoutes + // of type HttpRoute. + // xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go + // + // + // +optional + // +nullable + // +kubebuilder:validation:MaxItems=1 + Production []EnvConfig `json:"production"` + + // Sandbox contains a list of references to HttpRoutes + // of type HttpRoute. + // xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go + // + // + // +optional + // +nullable + // +kubebuilder:validation:MaxItems=1 + Sandbox []EnvConfig `json:"sandbox"` + + // APIType denotes the type of the API. + // Possible values could be REST, GraphQL, Async + // + // +kubebuilder:validation:Enum=REST + APIType string `json:"apiType"` + + // BasePath denotes the basepath of the API. + // e.g: /pet-store-api/1.0.6 + // + // +kubectl:validation:MaxLength=232 + // +kubebuilder:validation:Pattern=^[/][a-zA-Z0-9~/_.-]*$ + BasePath string `json:"basePath"` + + // Organization denotes the organization. + // related to the API + // + // +optional + Organization string `json:"organization"` + + // SystemAPI denotes if it is an internal system API. + // + // +optional + SystemAPI bool `json:"systemAPI"` + + // APIProperties denotes the custom properties of the API. + // + // +optional + // +nullable + APIProperties []Property `json:"apiProperties,omitempty"` + + // Environment denotes the environment of the API. + // + // +optional + // +nullable + Environment string `json:"environment,omitempty"` +} + +// Property holds key value pair of APIProperties +type Property struct { + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` +} + +// EnvConfig contains the environment specific configuration +type EnvConfig struct { + // HTTPRouteRefs denotes the environment of the API. + HTTPRouteRefs []string `json:"httpRouteRefs"` +} + +// APIStatus defines the observed state of API +type APIStatus struct { + // DeploymentStatus denotes the deployment status of the API + // + // +optional + DeploymentStatus DeploymentStatus `json:"deploymentStatus"` +} + +// DeploymentStatus contains the status of the API deployment +type DeploymentStatus struct { + + // Status denotes the state of the API in its lifecycle. + // Possible values could be Accepted, Invalid, Deploy etc. + // + // + Status string `json:"status"` + + // Message represents a user friendly message that explains the + // current state of the API. + // + // + // +optional + Message string `json:"message"` + + // Accepted represents whether the API is accepted or not. + // + // + Accepted bool `json:"accepted"` + + // TransitionTime represents the last known transition timestamp. + // + // + TransitionTime *metav1.Time `json:"transitionTime"` + + // Events contains a list of events related to the API. + // + // + // +optional + Events []string `json:"events,omitempty"` +} + +// +genclient +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:storageversion +//+kubebuilder:printcolumn:name="API Name",type="string",JSONPath=".spec.apiName" +//+kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.apiVersion" +//+kubebuilder:printcolumn:name="BasePath",type="string",JSONPath=".spec.basePath" +//+kubebuilder:printcolumn:name="Organization",type="string",JSONPath=".spec.organization" +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// API is the Schema for the apis API +type API struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec APISpec `json:"spec,omitempty"` + Status APIStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// APIList contains a list of API +type APIList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []API `json:"items"` +} + +func init() { + SchemeBuilder.Register(&API{}, &APIList{}) +} diff --git a/adapter/internal/operator/apis/dp/v1alpha2/groupversion_info.go b/adapter/internal/operator/apis/dp/v1alpha2/groupversion_info.go new file mode 100644 index 000000000..5ee817678 --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha2/groupversion_info.go @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package v1alpha2 contains API Schema definitions for the dp v1alpha2 API group +// +kubebuilder:object:generate=true +// +groupName=dp.wso2.com +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "dp.wso2.com", Version: "v1alpha2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go b/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 000000000..278eb999a --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,195 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *API) DeepCopyInto(out *API) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new API. +func (in *API) DeepCopy() *API { + if in == nil { + return nil + } + out := new(API) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *API) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIList) DeepCopyInto(out *APIList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]API, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIList. +func (in *APIList) DeepCopy() *APIList { + if in == nil { + return nil + } + out := new(APIList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APISpec) DeepCopyInto(out *APISpec) { + *out = *in + if in.Production != nil { + in, out := &in.Production, &out.Production + *out = make([]EnvConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Sandbox != nil { + in, out := &in.Sandbox, &out.Sandbox + *out = make([]EnvConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.APIProperties != nil { + in, out := &in.APIProperties, &out.APIProperties + *out = make([]Property, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APISpec. +func (in *APISpec) DeepCopy() *APISpec { + if in == nil { + return nil + } + out := new(APISpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIStatus) DeepCopyInto(out *APIStatus) { + *out = *in + in.DeploymentStatus.DeepCopyInto(&out.DeploymentStatus) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIStatus. +func (in *APIStatus) DeepCopy() *APIStatus { + if in == nil { + return nil + } + out := new(APIStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { + *out = *in + if in.TransitionTime != nil { + in, out := &in.TransitionTime, &out.TransitionTime + *out = (*in).DeepCopy() + } + if in.Events != nil { + in, out := &in.Events, &out.Events + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStatus. +func (in *DeploymentStatus) DeepCopy() *DeploymentStatus { + if in == nil { + return nil + } + out := new(DeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvConfig) DeepCopyInto(out *EnvConfig) { + *out = *in + if in.HTTPRouteRefs != nil { + in, out := &in.HTTPRouteRefs, &out.HTTPRouteRefs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvConfig. +func (in *EnvConfig) DeepCopy() *EnvConfig { + if in == nil { + return nil + } + out := new(EnvConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Property) DeepCopyInto(out *Property) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Property. +func (in *Property) DeepCopy() *Property { + if in == nil { + return nil + } + out := new(Property) + in.DeepCopyInto(out) + return out +} diff --git a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml index 552612ff9..1da03bb32 100644 --- a/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml +++ b/adapter/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml @@ -32,6 +32,178 @@ spec: name: Age type: date name: v1alpha1 + schema: + openAPIV3Schema: + description: API is the Schema for the apis API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: APISpec defines the desired state of API + properties: + apiName: + description: APIName is the unique name of the API can be used to + uniquely identify an API. + maxLength: 60 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&$\[\]\/]*$ + type: string + apiProperties: + description: APIProperties denotes the custom properties of the API. + items: + description: Property holds key value pair of APIProperties + properties: + name: + type: string + value: + type: string + type: object + nullable: true + type: array + apiType: + description: APIType denotes the type of the API. Possible values + could be REST, GraphQL, Async + enum: + - REST + type: string + apiVersion: + description: APIVersion is the version number of the API. + maxLength: 30 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&/$\[\]\s+\/]+$ + type: string + basePath: + description: 'BasePath denotes the basepath of the API. e.g: /pet-store-api/1.0.6' + pattern: ^[/][a-zA-Z0-9~/_.-]*$ + type: string + definitionFileRef: + description: DefinitionFileRef contains the OpenAPI 3 or Swagger definition + of the API in a ConfigMap. + type: string + definitionPath: + default: /api-definition + description: DefinitionPath contains the path to expose the API definition. + minLength: 1 + type: string + isDefaultVersion: + description: IsDefaultVersion indicates whether this API version should + be used as a default API + type: boolean + organization: + description: Organization denotes the organization. related to the + API + type: string + production: + description: 'Production contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + sandbox: + description: 'Sandbox contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + systemAPI: + description: SystemAPI denotes if it is an internal system API. + type: boolean + required: + - apiName + - apiType + - apiVersion + - basePath + - definitionPath + type: object + status: + description: APIStatus defines the observed state of API + properties: + deploymentStatus: + description: DeploymentStatus denotes the deployment status of the + API + properties: + accepted: + description: Accepted represents whether the API is accepted or + not. + type: boolean + events: + description: Events contains a list of events related to the API. + items: + type: string + type: array + message: + description: Message represents a user friendly message that explains + the current state of the API. + type: string + status: + description: Status denotes the state of the API in its lifecycle. + Possible values could be Accepted, Invalid, Deploy etc. + type: string + transitionTime: + description: TransitionTime represents the last known transition + timestamp. + format: date-time + type: string + required: + - accepted + - status + - transitionTime + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.apiName + name: API Name + type: string + - jsonPath: .spec.apiVersion + name: Version + type: string + - jsonPath: .spec.basePath + name: BasePath + type: string + - jsonPath: .spec.organization + name: Organization + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 schema: openAPIV3Schema: description: API is the Schema for the apis API diff --git a/adapter/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml b/adapter/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml new file mode 100644 index 000000000..7f949667b --- /dev/null +++ b/adapter/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: apis.dp.wso2.com diff --git a/adapter/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml b/adapter/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml new file mode 100644 index 000000000..ad0c609d5 --- /dev/null +++ b/adapter/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: apis.dp.wso2.com +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/adapter/internal/operator/config/rbac/dp_api_editor_role.yaml b/adapter/internal/operator/config/rbac/dp_api_editor_role.yaml new file mode 100644 index 000000000..2de3070c5 --- /dev/null +++ b/adapter/internal/operator/config/rbac/dp_api_editor_role.yaml @@ -0,0 +1,31 @@ +# permissions for end users to edit apis. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: api-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: api-editor-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - apis + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - dp.wso2.com + resources: + - apis/status + verbs: + - get diff --git a/adapter/internal/operator/config/rbac/dp_api_viewer_role.yaml b/adapter/internal/operator/config/rbac/dp_api_viewer_role.yaml new file mode 100644 index 000000000..75e4c488a --- /dev/null +++ b/adapter/internal/operator/config/rbac/dp_api_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view apis. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: api-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: api-viewer-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - apis + verbs: + - get + - list + - watch +- apiGroups: + - dp.wso2.com + resources: + - apis/status + verbs: + - get diff --git a/adapter/internal/operator/config/samples/dp_v1alpha2_api.yaml b/adapter/internal/operator/config/samples/dp_v1alpha2_api.yaml new file mode 100644 index 000000000..d7c9ebcb5 --- /dev/null +++ b/adapter/internal/operator/config/samples/dp_v1alpha2_api.yaml @@ -0,0 +1,12 @@ +apiVersion: dp.wso2.com/v1alpha2 +kind: API +metadata: + labels: + app.kubernetes.io/name: api + app.kubernetes.io/instance: api-sample + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: operator + name: api-sample +spec: + # TODO(user): Add fields here diff --git a/adapter/internal/operator/controllers/dp/api_controller.go b/adapter/internal/operator/controllers/dp/api_controller.go index bfdbd3607..77eafcf10 100644 --- a/adapter/internal/operator/controllers/dp/api_controller.go +++ b/adapter/internal/operator/controllers/dp/api_controller.go @@ -46,6 +46,7 @@ import ( k8client "sigs.k8s.io/controller-runtime/pkg/client" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -90,7 +91,7 @@ type APIReconciler struct { mgr manager.Manager } -// NewAPIController creates a new API controller instance. API Controllers watches for dpv1alpha1.API and gwapiv1b1.HTTPRoute. +// NewAPIController creates a new API controller instance. API Controllers watches for dpv1alpha2.API and gwapiv1b1.HTTPRoute. func NewAPIController(mgr manager.Manager, operatorDataStore *synchronizer.OperatorDataStore, statusUpdater *status.UpdateHandler, ch *chan synchronizer.APIEvent, successChannel *chan synchronizer.SuccessEvent) error { apiReconciler := &APIReconciler{ @@ -112,7 +113,7 @@ func NewAPIController(mgr manager.Manager, operatorDataStore *synchronizer.Opera conf := config.ReadConfigs() predicates := []predicate.Predicate{predicate.NewPredicateFuncs(utils.FilterByNamespaces(conf.Adapter.Operator.Namespaces))} - if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha1.API{}), &handler.EnqueueRequestForObject{}, + if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha2.API{}), &handler.EnqueueRequestForObject{}, predicates...); err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2611, logging.BLOCKER, "Error watching API resources: %v", err)) return err @@ -221,7 +222,7 @@ func (apiReconciler *APIReconciler) Reconcile(ctx context.Context, req ctrl.Requ applyAllAPIsOnce.Do(apiReconciler.applyStartupAPIs) loggers.LoggerAPKOperator.Infof("Reconciling for API %s", req.NamespacedName.String()) // Check whether the API CR exist, if not consider as a DELETE event. - var apiCR dpv1alpha1.API + var apiCR dpv1alpha2.API if err := apiReconciler.client.Get(ctx, req.NamespacedName, &apiCR); err != nil { apiState, found := apiReconciler.ods.GetCachedAPI(req.NamespacedName) if found && k8error.IsNotFound(err) { @@ -271,7 +272,7 @@ func (apiReconciler *APIReconciler) applyStartupAPIs() { // resolveAPIRefs validates following references related to the API // - HTTPRoutes -func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1alpha1.API) (*synchronizer.APIEvent, error) { +func (apiReconciler *APIReconciler) resolveAPIRefs(ctx context.Context, api dpv1alpha2.API) (*synchronizer.APIEvent, error) { var prodHTTPRouteRefs, sandHTTPRouteRefs []string if len(api.Spec.Production) > 0 { prodHTTPRouteRefs = api.Spec.Production[0].HTTPRouteRefs @@ -505,7 +506,7 @@ func (apiReconciler *APIReconciler) removeOldOwnerRefsFromChild(ctx context.Cont // - Authentications func (apiReconciler *APIReconciler) resolveHTTPRouteRefs(ctx context.Context, httpRouteState *synchronizer.HTTPRouteState, httpRouteRefs []string, namespace string, interceptorServiceMapping map[string]dpv1alpha1.InterceptorService, - api dpv1alpha1.API) (*synchronizer.HTTPRouteState, error) { + api dpv1alpha2.API) (*synchronizer.HTTPRouteState, error) { var err error httpRouteState.HTTPRouteCombined, httpRouteState.HTTPRoutePartitions, err = apiReconciler.concatHTTPRoutes(ctx, httpRouteRefs, namespace, api) if err != nil { @@ -517,7 +518,7 @@ func (apiReconciler *APIReconciler) resolveHTTPRouteRefs(ctx context.Context, ht } func (apiReconciler *APIReconciler) concatHTTPRoutes(ctx context.Context, httpRouteRefs []string, - namespace string, api dpv1alpha1.API) (*gwapiv1b1.HTTPRoute, map[string]*gwapiv1b1.HTTPRoute, error) { + namespace string, api dpv1alpha2.API) (*gwapiv1b1.HTTPRoute, map[string]*gwapiv1b1.HTTPRoute, error) { var combinedHTTPRoute *gwapiv1b1.HTTPRoute httpRoutePartitions := make(map[string]*gwapiv1b1.HTTPRoute) for _, httpRouteRef := range httpRouteRefs { @@ -538,7 +539,7 @@ func (apiReconciler *APIReconciler) concatHTTPRoutes(ctx context.Context, httpRo } func (apiReconciler *APIReconciler) getAuthenticationsForAPI(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.Authentication, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.Authentication, error) { nameSpacedName := utils.NamespacedName(&api).String() authentications := make(map[string]dpv1alpha1.Authentication) authenticationList := &dpv1alpha1.AuthenticationList{} @@ -558,7 +559,7 @@ func (apiReconciler *APIReconciler) getAuthenticationsForAPI(ctx context.Context } func (apiReconciler *APIReconciler) getRatelimitPoliciesForAPI(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.RateLimitPolicy, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.RateLimitPolicy, error) { nameSpacedName := utils.NamespacedName(&api).String() ratelimitPolicies := make(map[string]dpv1alpha1.RateLimitPolicy) ratelimitPolicyList := &dpv1alpha1.RateLimitPolicyList{} @@ -578,7 +579,7 @@ func (apiReconciler *APIReconciler) getRatelimitPoliciesForAPI(ctx context.Conte } func (apiReconciler *APIReconciler) getScopesForHTTPRoute(ctx context.Context, - httpRoute *gwapiv1b1.HTTPRoute, api dpv1alpha1.API) (map[string]dpv1alpha1.Scope, error) { + httpRoute *gwapiv1b1.HTTPRoute, api dpv1alpha2.API) (map[string]dpv1alpha1.Scope, error) { scopes := make(map[string]dpv1alpha1.Scope) for _, rule := range httpRoute.Spec.Rules { for _, filter := range rule.Filters { @@ -600,7 +601,7 @@ func (apiReconciler *APIReconciler) getScopesForHTTPRoute(ctx context.Context, } func (apiReconciler *APIReconciler) getAuthenticationsForResources(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.Authentication, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.Authentication, error) { nameSpacedName := utils.NamespacedName(&api).String() authentications := make(map[string]dpv1alpha1.Authentication) authenticationList := &dpv1alpha1.AuthenticationList{} @@ -620,7 +621,7 @@ func (apiReconciler *APIReconciler) getAuthenticationsForResources(ctx context.C } func (apiReconciler *APIReconciler) getRatelimitPoliciesForResources(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.RateLimitPolicy, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.RateLimitPolicy, error) { nameSpacedName := utils.NamespacedName(&api).String() ratelimitpolicies := make(map[string]dpv1alpha1.RateLimitPolicy) ratelimitPolicyList := &dpv1alpha1.RateLimitPolicyList{} @@ -640,7 +641,7 @@ func (apiReconciler *APIReconciler) getRatelimitPoliciesForResources(ctx context } func (apiReconciler *APIReconciler) getAPIPoliciesForAPI(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.APIPolicy, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.APIPolicy, error) { nameSpacedName := utils.NamespacedName(&api).String() apiPolicies := make(map[string]dpv1alpha1.APIPolicy) apiPolicyList := &dpv1alpha1.APIPolicyList{} @@ -660,7 +661,7 @@ func (apiReconciler *APIReconciler) getAPIPoliciesForAPI(ctx context.Context, } func (apiReconciler *APIReconciler) getAPIDefinitionForAPI(ctx context.Context, - apiDefinitionFile, namespace string, api dpv1alpha1.API) ([]byte, error) { + apiDefinitionFile, namespace string, api dpv1alpha2.API) ([]byte, error) { configMap := &corev1.ConfigMap{} if err := utils.ResolveRef(ctx, apiReconciler.client, &api, types.NamespacedName{Namespace: namespace, Name: apiDefinitionFile}, true, configMap); err != nil { @@ -676,7 +677,7 @@ func (apiReconciler *APIReconciler) getAPIDefinitionForAPI(ctx context.Context, } func (apiReconciler *APIReconciler) getAPIPoliciesForResources(ctx context.Context, - api dpv1alpha1.API) (map[string]dpv1alpha1.APIPolicy, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.APIPolicy, error) { nameSpacedName := utils.NamespacedName(&api).String() apiPolicies := make(map[string]dpv1alpha1.APIPolicy) apiPolicyList := &dpv1alpha1.APIPolicyList{} @@ -700,7 +701,7 @@ func (apiReconciler *APIReconciler) getAPIPoliciesForResources(ctx context.Conte // - backend JWTs func (apiReconciler *APIReconciler) getAPIPolicyChildrenRefs(ctx context.Context, apiPolicies, resourceAPIPolicies map[string]dpv1alpha1.APIPolicy, - api dpv1alpha1.API) (map[string]dpv1alpha1.InterceptorService, map[string]dpv1alpha1.BackendJWT, error) { + api dpv1alpha2.API) (map[string]dpv1alpha1.InterceptorService, map[string]dpv1alpha1.BackendJWT, error) { allAPIPolicies := append(maps.Values(apiPolicies), maps.Values(resourceAPIPolicies)...) interceptorServices := make(map[string]dpv1alpha1.InterceptorService) backendJWTs := make(map[string]dpv1alpha1.BackendJWT) @@ -775,7 +776,7 @@ func (apiReconciler *APIReconciler) getAPIPolicyChildrenRefs(ctx context.Context func (apiReconciler *APIReconciler) getResolvedBackendsMapping(ctx context.Context, httpRouteState *synchronizer.HTTPRouteState, interceptorServiceMapping map[string]dpv1alpha1.InterceptorService, - api dpv1alpha1.API) map[string]*dpv1alpha1.ResolvedBackend { + api dpv1alpha2.API) map[string]*dpv1alpha1.ResolvedBackend { backendMapping := make(map[string]*dpv1alpha1.ResolvedBackend) // Resolve backends in HTTPRoute @@ -814,7 +815,7 @@ func (apiReconciler *APIReconciler) getAPIForHTTPRoute(ctx context.Context, obj return []reconcile.Request{} } - apiList := &dpv1alpha1.APIList{} + apiList := &dpv1alpha2.APIList{} if err := apiReconciler.client.List(ctx, apiList, &k8client.ListOptions{ FieldSelector: fields.OneTermEqualSelector(httpRouteAPIIndex, utils.NamespacedName(httpRoute).String()), }); err != nil { @@ -1166,9 +1167,9 @@ func (apiReconciler *APIReconciler) getAPIsForGateway(ctx context.Context, obj k // apiPolicy schemes related to httproutes // This helps to find apiPolicy schemes binded to HTTPRoute. func addIndexes(ctx context.Context, mgr manager.Manager) error { - if err := mgr.GetFieldIndexer().IndexField(ctx, &dpv1alpha1.API{}, httpRouteAPIIndex, + if err := mgr.GetFieldIndexer().IndexField(ctx, &dpv1alpha2.API{}, httpRouteAPIIndex, func(rawObj k8client.Object) []string { - api := rawObj.(*dpv1alpha1.API) + api := rawObj.(*dpv1alpha2.API) var httpRoutes []string if len(api.Spec.Production) > 0 { for _, ref := range api.Spec.Production[0].HTTPRouteRefs { @@ -1576,9 +1577,9 @@ func (apiReconciler *APIReconciler) handleStatus() { apiReconciler.statusUpdater.Send(status.Update{ NamespacedName: successEvent.APINamespacedName, - Resource: new(dpv1alpha1.API), + Resource: new(dpv1alpha2.API), UpdateStatus: func(obj k8client.Object) k8client.Object { - h, ok := obj.(*dpv1alpha1.API) + h, ok := obj.(*dpv1alpha2.API) if !ok { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2626, logging.BLOCKER, "Unsupported object type %T", obj)) } diff --git a/adapter/internal/operator/hack/boilerplate.go.txt b/adapter/internal/operator/hack/boilerplate.go.txt index 4d1df243d..c32be1a39 100644 --- a/adapter/internal/operator/hack/boilerplate.go.txt +++ b/adapter/internal/operator/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/adapter/internal/operator/operator.go b/adapter/internal/operator/operator.go index 1ed9f369c..ea2631672 100644 --- a/adapter/internal/operator/operator.go +++ b/adapter/internal/operator/operator.go @@ -46,6 +46,7 @@ import ( cpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/cp/v1alpha1" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" //+kubebuilder:scaffold:imports ) @@ -63,6 +64,7 @@ func init() { utilruntime.Must(gwapiv1a2.AddToScheme(scheme)) utilruntime.Must(cpv1alpha1.AddToScheme(scheme)) + utilruntime.Must(dpv1alpha2.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } diff --git a/adapter/internal/operator/synchronizer/api_state.go b/adapter/internal/operator/synchronizer/api_state.go index 55904ffa1..38f21ad45 100644 --- a/adapter/internal/operator/synchronizer/api_state.go +++ b/adapter/internal/operator/synchronizer/api_state.go @@ -19,6 +19,7 @@ package synchronizer import ( "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -26,7 +27,7 @@ import ( // the state of the Kubernetes controller cache to detect updates. // +k8s:deepcopy-gen=true type APIState struct { - APIDefinition *v1alpha1.API + APIDefinition *v1alpha2.API ProdHTTPRoute *HTTPRouteState SandHTTPRoute *HTTPRouteState Authentications map[string]v1alpha1.Authentication diff --git a/adapter/internal/operator/synchronizer/zz_generated.deepcopy.go b/adapter/internal/operator/synchronizer/zz_generated.deepcopy.go index cea194db1..3397623bb 100644 --- a/adapter/internal/operator/synchronizer/zz_generated.deepcopy.go +++ b/adapter/internal/operator/synchronizer/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ package synchronizer import ( "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" "sigs.k8s.io/gateway-api/apis/v1beta1" ) @@ -32,7 +33,7 @@ func (in *APIState) DeepCopyInto(out *APIState) { *out = *in if in.APIDefinition != nil { in, out := &in.APIDefinition, &out.APIDefinition - *out = new(v1alpha1.API) + *out = new(v1alpha2.API) (*in).DeepCopyInto(*out) } if in.ProdHTTPRoute != nil { diff --git a/adapter/internal/operator/utils/utils.go b/adapter/internal/operator/utils/utils.go index e5c498a9e..3bb47d06b 100644 --- a/adapter/internal/operator/utils/utils.go +++ b/adapter/internal/operator/utils/utils.go @@ -30,6 +30,7 @@ import ( "github.com/wso2/apk/adapter/config" "github.com/wso2/apk/adapter/internal/loggers" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" constants "github.com/wso2/apk/adapter/internal/operator/constants" "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/adapter/pkg/utils/envutils" @@ -295,7 +296,7 @@ func getSecretValue(ctx context.Context, client k8client.Client, // ResolveAndAddBackendToMapping resolves backend from reference and adds it to the backendMapping. func ResolveAndAddBackendToMapping(ctx context.Context, client k8client.Client, backendMapping map[string]*dpv1alpha1.ResolvedBackend, - backendRef dpv1alpha1.BackendReference, interceptorServiceNamespace string, api *dpv1alpha1.API) { + backendRef dpv1alpha1.BackendReference, interceptorServiceNamespace string, api *dpv1alpha2.API) { backendName := types.NamespacedName{ Name: backendRef.Name, Namespace: interceptorServiceNamespace, @@ -307,7 +308,7 @@ func ResolveAndAddBackendToMapping(ctx context.Context, client k8client.Client, } // ResolveRef this function will return k8client object and update owner -func ResolveRef(ctx context.Context, client k8client.Client, api *dpv1alpha1.API, +func ResolveRef(ctx context.Context, client k8client.Client, api *dpv1alpha2.API, namespacedName types.NamespacedName, isReplace bool, obj k8client.Object, opts ...k8client.GetOption) error { if err := client.Get(ctx, namespacedName, obj, opts...); err != nil { return err @@ -323,7 +324,7 @@ func ResolveRef(ctx context.Context, client k8client.Client, api *dpv1alpha1.API // GetResolvedBackend resolves backend TLS configurations. func GetResolvedBackend(ctx context.Context, client k8client.Client, - backendNamespacedName types.NamespacedName, api *dpv1alpha1.API) *dpv1alpha1.ResolvedBackend { + backendNamespacedName types.NamespacedName, api *dpv1alpha2.API) *dpv1alpha1.ResolvedBackend { resolvedBackend := dpv1alpha1.ResolvedBackend{} resolvedTLSConfig := dpv1alpha1.ResolvedTLSConfig{} var backend dpv1alpha1.Backend @@ -390,7 +391,7 @@ func GetResolvedBackend(ctx context.Context, client k8client.Client, } // UpdateOwnerReference update the child with owner reference of the given parent. -func UpdateOwnerReference(ctx context.Context, client k8client.Client, child metav1.Object, api dpv1alpha1.API, +func UpdateOwnerReference(ctx context.Context, client k8client.Client, child metav1.Object, api dpv1alpha2.API, isReplace bool) error { if isReplace { child.SetOwnerReferences([]metav1.OwnerReference{ @@ -505,7 +506,7 @@ func RetrieveNamespaceListOptions(namespaces []string) k8client.ListOptions { // GetInterceptorService reads InterceptorService when interceptorReference is given func GetInterceptorService(ctx context.Context, client k8client.Client, namespace string, - interceptorReference *dpv1alpha1.InterceptorReference, api *dpv1alpha1.API) *dpv1alpha1.InterceptorService { + interceptorReference *dpv1alpha1.InterceptorReference, api *dpv1alpha2.API) *dpv1alpha1.InterceptorService { interceptorService := &dpv1alpha1.InterceptorService{} interceptorRef := types.NamespacedName{ Namespace: namespace, @@ -521,7 +522,7 @@ func GetInterceptorService(ctx context.Context, client k8client.Client, namespac // GetBackendJWT reads BackendJWT when backendJWTReference is given func GetBackendJWT(ctx context.Context, client k8client.Client, namespace, - backendJWTReference string, api *dpv1alpha1.API) *dpv1alpha1.BackendJWT { + backendJWTReference string, api *dpv1alpha2.API) *dpv1alpha1.BackendJWT { backendJWT := &dpv1alpha1.BackendJWT{} backendJWTRef := types.NamespacedName{ Namespace: namespace, @@ -536,21 +537,21 @@ func GetBackendJWT(ctx context.Context, client k8client.Client, namespace, } // RetrieveAPIList retrieves API list from the given kubernetes client -func RetrieveAPIList(k8sclient k8client.Client) ([]dpv1alpha1.API, error) { +func RetrieveAPIList(k8sclient k8client.Client) ([]dpv1alpha2.API, error) { ctx := context.Background() conf := config.ReadConfigs() namespaces := conf.Adapter.Operator.Namespaces - var apis []dpv1alpha1.API + var apis []dpv1alpha2.API if namespaces == nil { - apiList := &dpv1alpha1.APIList{} + apiList := &dpv1alpha2.APIList{} if err := k8sclient.List(ctx, apiList, &k8client.ListOptions{}); err != nil { return nil, err } - apis = make([]dpv1alpha1.API, len(apiList.Items)) + apis = make([]dpv1alpha2.API, len(apiList.Items)) copy(apis[:], apiList.Items[:]) } else { for _, namespace := range namespaces { - apiList := &dpv1alpha1.APIList{} + apiList := &dpv1alpha2.APIList{} if err := k8sclient.List(ctx, apiList, &k8client.ListOptions{Namespace: namespace}); err != nil { return nil, err } diff --git a/common-controller/coverage.out b/common-controller/coverage.out index c2ec4bc89..9104190df 100644 --- a/common-controller/coverage.out +++ b/common-controller/coverage.out @@ -1,573 +1,610 @@ mode: atomic -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go:194.13,196.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:33.69,37.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:46.32,46.33 0 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:54.66,56.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:59.84,61.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:64.44,67.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:70.2,71.51 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:75.2,75.107 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:79.2,79.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:84.2,84.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:67.33,69.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:71.51,74.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:75.107,78.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:79.22,83.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go:88.66,91.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:30.39,36.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:39.32,40.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:43.2,45.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:40.15,42.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:49.48,50.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:53.2,53.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:50.34,52.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:57.47,61.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:61.21,64.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:64.22,66.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:71.40,72.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:75.2,77.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:72.15,74.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:81.52,82.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:85.2,85.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:82.34,84.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:89.51,95.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:98.44,99.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:102.2,104.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:99.15,101.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:108.54,109.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:112.2,112.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:109.34,111.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:116.59,120.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:120.21,123.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:123.22,125.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:130.52,131.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:134.2,136.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:131.15,133.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:140.58,141.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:144.2,144.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:141.34,143.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:148.59,150.23 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:155.2,155.24 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:160.2,160.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:150.23,154.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:155.24,159.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:164.52,165.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:168.2,170.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:165.15,167.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:174.63,176.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:179.56,180.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:183.2,185.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:180.15,182.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:189.69,191.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:194.62,195.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:198.2,200.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:195.15,197.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:204.47,206.26 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:213.2,213.23 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:220.2,220.29 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:206.26,209.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:209.22,211.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:213.23,216.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:216.22,218.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:220.29,224.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:228.40,229.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:232.2,234.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:229.15,231.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:238.51,241.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:244.44,245.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:248.2,250.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:245.15,247.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:254.47,260.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:263.40,264.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:267.2,269.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:264.15,266.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:273.52,274.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:277.2,277.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:274.34,276.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:281.53,287.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:290.46,291.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:294.2,296.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:291.15,293.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:300.55,301.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:304.2,304.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:301.34,303.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:308.61,312.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:312.21,315.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:315.22,317.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:322.54,323.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:326.2,328.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:323.15,325.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:332.59,333.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:336.2,336.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:333.34,335.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:340.61,342.28 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:342.28,346.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:350.54,351.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:354.2,356.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:351.15,353.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:360.65,362.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:365.58,366.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:369.2,371.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:366.15,368.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:375.63,377.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:380.56,381.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:384.2,386.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:381.15,383.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:390.55,394.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:394.21,397.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:397.22,399.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:404.48,405.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:408.2,410.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:405.15,407.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:414.56,415.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:418.2,418.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:415.34,417.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:422.65,424.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:427.58,428.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:431.2,433.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:428.15,430.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:437.55,439.24 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:444.2,444.19 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:449.2,449.24 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:454.2,454.30 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:459.2,459.23 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:464.2,464.21 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:469.2,469.27 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:439.24,443.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:444.19,448.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:449.24,453.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:454.30,458.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:459.23,463.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:464.21,468.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:469.27,473.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:477.48,478.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:481.2,483.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:478.15,480.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:487.59,489.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:492.52,493.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:496.2,498.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:493.15,495.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:502.71,505.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:508.64,509.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:512.2,514.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:509.15,511.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:518.53,520.41 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:525.2,525.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:530.2,530.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:535.2,535.42 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:540.2,540.35 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:520.41,524.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:525.41,529.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:530.41,534.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:535.42,539.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:540.35,544.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:548.46,549.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:552.2,554.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:549.15,551.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:558.61,560.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:563.54,564.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:567.2,569.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:564.15,566.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:573.55,575.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:578.48,579.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:582.2,584.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:579.15,581.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:588.75,590.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:593.68,594.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:597.2,599.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:594.15,596.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:603.81,605.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:608.74,609.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:612.2,614.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:609.15,611.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:618.65,620.30 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:624.2,624.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:620.30,623.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:624.22,628.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:632.58,633.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:636.2,638.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:633.15,635.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:642.51,644.29 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:644.29,648.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:652.44,653.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:656.2,658.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:653.15,655.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:662.55,664.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:667.48,668.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:671.2,673.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:668.15,670.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:677.73,679.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:682.66,683.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:686.2,688.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:683.15,685.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:692.69,698.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:701.62,702.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:705.2,707.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:702.15,704.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:711.63,712.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:715.2,715.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:712.34,714.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:719.77,723.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:723.21,726.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:726.22,728.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:733.70,734.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:737.2,739.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:734.15,736.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:743.67,744.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:747.2,747.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:744.34,746.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:751.77,754.24 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:754.24,758.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:762.70,763.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:766.2,768.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:763.15,765.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:772.81,774.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:777.74,778.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:781.2,783.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:778.15,780.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:787.53,789.35 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:794.2,794.36 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:799.2,799.32 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:804.2,804.26 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:789.35,793.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:794.36,798.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:799.32,803.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:804.26,808.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:812.46,813.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:816.2,818.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:813.15,815.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:822.49,824.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:827.42,828.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:831.2,833.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:828.15,830.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:837.69,839.19 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:844.2,844.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:839.19,843.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:844.22,848.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:852.62,853.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:856.2,858.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:853.15,855.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:862.63,868.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:871.56,872.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:875.2,877.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:872.15,874.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:881.60,882.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:885.2,885.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:882.34,884.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:889.71,893.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:893.21,896.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:896.22,898.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:903.64,904.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:907.2,909.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:904.15,906.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:913.64,914.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:917.2,917.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:914.34,916.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:921.71,923.23 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:928.2,928.24 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:933.2,933.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:923.23,927.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:928.24,932.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:937.64,938.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:941.2,943.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:938.15,940.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:947.75,949.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:952.68,953.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:956.2,958.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:953.15,955.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:962.51,964.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:967.44,968.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:971.2,973.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:968.15,970.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:977.65,979.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:982.58,983.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:986.2,988.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:983.15,985.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:992.83,995.25 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1000.2,1000.21 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:995.25,999.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1000.21,1004.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1008.76,1009.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1012.2,1014.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1009.15,1011.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1018.63,1021.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1024.56,1025.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1028.2,1030.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1025.15,1027.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1034.55,1036.27 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1036.27,1040.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1044.48,1045.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1048.2,1050.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1045.15,1047.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1054.51,1056.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1059.44,1060.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1063.2,1065.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1060.15,1062.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1069.61,1071.21 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1071.21,1075.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1079.54,1080.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1083.2,1085.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1080.15,1082.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1089.47,1091.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1094.40,1095.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1098.2,1100.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1095.15,1097.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1104.51,1106.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1111.2,1111.25 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1116.2,1116.28 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1121.2,1121.27 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1106.33,1110.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1111.25,1115.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1116.28,1120.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1121.27,1125.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1129.44,1130.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1133.2,1135.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1130.15,1132.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1139.47,1141.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1144.40,1145.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1148.2,1150.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go:1145.15,1147.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:44.63,49.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:58.26,60.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:68.60,70.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:73.78,75.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:78.60,82.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:85.35,89.25 4 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:96.2,96.27 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:105.2,105.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:109.2,109.243 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:114.2,115.32 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:118.2,118.29 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:122.2,122.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:127.2,127.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:132.2,132.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:137.2,137.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:89.25,90.48 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:90.48,93.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:96.27,98.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:98.8,98.98 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:98.98,100.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:100.8,100.78 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:100.78,102.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:105.31,107.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:109.243,112.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:115.32,117.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:118.29,120.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:122.43,125.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:127.43,130.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:132.22,136.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:140.51,141.30 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:146.2,146.14 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:141.30,142.16 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:142.16,144.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:149.73,152.16 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:157.2,158.30 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:191.2,191.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:152.16,156.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:158.30,160.68 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:160.68,161.92 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:168.4,168.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:161.92,167.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:168.31,171.34 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:181.5,181.73 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:171.34,172.77 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:172.77,178.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:181.73,187.6 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:194.39,199.23 5 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:217.2,217.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:199.23,201.69 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:205.3,206.34 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:201.69,204.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:207.8,208.40 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:208.40,210.90 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:214.4,214.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:210.90,213.5 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:220.75,221.50 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:224.2,224.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:221.50,223.3 1 1 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:228.56,230.21 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:233.2,233.17 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go:230.21,232.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:65.82,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:70.64,75.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:77.47,80.24 3 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:89.2,89.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:94.2,94.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:80.24,81.54 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:66.98,73.45 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:78.2,79.16 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:85.2,89.106 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:95.2,96.112 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:102.2,102.143 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:108.2,109.12 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:73.45,76.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:79.16,83.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:89.106,93.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:96.112,100.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:102.143,106.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:125.125,134.92 6 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:154.2,157.53 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:160.2,166.27 6 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:134.92,137.39 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:145.3,146.45 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:152.3,152.28 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:137.39,140.50 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:143.4,143.69 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:140.50,142.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:146.45,151.4 4 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:157.53,159.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:169.136,171.9 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:177.2,182.17 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:186.2,186.46 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:191.2,191.17 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:171.9,175.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:182.17,184.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:186.46,189.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:195.116,197.9 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:203.2,208.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:197.9,201.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:211.142,213.9 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:219.2,224.17 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:227.2,227.46 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:232.2,232.17 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:213.9,217.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:224.17,226.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:227.46,230.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:236.95,242.62 5 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:296.2,296.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:392.2,392.32 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:242.62,246.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:249.3,252.35 4 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:267.3,267.32 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:282.3,282.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:289.3,292.53 4 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:246.22,248.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:252.35,253.61 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:253.61,254.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:254.18,258.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:261.6,261.56 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:258.31,260.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:261.56,263.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:267.32,268.58 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:268.58,269.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:269.18,273.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:276.6,276.56 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:273.31,275.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:276.56,278.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:282.43,285.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:285.9,288.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:296.67,300.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:303.3,306.35 4 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:346.3,346.32 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:386.3,390.51 5 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:300.22,302.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:306.35,307.61 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:307.61,308.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:308.18,312.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:315.6,315.48 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:312.31,314.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:315.48,316.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:316.43,317.38 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:317.38,318.130 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:336.9,336.59 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:318.130,321.43 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:326.10,327.50 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:334.10,334.76 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:321.43,323.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:323.16,325.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:327.50,330.11 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:330.16,333.11 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:336.59,338.10 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:346.32,347.58 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:347.58,348.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:348.18,352.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:355.6,355.48 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:352.31,354.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:355.48,356.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:356.43,357.38 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:357.38,358.130 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:376.9,376.59 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:358.130,361.43 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:366.10,367.50 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:374.10,374.76 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:361.43,363.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:363.16,365.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:367.50,370.11 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:370.16,373.11 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:376.59,378.10 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:396.82,399.66 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:403.2,403.30 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:399.66,402.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:407.118,411.2 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:413.65,415.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:437.2,438.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:448.2,448.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:415.41,418.46 3 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:431.4,431.26 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:418.46,419.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:419.41,420.36 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:420.36,421.68 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:421.68,427.8 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:432.18,434.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:438.41,447.4 4 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:452.61,457.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:460.83,461.42 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:464.2,464.25 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:461.42,463.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:470.78,471.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:471.41,472.24 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:475.3,475.70 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:472.24,474.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:480.39,483.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:486.96,490.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:61.2,66.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:45.43,47.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:52.40,54.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:58.37,60.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:71.58,89.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:92.2,96.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:99.2,102.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:105.2,110.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:30.39,36.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:39.32,40.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:43.2,45.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:40.15,42.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:49.48,50.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:53.2,53.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:50.34,52.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:57.47,61.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:61.21,64.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:64.22,66.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:71.40,72.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:75.2,77.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:72.15,74.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:81.52,82.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:85.2,85.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:82.34,84.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:89.51,95.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:98.44,99.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:102.2,104.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:99.15,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:108.54,109.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:112.2,112.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:109.34,111.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:116.59,120.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:120.21,123.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:123.22,125.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:130.52,131.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:134.2,136.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:131.15,133.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:140.58,141.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:144.2,144.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:141.34,143.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:148.59,150.23 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:155.2,155.24 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:160.2,160.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:150.23,154.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:155.24,159.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:164.52,165.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:168.2,170.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:165.15,167.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:174.63,176.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:179.56,180.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:183.2,185.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:180.15,182.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:189.69,191.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:194.62,195.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:198.2,200.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:195.15,197.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:204.47,206.26 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:213.2,213.23 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:220.2,220.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:206.26,209.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:209.22,211.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:213.23,216.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:216.22,218.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:220.29,224.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:228.40,229.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:232.2,234.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:229.15,231.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:238.51,241.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:244.44,245.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:248.2,250.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:245.15,247.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:254.47,260.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:263.40,264.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:267.2,269.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:264.15,266.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:273.52,274.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:277.2,277.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:274.34,276.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:281.53,287.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:290.46,291.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:294.2,296.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:291.15,293.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:300.55,301.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:304.2,304.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:301.34,303.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:308.61,312.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:312.21,315.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:315.22,317.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:322.54,323.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:326.2,328.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:323.15,325.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:332.59,333.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:336.2,336.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:333.34,335.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:340.61,342.28 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:342.28,346.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:350.54,351.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:354.2,356.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:351.15,353.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:360.65,362.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:365.58,366.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:369.2,371.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:366.15,368.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:375.63,377.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:380.56,381.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:384.2,386.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:381.15,383.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:390.55,394.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:394.21,397.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:397.22,399.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:404.48,405.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:408.2,410.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:405.15,407.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:414.56,415.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:418.2,418.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:415.34,417.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:422.65,424.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:427.58,428.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:431.2,433.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:428.15,430.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:437.55,439.24 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:444.2,444.19 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:449.2,449.24 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:454.2,454.30 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:459.2,459.23 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:464.2,464.21 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:469.2,469.27 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:439.24,443.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:444.19,448.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:449.24,453.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:454.30,458.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:459.23,463.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:464.21,468.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:469.27,473.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:477.48,478.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:481.2,483.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:478.15,480.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:487.59,489.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:492.52,493.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:496.2,498.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:493.15,495.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:502.71,505.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:508.64,509.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:512.2,514.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:509.15,511.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:518.53,520.41 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:525.2,525.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:530.2,530.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:535.2,535.42 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:540.2,540.35 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:520.41,524.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:525.41,529.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:530.41,534.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:535.42,539.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:540.35,544.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:548.46,549.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:552.2,554.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:549.15,551.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:558.61,560.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:563.54,564.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:567.2,569.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:564.15,566.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:573.55,575.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:578.48,579.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:582.2,584.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:579.15,581.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:588.75,590.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:593.68,594.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:597.2,599.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:594.15,596.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:603.81,605.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:608.74,609.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:612.2,614.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:609.15,611.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:618.65,620.30 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:624.2,624.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:620.30,623.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:624.22,628.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:632.58,633.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:636.2,638.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:633.15,635.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:642.51,644.29 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:644.29,648.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:652.44,653.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:656.2,658.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:653.15,655.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:662.55,664.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:667.48,668.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:671.2,673.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:668.15,670.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:677.73,679.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:682.66,683.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:686.2,688.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:683.15,685.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:692.69,698.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:701.62,702.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:705.2,707.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:702.15,704.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:711.63,712.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:715.2,715.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:712.34,714.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:719.77,723.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:723.21,726.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:726.22,728.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:733.70,734.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:737.2,739.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:734.15,736.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:743.67,744.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:747.2,747.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:744.34,746.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:751.77,754.24 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:754.24,758.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:762.70,763.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:766.2,768.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:763.15,765.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:772.81,774.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:777.74,778.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:781.2,783.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:778.15,780.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:787.53,789.35 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:794.2,794.36 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:799.2,799.32 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:804.2,804.26 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:789.35,793.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:794.36,798.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:799.32,803.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:804.26,808.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:812.46,813.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:816.2,818.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:813.15,815.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:822.49,824.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:827.42,828.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:831.2,833.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:828.15,830.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:837.69,839.19 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:844.2,844.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:839.19,843.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:844.22,848.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:852.62,853.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:856.2,858.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:853.15,855.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:862.63,868.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:871.56,872.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:875.2,877.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:872.15,874.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:881.60,882.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:885.2,885.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:882.34,884.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:889.71,893.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:893.21,896.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:896.22,898.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:903.64,904.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:907.2,909.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:904.15,906.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:913.64,914.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:917.2,917.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:914.34,916.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:921.71,923.23 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:928.2,928.24 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:933.2,933.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:923.23,927.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:928.24,932.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:937.64,938.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:941.2,943.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:938.15,940.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:947.75,949.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:952.68,953.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:956.2,958.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:953.15,955.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:962.51,964.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:967.44,968.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:971.2,973.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:968.15,970.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:977.65,979.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:982.58,983.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:986.2,988.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:983.15,985.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:992.83,995.25 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:995.25,999.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1003.76,1004.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1007.2,1009.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1004.15,1006.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1013.63,1016.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1019.56,1020.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1023.2,1025.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1020.15,1022.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1029.55,1031.27 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1031.27,1035.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1039.48,1040.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1043.2,1045.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1040.15,1042.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1049.51,1051.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1054.44,1055.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1058.2,1060.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1055.15,1057.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1064.61,1066.21 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1066.21,1070.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1074.54,1075.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1078.2,1080.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1075.15,1077.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1084.47,1086.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1089.40,1090.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1093.2,1095.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1090.15,1092.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1099.51,1101.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1106.2,1106.25 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1111.2,1111.28 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1116.2,1116.27 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1101.33,1105.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1106.25,1110.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1111.28,1115.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1116.27,1120.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1124.44,1125.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1128.2,1130.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1125.15,1127.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1134.47,1136.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1139.40,1140.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1143.2,1145.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1140.15,1142.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:33.69,37.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:46.32,46.33 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:54.66,56.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:59.84,61.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:64.44,67.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:70.2,71.51 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:75.2,75.107 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:79.2,79.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:84.2,84.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:67.33,69.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:71.51,74.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:75.107,78.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:79.22,83.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:88.66,91.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:65.82,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:70.64,75.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:77.47,80.24 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.2,89.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:94.2,94.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:80.24,81.54 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_types.go:194.13,196.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go:21.20,21.21 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_types.go:200.13,202.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:45.63,53.2 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:62.26,64.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:72.60,74.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:77.78,79.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:82.60,86.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:89.35,97.25 6 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:104.2,104.27 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:113.2,113.31 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:117.2,117.243 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:122.2,123.32 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:126.2,126.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.2,130.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.2,135.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:140.2,140.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:146.2,148.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:97.25,98.48 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:98.48,101.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:104.27,106.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:106.8,106.98 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:106.98,108.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.8,108.78 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.78,110.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:113.31,115.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:117.243,120.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:123.32,125.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:126.29,128.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.43,133.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.43,138.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:140.22,144.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:151.51,152.30 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:157.2,157.14 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:152.30,153.16 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:153.16,155.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:160.73,163.16 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:168.2,170.30 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:206.2,206.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:163.16,167.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:170.30,172.68 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:172.68,176.54 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:183.4,183.31 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:176.54,182.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:183.31,186.34 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:196.5,196.73 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:186.34,187.77 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:187.77,193.7 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:196.73,202.6 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:209.39,214.23 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:232.2,232.18 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:214.23,216.69 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:220.3,221.34 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:216.69,219.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:222.8,223.40 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:223.40,225.90 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:229.4,229.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:225.90,228.5 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:235.75,236.50 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:239.2,239.11 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:236.50,238.3 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:243.56,245.21 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:248.2,248.17 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:245.21,247.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:30.39,36.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:39.32,40.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:43.2,45.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:40.15,42.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:49.48,50.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:53.2,53.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:50.34,52.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:57.47,61.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:61.21,64.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:64.22,66.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:71.40,72.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:75.2,77.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:72.15,74.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:81.52,82.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:85.2,85.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:82.34,84.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:89.47,91.26 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.2,98.23 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.2,105.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:91.26,94.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:94.22,96.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.23,101.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:101.22,103.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.29,109.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:113.40,114.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:117.2,119.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:114.15,116.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:123.51,126.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:129.44,130.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:133.2,135.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:130.15,132.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:139.65,141.30 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.2,145.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:141.30,144.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.22,149.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:153.58,154.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:157.2,159.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:154.15,156.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:163.51,165.29 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:165.29,169.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:173.44,174.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:177.2,179.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:174.15,176.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:183.49,185.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:188.42,189.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:192.2,194.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:189.15,191.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:69.98,76.45 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:81.2,82.16 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:88.2,92.106 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:98.2,99.112 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:105.2,105.143 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:111.2,112.12 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:76.45,79.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:82.16,86.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:92.106,96.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:99.112,103.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:105.143,109.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:128.125,137.92 6 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:156.2,156.89 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:171.2,171.27 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:137.92,140.39 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:146.3,147.45 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:153.3,153.28 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:140.39,145.4 4 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:147.45,152.4 4 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:156.89,160.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:160.8,162.126 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:162.126,164.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:164.9,164.49 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:164.49,168.4 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:174.136,176.9 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:182.2,187.17 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:191.2,191.46 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:196.2,196.17 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:176.9,180.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:187.17,189.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:191.46,194.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:200.116,202.9 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:208.2,213.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:202.9,206.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:216.142,218.9 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:224.2,229.17 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:232.2,232.46 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:237.2,237.17 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:218.9,222.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:229.17,231.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:232.46,235.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:241.94,249.21 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:253.2,258.62 4 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:277.2,277.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:311.2,311.24 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:249.21,251.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:258.62,261.43 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:269.3,273.52 5 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:261.43,264.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:264.9,267.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:277.67,285.35 6 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:297.3,297.32 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:285.35,288.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:291.4,291.36 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:288.18,290.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:291.36,294.5 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:297.32,300.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:303.4,303.36 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:300.18,302.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:303.36,307.5 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:315.103,320.31 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:357.2,357.33 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:320.31,321.16 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:321.16,325.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:329.4,329.46 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:325.29,328.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:329.46,330.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:330.41,331.36 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:331.36,332.128 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:332.128,335.41 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:340.8,341.48 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:348.8,348.74 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:335.41,337.9 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:337.14,339.9 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:341.48,344.9 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:344.14,347.9 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:361.82,364.66 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:368.2,368.30 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:364.66,367.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:372.118,376.2 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:378.65,380.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:402.2,403.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:413.2,413.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:380.41,383.46 3 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:396.4,396.26 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:383.46,384.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:384.41,385.36 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:385.36,386.68 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:386.68,392.8 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:397.18,399.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:403.41,412.4 4 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:417.61,422.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:425.83,426.42 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:429.2,429.25 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:426.42,428.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:435.78,436.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:436.41,437.24 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:440.3,440.70 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:437.24,439.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:445.39,448.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:451.96,455.2 1 0 diff --git a/common-controller/go.mod b/common-controller/go.mod index a274fb10a..082db94b0 100644 --- a/common-controller/go.mod +++ b/common-controller/go.mod @@ -16,6 +16,7 @@ require ( github.com/envoyproxy/go-control-plane v0.11.2-0.20230802074621-eea0b3bd0f81 github.com/pelletier/go-toml v1.8.1 github.com/wso2/apk/adapter v0.0.0-20230811031118-fa0d1ec8848c + golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b google.golang.org/grpc v1.57.0 ) @@ -65,7 +66,6 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.24.0 // indirect - golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect golang.org/x/sys v0.8.0 // indirect diff --git a/common-controller/internal/cache/datastore.go b/common-controller/internal/cache/datastore.go index 528dfdd2d..250617ea5 100644 --- a/common-controller/internal/cache/datastore.go +++ b/common-controller/internal/cache/datastore.go @@ -21,7 +21,7 @@ import ( "sync" logger "github.com/sirupsen/logrus" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/common-controller/internal/operator/PROJECT b/common-controller/internal/operator/PROJECT index d415d08d6..67793a4ef 100644 --- a/common-controller/internal/operator/PROJECT +++ b/common-controller/internal/operator/PROJECT @@ -5,8 +5,9 @@ domain: wso2.com layout: - go.kubebuilder.io/v4 +multigroup: true projectName: operator -repo: github.com/wso2/apk/common-controller +repo: github.com/wso2/apk/common-controller/internal/operator resources: - api: crdVersion: v1 @@ -15,6 +16,30 @@ resources: domain: wso2.com group: dp kind: RateLimitPolicy - path: github.com/wso2/apk/common-controller/api/dp/v1alpha1 + path: github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1 version: v1alpha1 +- api: + crdVersion: v1 + namespaced: true + domain: wso2.com + group: dp + kind: API + path: github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2 + version: v1alpha2 + webhooks: + conversion: true + defaulting: true + validation: true + webhookVersion: v1 +- api: + crdVersion: v1 + namespaced: true + domain: wso2.com + group: dp + kind: API + path: github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1 + version: v1alpha1 + webhooks: + conversion: true + webhookVersion: v1 version: "3" diff --git a/common-controller/internal/operator/apis/cp/.gitKeep b/common-controller/internal/operator/api/cp/.gitKeep similarity index 100% rename from common-controller/internal/operator/apis/cp/.gitKeep rename to common-controller/internal/operator/api/cp/.gitKeep diff --git a/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go b/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go new file mode 100644 index 000000000..3d794fc08 --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha1 + +import ( + "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts this API CR to the Hub version (v1alpha2). +// src is v1alpha1.API and dst is v1alpha2.API. +func (src *API) ConvertTo(dstRaw conversion.Hub) error { + + dst := dstRaw.(*v1alpha2.API) + dst.ObjectMeta = src.ObjectMeta + + // Spec + dst.Spec.APIName = src.Spec.APIName + dst.Spec.APIVersion = src.Spec.APIVersion + dst.Spec.IsDefaultVersion = src.Spec.IsDefaultVersion + dst.Spec.DefinitionFileRef = src.Spec.DefinitionFileRef + dst.Spec.DefinitionPath = src.Spec.DefinitionPath + dst.Spec.APIType = src.Spec.APIType + dst.Spec.BasePath = src.Spec.BasePath + dst.Spec.Organization = src.Spec.Organization + dst.Spec.SystemAPI = src.Spec.SystemAPI + + // Convert []Property to []v1alpha2.Property + var properties []v1alpha2.Property + for _, p := range src.Spec.APIProperties { + properties = append(properties, v1alpha2.Property(p)) + } + dst.Spec.APIProperties = properties + + // Convert []EnvConfig to []v1alpha2.EnvConfig + var production []v1alpha2.EnvConfig + for _, p := range src.Spec.Production { + production = append(production, v1alpha2.EnvConfig(p)) + } + dst.Spec.Production = production + + var sandbox []v1alpha2.EnvConfig + for _, s := range src.Spec.Sandbox { + sandbox = append(sandbox, v1alpha2.EnvConfig(s)) + } + dst.Spec.Sandbox = sandbox + + // Status + dst.Status.DeploymentStatus = v1alpha2.DeploymentStatus(src.Status.DeploymentStatus) + + return nil +} + +// ConvertFrom converts from the Hub version (v1alpha2) to this version. +// src is v1alpha1.API and dst is v1alpha2.API. +func (src *API) ConvertFrom(srcRaw conversion.Hub) error { + + dst := srcRaw.(*v1alpha2.API) + src.ObjectMeta = dst.ObjectMeta + + // Spec + src.Spec.APIName = dst.Spec.APIName + src.Spec.APIVersion = dst.Spec.APIVersion + src.Spec.IsDefaultVersion = dst.Spec.IsDefaultVersion + src.Spec.DefinitionFileRef = dst.Spec.DefinitionFileRef + src.Spec.DefinitionPath = dst.Spec.DefinitionPath + src.Spec.APIType = dst.Spec.APIType + src.Spec.BasePath = dst.Spec.BasePath + src.Spec.Organization = dst.Spec.Organization + src.Spec.SystemAPI = dst.Spec.SystemAPI + + // Convert []Property to []v1alpha1.Property + var properties []Property + for _, p := range dst.Spec.APIProperties { + properties = append(properties, Property(p)) + } + src.Spec.APIProperties = properties + + // Convert []EnvConfig to []v1alpha1.EnvConfig + var production []EnvConfig + for _, p := range dst.Spec.Production { + production = append(production, EnvConfig(p)) + } + src.Spec.Production = production + + var sandbox []EnvConfig + for _, s := range dst.Spec.Sandbox { + sandbox = append(sandbox, EnvConfig(s)) + } + src.Spec.Sandbox = sandbox + + // Status + src.Status.DeploymentStatus = DeploymentStatus(dst.Status.DeploymentStatus) + + return nil +} diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go b/common-controller/internal/operator/api/dp/v1alpha1/api_types.go similarity index 96% rename from common-controller/internal/operator/apis/dp/v1alpha1/api_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/api_types.go index 6ed612360..cc9ed6e76 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_types.go +++ b/common-controller/internal/operator/api/dp/v1alpha1/api_types.go @@ -109,13 +109,6 @@ type APISpec struct { // +optional // +nullable APIProperties []Property `json:"apiProperties,omitempty"` - - // Environment denotes the environment of the API. - // This is a virtual environment on top of the segmented gateway. - // - // +optional - // +nullable - Environment string `json:"environment,omitempty"` } // Property holds key value pair of APIProperties diff --git a/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go new file mode 100644 index 000000000..67c0fc54e --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha1 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +// SetupWebhookWithManager creates a new webhook builder for API +func (r *API) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_types.go b/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/apipolicy_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/backend_types.go b/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/backend_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/backend_types.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/backend_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_types.go b/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/backendjwt_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/custom_ratelimit_policy.go b/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/custom_ratelimit_policy.go rename to common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/groupversion_info.go b/common-controller/internal/operator/api/dp/v1alpha1/groupversion_info.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/groupversion_info.go rename to common-controller/internal/operator/api/dp/v1alpha1/groupversion_info.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_types.go b/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/interceptorservice_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_types.go b/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_types.go rename to common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go b/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/ratelimitpolicy_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go b/common-controller/internal/operator/api/dp/v1alpha1/resolveRatelimit.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/resolveRatelimit.go rename to common-controller/internal/operator/api/dp/v1alpha1/resolveRatelimit.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/webhook_suite_test.go b/common-controller/internal/operator/api/dp/v1alpha1/webhook_suite_test.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/webhook_suite_test.go rename to common-controller/internal/operator/api/dp/v1alpha1/webhook_suite_test.go diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go b/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go similarity index 100% rename from common-controller/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go rename to common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go diff --git a/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go b/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go new file mode 100644 index 000000000..5a1953e13 --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +// Hub marks this type as a conversion hub. +func (*API) Hub() {} diff --git a/common-controller/internal/operator/api/dp/v1alpha2/api_types.go b/common-controller/internal/operator/api/dp/v1alpha2/api_types.go new file mode 100644 index 000000000..9d21a2f04 --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha2/api_types.go @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// APISpec defines the desired state of API +type APISpec struct { + + // APIName is the unique name of the API + //can be used to uniquely identify an API. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=60 + // +kubebuilder:validation:Pattern="^[^~!@#;:%^*()+={}|\\<>\"'',&$\\[\\]\\/]*$" + APIName string `json:"apiName"` + + // APIVersion is the version number of the API. + // + // +kubebuilder:validation:MinLength=1 + // +kubebuilder:validation:MaxLength=30 + // +kubebuilder:validation:Pattern="^[^~!@#;:%^*()+={}|\\<>\"'',&/$\\[\\]\\s+\\/]+$" + APIVersion string `json:"apiVersion"` + + // IsDefaultVersion indicates whether this API version should be used as a default API + // + // +optional + IsDefaultVersion bool `json:"isDefaultVersion"` + + // DefinitionFileRef contains the OpenAPI 3 or Swagger + // definition of the API in a ConfigMap. + // + // +optional + DefinitionFileRef string `json:"definitionFileRef"` + + // DefinitionPath contains the path to expose the API definition. + // + // +kubebuilder:default:=/api-definition + // +kubebuilder:validation:MinLength=1 + DefinitionPath string `json:"definitionPath"` + + // Production contains a list of references to HttpRoutes + // of type HttpRoute. + // xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go + // + // + // +optional + // +nullable + // +kubebuilder:validation:MaxItems=1 + Production []EnvConfig `json:"production"` + + // Sandbox contains a list of references to HttpRoutes + // of type HttpRoute. + // xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go + // + // + // +optional + // +nullable + // +kubebuilder:validation:MaxItems=1 + Sandbox []EnvConfig `json:"sandbox"` + + // APIType denotes the type of the API. + // Possible values could be REST, GraphQL, Async + // + // +kubebuilder:validation:Enum=REST + APIType string `json:"apiType"` + + // BasePath denotes the basepath of the API. + // e.g: /pet-store-api/1.0.6 + // + // +kubectl:validation:MaxLength=232 + // +kubebuilder:validation:Pattern=^[/][a-zA-Z0-9~/_.-]*$ + BasePath string `json:"basePath"` + + // Organization denotes the organization. + // related to the API + // + // +optional + Organization string `json:"organization"` + + // SystemAPI denotes if it is an internal system API. + // + // +optional + SystemAPI bool `json:"systemAPI"` + + // APIProperties denotes the custom properties of the API. + // + // +optional + // +nullable + APIProperties []Property `json:"apiProperties,omitempty"` + + // Environment denotes the environment of the API. + // + // +optional + // +nullable + Environment string `json:"environment,omitempty"` +} + +// Property holds key value pair of APIProperties +type Property struct { + Name string `json:"name,omitempty"` + Value string `json:"value,omitempty"` +} + +// EnvConfig contains the environment specific configuration +type EnvConfig struct { + // HTTPRouteRefs denotes the environment of the API. + HTTPRouteRefs []string `json:"httpRouteRefs"` +} + +// APIStatus defines the observed state of API +type APIStatus struct { + // DeploymentStatus denotes the deployment status of the API + // + // +optional + DeploymentStatus DeploymentStatus `json:"deploymentStatus"` +} + +// DeploymentStatus contains the status of the API deployment +type DeploymentStatus struct { + + // Status denotes the state of the API in its lifecycle. + // Possible values could be Accepted, Invalid, Deploy etc. + // + // + Status string `json:"status"` + + // Message represents a user friendly message that explains the + // current state of the API. + // + // + // +optional + Message string `json:"message"` + + // Accepted represents whether the API is accepted or not. + // + // + Accepted bool `json:"accepted"` + + // TransitionTime represents the last known transition timestamp. + // + // + TransitionTime *metav1.Time `json:"transitionTime"` + + // Events contains a list of events related to the API. + // + // + // +optional + Events []string `json:"events,omitempty"` +} + +// +genclient +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:storageversion +//+kubebuilder:printcolumn:name="API Name",type="string",JSONPath=".spec.apiName" +//+kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.apiVersion" +//+kubebuilder:printcolumn:name="BasePath",type="string",JSONPath=".spec.basePath" +//+kubebuilder:printcolumn:name="Organization",type="string",JSONPath=".spec.organization" +//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" + +// API is the Schema for the apis API +type API struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec APISpec `json:"spec,omitempty"` + Status APIStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// APIList contains a list of API +type APIList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []API `json:"items"` +} + +func init() { + SchemeBuilder.Register(&API{}, &APIList{}) +} diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go similarity index 89% rename from common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go rename to common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go index a6beab6c3..6c05a6235 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook.go +++ b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * */ -package v1alpha1 +package v1alpha2 import ( "context" @@ -43,7 +43,10 @@ var c client.Client // SetupWebhookWithManager creates a new webhook builder for API func (r *API) SetupWebhookWithManager(mgr ctrl.Manager) error { + c = mgr.GetClient() + loggers.LoggerAPK.Infof("API validation Skipped for namespace v2222222 ---DDDD--: %v", r.Namespace) + loggers.LoggerAPK.Infof("API validation Skipped for namespace setup ---DDD--: %v", r.Namespace) return ctrl.NewWebhookManagedBy(mgr). For(r). Complete() @@ -51,17 +54,17 @@ func (r *API) SetupWebhookWithManager(mgr ctrl.Manager) error { // TODO(user): EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! -//+kubebuilder:webhook:path=/mutate-dp-wso2-com-v1alpha1-api,mutating=true,failurePolicy=fail,sideEffects=None,groups=dp.wso2.com,resources=apis,verbs=create;update,versions=v1alpha1,name=mapi.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/mutate-dp-wso2-com-v1alpha2-api,mutating=true,failurePolicy=fail,sideEffects=None,groups=dp.wso2.com,resources=apis,verbs=create;update,versions=v1alpha2,name=mapi.kb.io,admissionReviewVersions=v1 var _ webhook.Defaulter = &API{} // Default implements webhook.Defaulter so a webhook will be registered for the type func (r *API) Default() { - // TODO: Add any defaulting logic here + // TODO(user): fill in your defaulting logic. } // TODO(user): change verbs to "verbs=create;update;delete" if you want to enable deletion validation. -//+kubebuilder:webhook:path=/validate-dp-wso2-com-v1alpha1-api,mutating=false,failurePolicy=fail,sideEffects=None,groups=dp.wso2.com,resources=apis,verbs=create;update,versions=v1alpha1,name=vapi.kb.io,admissionReviewVersions=v1 +//+kubebuilder:webhook:path=/validate-dp-wso2-com-v1alpha2-api,mutating=false,failurePolicy=fail,sideEffects=None,groups=dp.wso2.com,resources=apis,verbs=create;update,versions=v1alpha2,name=vapi.kb.io,admissionReviewVersions=v1 var _ webhook.Validator = &API{} @@ -84,6 +87,10 @@ func (r *API) ValidateDelete() (admission.Warnings, error) { // validateAPI validate api crd fields func (r *API) validateAPI() error { + + loggers.LoggerAPK.Infof("API validation Skipped for namespace APPPPPPv2KKKK ---v2--: %v", r.Namespace) + loggers.LoggerAPK.Infof("API validation Skipped for namespace APPPPPPKKKK ---v2 new--: %v", r.TypeMeta.APIVersion) + var allErrs field.ErrorList conf := config.ReadConfigs() namespaces := conf.CommonController.Operator.Namespaces @@ -135,6 +142,9 @@ func (r *API) validateAPI() error { schema.GroupKind{Group: "dp.wso2.com", Kind: "API"}, r.Name, allErrs) } + + loggers.LoggerAPKOperator.Infof("End of APKKkk ---- test ---new : %v", r.Namespace) + loggers.LoggerAPKOperator.Infof("End of APKKkk ---- test ---new : %v", r) return nil } diff --git a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook_test.go b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook_test.go similarity index 93% rename from common-controller/internal/operator/apis/dp/v1alpha1/api_webhook_test.go rename to common-controller/internal/operator/api/dp/v1alpha2/api_webhook_test.go index 323957941..a994829ee 100644 --- a/common-controller/internal/operator/apis/dp/v1alpha1/api_webhook_test.go +++ b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook_test.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,7 @@ * */ -package v1alpha1 +package v1alpha2 import ( "testing" diff --git a/common-controller/internal/operator/api/dp/v1alpha2/groupversion_info.go b/common-controller/internal/operator/api/dp/v1alpha2/groupversion_info.go new file mode 100644 index 000000000..5ee817678 --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha2/groupversion_info.go @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Package v1alpha2 contains API Schema definitions for the dp v1alpha2 API group +// +kubebuilder:object:generate=true +// +groupName=dp.wso2.com +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "dp.wso2.com", Version: "v1alpha2"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/common-controller/internal/operator/api/dp/v1alpha2/webhook_suite_test.go b/common-controller/internal/operator/api/dp/v1alpha2/webhook_suite_test.go new file mode 100644 index 000000000..a06710c0c --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha2/webhook_suite_test.go @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +import ( + "context" + "crypto/tls" + "fmt" + "net" + "path/filepath" + "testing" + "time" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + + admissionv1 "k8s.io/api/admission/v1" + //+kubebuilder:scaffold:imports + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/rest" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" +) + +// These tests use Ginkgo (BDD-style Go testing framework). Refer to +// http://onsi.github.io/ginkgo/ to learn more about Ginkgo. + +var cfg *rest.Config +var k8sClient client.Client +var testEnv *envtest.Environment +var ctx context.Context +var cancel context.CancelFunc + +func TestAPIs(t *testing.T) { + RegisterFailHandler(Fail) + + RunSpecs(t, "Webhook Suite") +} + +var _ = BeforeSuite(func() { + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + ctx, cancel = context.WithCancel(context.TODO()) + + By("bootstrapping test environment") + testEnv = &envtest.Environment{ + CRDDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "crd", "bases")}, + ErrorIfCRDPathMissing: false, + WebhookInstallOptions: envtest.WebhookInstallOptions{ + Paths: []string{filepath.Join("..", "..", "..", "config", "webhook")}, + }, + } + + var err error + // cfg is defined in this file globally. + cfg, err = testEnv.Start() + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).NotTo(BeNil()) + + scheme := runtime.NewScheme() + err = AddToScheme(scheme) + Expect(err).NotTo(HaveOccurred()) + + err = admissionv1.AddToScheme(scheme) + Expect(err).NotTo(HaveOccurred()) + + //+kubebuilder:scaffold:scheme + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) + + // start webhook server using Manager + webhookInstallOptions := &testEnv.WebhookInstallOptions + mgr, err := ctrl.NewManager(cfg, ctrl.Options{ + Scheme: scheme, + Host: webhookInstallOptions.LocalServingHost, + Port: webhookInstallOptions.LocalServingPort, + CertDir: webhookInstallOptions.LocalServingCertDir, + LeaderElection: false, + MetricsBindAddress: "0", + }) + Expect(err).NotTo(HaveOccurred()) + + err = (&API{}).SetupWebhookWithManager(mgr) + Expect(err).NotTo(HaveOccurred()) + + //+kubebuilder:scaffold:webhook + + go func() { + defer GinkgoRecover() + err = mgr.Start(ctx) + Expect(err).NotTo(HaveOccurred()) + }() + + // wait for the webhook server to get ready + dialer := &net.Dialer{Timeout: time.Second} + addrPort := fmt.Sprintf("%s:%d", webhookInstallOptions.LocalServingHost, webhookInstallOptions.LocalServingPort) + Eventually(func() error { + conn, err := tls.DialWithDialer(dialer, "tcp", addrPort, &tls.Config{InsecureSkipVerify: true}) + if err != nil { + return err + } + conn.Close() + return nil + }).Should(Succeed()) + +}) + +var _ = AfterSuite(func() { + cancel() + By("tearing down the test environment") + err := testEnv.Stop() + Expect(err).NotTo(HaveOccurred()) +}) diff --git a/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go b/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go new file mode 100644 index 000000000..c36ab0a96 --- /dev/null +++ b/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go @@ -0,0 +1,195 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *API) DeepCopyInto(out *API) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new API. +func (in *API) DeepCopy() *API { + if in == nil { + return nil + } + out := new(API) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *API) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIList) DeepCopyInto(out *APIList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]API, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIList. +func (in *APIList) DeepCopy() *APIList { + if in == nil { + return nil + } + out := new(APIList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *APIList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APISpec) DeepCopyInto(out *APISpec) { + *out = *in + if in.Production != nil { + in, out := &in.Production, &out.Production + *out = make([]EnvConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Sandbox != nil { + in, out := &in.Sandbox, &out.Sandbox + *out = make([]EnvConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.APIProperties != nil { + in, out := &in.APIProperties, &out.APIProperties + *out = make([]Property, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APISpec. +func (in *APISpec) DeepCopy() *APISpec { + if in == nil { + return nil + } + out := new(APISpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *APIStatus) DeepCopyInto(out *APIStatus) { + *out = *in + in.DeploymentStatus.DeepCopyInto(&out.DeploymentStatus) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new APIStatus. +func (in *APIStatus) DeepCopy() *APIStatus { + if in == nil { + return nil + } + out := new(APIStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { + *out = *in + if in.TransitionTime != nil { + in, out := &in.TransitionTime, &out.TransitionTime + *out = (*in).DeepCopy() + } + if in.Events != nil { + in, out := &in.Events, &out.Events + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeploymentStatus. +func (in *DeploymentStatus) DeepCopy() *DeploymentStatus { + if in == nil { + return nil + } + out := new(DeploymentStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EnvConfig) DeepCopyInto(out *EnvConfig) { + *out = *in + if in.HTTPRouteRefs != nil { + in, out := &in.HTTPRouteRefs, &out.HTTPRouteRefs + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EnvConfig. +func (in *EnvConfig) DeepCopy() *EnvConfig { + if in == nil { + return nil + } + out := new(EnvConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Property) DeepCopyInto(out *Property) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Property. +func (in *Property) DeepCopy() *Property { + if in == nil { + return nil + } + out := new(Property) + in.DeepCopyInto(out) + return out +} diff --git a/common-controller/internal/operator/config/certmanager/certificate.yaml b/common-controller/internal/operator/config/certmanager/certificate.yaml new file mode 100644 index 000000000..293f9f5cb --- /dev/null +++ b/common-controller/internal/operator/config/certmanager/certificate.yaml @@ -0,0 +1,39 @@ +# The following manifests contain a self-signed issuer CR and a certificate CR. +# More document can be found at https://docs.cert-manager.io +# WARNING: Targets CertManager v1.0. Check https://cert-manager.io/docs/installation/upgrading/ for breaking changes. +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + labels: + app.kubernetes.io/name: certificate + app.kubernetes.io/instance: serving-cert + app.kubernetes.io/component: certificate + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: selfsigned-issuer + namespace: system +spec: + selfSigned: {} +--- +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + labels: + app.kubernetes.io/name: certificate + app.kubernetes.io/instance: serving-cert + app.kubernetes.io/component: certificate + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml + namespace: system +spec: + # SERVICE_NAME and SERVICE_NAMESPACE will be substituted by kustomize + dnsNames: + - SERVICE_NAME.SERVICE_NAMESPACE.svc + - SERVICE_NAME.SERVICE_NAMESPACE.svc.cluster.local + issuerRef: + kind: Issuer + name: selfsigned-issuer + secretName: webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize diff --git a/common-controller/internal/operator/config/certmanager/kustomization.yaml b/common-controller/internal/operator/config/certmanager/kustomization.yaml new file mode 100644 index 000000000..bebea5a59 --- /dev/null +++ b/common-controller/internal/operator/config/certmanager/kustomization.yaml @@ -0,0 +1,5 @@ +resources: +- certificate.yaml + +configurations: +- kustomizeconfig.yaml diff --git a/common-controller/internal/operator/config/certmanager/kustomizeconfig.yaml b/common-controller/internal/operator/config/certmanager/kustomizeconfig.yaml new file mode 100644 index 000000000..cf6f89e88 --- /dev/null +++ b/common-controller/internal/operator/config/certmanager/kustomizeconfig.yaml @@ -0,0 +1,8 @@ +# This configuration is for teaching kustomize how to update name ref substitution +nameReference: +- kind: Issuer + group: cert-manager.io + fieldSpecs: + - kind: Certificate + group: cert-manager.io + path: spec/issuerRef/name diff --git a/common-controller/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml b/common-controller/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml index 85e741a57..55ab3158c 100644 --- a/common-controller/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml +++ b/common-controller/internal/operator/config/crd/bases/dp.wso2.com_apis.yaml @@ -183,6 +183,182 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.apiName + name: API Name + type: string + - jsonPath: .spec.apiVersion + name: Version + type: string + - jsonPath: .spec.basePath + name: BasePath + type: string + - jsonPath: .spec.organization + name: Organization + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + description: API is the Schema for the apis API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: APISpec defines the desired state of API + properties: + apiName: + description: APIName is the unique name of the API can be used to + uniquely identify an API. + maxLength: 60 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&$\[\]\/]*$ + type: string + apiProperties: + description: APIProperties denotes the custom properties of the API. + items: + description: Property holds key value pair of APIProperties + properties: + name: + type: string + value: + type: string + type: object + nullable: true + type: array + apiType: + description: APIType denotes the type of the API. Possible values + could be REST, GraphQL, Async + enum: + - REST + type: string + apiVersion: + description: APIVersion is the version number of the API. + maxLength: 30 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&/$\[\]\s+\/]+$ + type: string + basePath: + description: 'BasePath denotes the basepath of the API. e.g: /pet-store-api/1.0.6' + pattern: ^[/][a-zA-Z0-9~/_.-]*$ + type: string + definitionFileRef: + description: DefinitionFileRef contains the OpenAPI 3 or Swagger definition + of the API in a ConfigMap. + type: string + definitionPath: + default: /api-definition + description: DefinitionPath contains the path to expose the API definition. + minLength: 1 + type: string + environment: + description: Environment denotes the environment of the API. + nullable: true + type: string + isDefaultVersion: + description: IsDefaultVersion indicates whether this API version should + be used as a default API + type: boolean + organization: + description: Organization denotes the organization. related to the + API + type: string + production: + description: 'Production contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + sandbox: + description: 'Sandbox contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + systemAPI: + description: SystemAPI denotes if it is an internal system API. + type: boolean + required: + - apiName + - apiType + - apiVersion + - basePath + - definitionPath + type: object + status: + description: APIStatus defines the observed state of API + properties: + deploymentStatus: + description: DeploymentStatus denotes the deployment status of the + API + properties: + accepted: + description: Accepted represents whether the API is accepted or + not. + type: boolean + events: + description: Events contains a list of events related to the API. + items: + type: string + type: array + message: + description: Message represents a user friendly message that explains + the current state of the API. + type: string + status: + description: Status denotes the state of the API in its lifecycle. + Possible values could be Accepted, Invalid, Deploy etc. + type: string + transitionTime: + description: TransitionTime represents the last known transition + timestamp. + format: date-time + type: string + required: + - accepted + - status + - transitionTime + type: object + type: object + type: object + served: true storage: true subresources: status: {} diff --git a/common-controller/internal/operator/config/crd/kustomization.yaml b/common-controller/internal/operator/config/crd/kustomization.yaml index efe0fc658..b274ccd2e 100644 --- a/common-controller/internal/operator/config/crd/kustomization.yaml +++ b/common-controller/internal/operator/config/crd/kustomization.yaml @@ -3,17 +3,20 @@ # It should be run by config/default resources: - bases/dp.wso2.com_ratelimitpolicies.yaml +- bases/dp.wso2.com_apis.yaml #+kubebuilder:scaffold:crdkustomizeresource patches: # [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix. # patches here are for enabling the conversion webhook for each CRD #- patches/webhook_in_ratelimitpolicies.yaml +#- path: patches/webhook_in_apis.yaml #+kubebuilder:scaffold:crdkustomizewebhookpatch # [CERTMANAGER] To enable cert-manager, uncomment all the sections with [CERTMANAGER] prefix. # patches here are for enabling the CA injection for each CRD #- patches/cainjection_in_ratelimitpolicies.yaml +#- path: patches/cainjection_in_apis.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/common-controller/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml b/common-controller/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml new file mode 100644 index 000000000..e64dc4f55 --- /dev/null +++ b/common-controller/internal/operator/config/crd/patches/cainjection_in_dp_apis.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME + name: apis.dp.wso2.com diff --git a/common-controller/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml b/common-controller/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml new file mode 100644 index 000000000..ad0c609d5 --- /dev/null +++ b/common-controller/internal/operator/config/crd/patches/webhook_in_dp_apis.yaml @@ -0,0 +1,16 @@ +# The following patch enables a conversion webhook for the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: apis.dp.wso2.com +spec: + conversion: + strategy: Webhook + webhook: + clientConfig: + service: + namespace: system + name: webhook-service + path: /convert + conversionReviewVersions: + - v1 diff --git a/common-controller/internal/operator/config/default/manager_webhook_patch.yaml b/common-controller/internal/operator/config/default/manager_webhook_patch.yaml new file mode 100644 index 000000000..738de350b --- /dev/null +++ b/common-controller/internal/operator/config/default/manager_webhook_patch.yaml @@ -0,0 +1,23 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: controller-manager + namespace: system +spec: + template: + spec: + containers: + - name: manager + ports: + - containerPort: 9443 + name: webhook-server + protocol: TCP + volumeMounts: + - mountPath: /tmp/k8s-webhook-server/serving-certs + name: cert + readOnly: true + volumes: + - name: cert + secret: + defaultMode: 420 + secretName: webhook-server-cert diff --git a/common-controller/internal/operator/config/default/webhookcainjection_patch.yaml b/common-controller/internal/operator/config/default/webhookcainjection_patch.yaml new file mode 100644 index 000000000..bf002d361 --- /dev/null +++ b/common-controller/internal/operator/config/default/webhookcainjection_patch.yaml @@ -0,0 +1,29 @@ +# This patch add annotation to admission webhook config and +# CERTIFICATE_NAMESPACE and CERTIFICATE_NAME will be substituted by kustomize +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + labels: + app.kubernetes.io/name: mutatingwebhookconfiguration + app.kubernetes.io/instance: mutating-webhook-configuration + app.kubernetes.io/component: webhook + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: mutating-webhook-configuration + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME +--- +apiVersion: admissionregistration.k8s.io/v1 +kind: ValidatingWebhookConfiguration +metadata: + labels: + app.kubernetes.io/name: validatingwebhookconfiguration + app.kubernetes.io/instance: validating-webhook-configuration + app.kubernetes.io/component: webhook + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: validating-webhook-configuration + annotations: + cert-manager.io/inject-ca-from: CERTIFICATE_NAMESPACE/CERTIFICATE_NAME diff --git a/common-controller/internal/operator/config/rbac/dp_api_editor_role.yaml b/common-controller/internal/operator/config/rbac/dp_api_editor_role.yaml new file mode 100644 index 000000000..2de3070c5 --- /dev/null +++ b/common-controller/internal/operator/config/rbac/dp_api_editor_role.yaml @@ -0,0 +1,31 @@ +# permissions for end users to edit apis. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: api-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: api-editor-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - apis + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - dp.wso2.com + resources: + - apis/status + verbs: + - get diff --git a/common-controller/internal/operator/config/rbac/dp_api_viewer_role.yaml b/common-controller/internal/operator/config/rbac/dp_api_viewer_role.yaml new file mode 100644 index 000000000..75e4c488a --- /dev/null +++ b/common-controller/internal/operator/config/rbac/dp_api_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view apis. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: api-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: api-viewer-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - apis + verbs: + - get + - list + - watch +- apiGroups: + - dp.wso2.com + resources: + - apis/status + verbs: + - get diff --git a/common-controller/internal/operator/config/samples/dp_v1alpha2_api.yaml b/common-controller/internal/operator/config/samples/dp_v1alpha2_api.yaml new file mode 100644 index 000000000..d7c9ebcb5 --- /dev/null +++ b/common-controller/internal/operator/config/samples/dp_v1alpha2_api.yaml @@ -0,0 +1,12 @@ +apiVersion: dp.wso2.com/v1alpha2 +kind: API +metadata: + labels: + app.kubernetes.io/name: api + app.kubernetes.io/instance: api-sample + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: operator + name: api-sample +spec: + # TODO(user): Add fields here diff --git a/common-controller/internal/operator/config/samples/kustomization.yaml b/common-controller/internal/operator/config/samples/kustomization.yaml index 21aa5398a..afdee71b4 100644 --- a/common-controller/internal/operator/config/samples/kustomization.yaml +++ b/common-controller/internal/operator/config/samples/kustomization.yaml @@ -1,4 +1,5 @@ ## Append samples of your project ## resources: - dp_v1alpha1_ratelimitpolicy.yaml +- dp_v1alpha2_api.yaml #+kubebuilder:scaffold:manifestskustomizesamples diff --git a/common-controller/internal/operator/config/webhook/kustomization.yaml b/common-controller/internal/operator/config/webhook/kustomization.yaml new file mode 100644 index 000000000..9cf26134e --- /dev/null +++ b/common-controller/internal/operator/config/webhook/kustomization.yaml @@ -0,0 +1,6 @@ +resources: +- manifests.yaml +- service.yaml + +configurations: +- kustomizeconfig.yaml diff --git a/common-controller/internal/operator/config/webhook/kustomizeconfig.yaml b/common-controller/internal/operator/config/webhook/kustomizeconfig.yaml new file mode 100644 index 000000000..206316e54 --- /dev/null +++ b/common-controller/internal/operator/config/webhook/kustomizeconfig.yaml @@ -0,0 +1,22 @@ +# the following config is for teaching kustomize where to look at when substituting nameReference. +# It requires kustomize v2.1.0 or newer to work properly. +nameReference: +- kind: Service + version: v1 + fieldSpecs: + - kind: MutatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/name + - kind: ValidatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/name + +namespace: +- kind: MutatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/namespace + create: true +- kind: ValidatingWebhookConfiguration + group: admissionregistration.k8s.io + path: webhooks/clientConfig/service/namespace + create: true diff --git a/common-controller/internal/operator/config/webhook/manifests.yaml b/common-controller/internal/operator/config/webhook/manifests.yaml index fda9cdbc9..f131a3420 100644 --- a/common-controller/internal/operator/config/webhook/manifests.yaml +++ b/common-controller/internal/operator/config/webhook/manifests.yaml @@ -10,14 +10,14 @@ webhooks: service: name: webhook-service namespace: system - path: /mutate-dp-wso2-com-v1alpha1-api + path: /mutate-dp-wso2-com-v1alpha2-api failurePolicy: Fail name: mapi.kb.io rules: - apiGroups: - dp.wso2.com apiVersions: - - v1alpha1 + - v1alpha2 operations: - CREATE - UPDATE @@ -136,14 +136,14 @@ webhooks: service: name: webhook-service namespace: system - path: /validate-dp-wso2-com-v1alpha1-api + path: /validate-dp-wso2-com-v1alpha2-api failurePolicy: Fail name: vapi.kb.io rules: - apiGroups: - dp.wso2.com apiVersions: - - v1alpha1 + - v1alpha2 operations: - CREATE - UPDATE diff --git a/common-controller/internal/operator/config/webhook/service.yaml b/common-controller/internal/operator/config/webhook/service.yaml new file mode 100644 index 000000000..3d52bb199 --- /dev/null +++ b/common-controller/internal/operator/config/webhook/service.yaml @@ -0,0 +1,20 @@ + +apiVersion: v1 +kind: Service +metadata: + labels: + app.kubernetes.io/name: service + app.kubernetes.io/instance: webhook-service + app.kubernetes.io/component: webhook + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: webhook-service + namespace: system +spec: + ports: + - port: 443 + protocol: TCP + targetPort: 9443 + selector: + control-plane: controller-manager diff --git a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go index 0205fa979..9ab2f3dc3 100644 --- a/common-controller/internal/operator/controller/ratelimitpolicy_controller.go +++ b/common-controller/internal/operator/controller/ratelimitpolicy_controller.go @@ -45,7 +45,8 @@ import ( cache "github.com/wso2/apk/common-controller/internal/cache" "github.com/wso2/apk/common-controller/internal/config" loggers "github.com/wso2/apk/common-controller/internal/loggers" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2" constants "github.com/wso2/apk/common-controller/internal/operator/constant" xds "github.com/wso2/apk/common-controller/internal/xds" ) @@ -87,7 +88,7 @@ func NewratelimitController(mgr manager.Manager, ratelimitStore *cache.Ratelimit conf := config.ReadConfigs() predicates := []predicate.Predicate{predicate.NewPredicateFuncs(FilterByNamespaces(conf.CommonController.Operator.Namespaces))} - if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha1.API{}), + if err := c.Watch(source.Kind(mgr.GetCache(), &dpv1alpha2.API{}), handler.EnqueueRequestsFromMapFunc(ratelimitReconsiler.getRatelimitForAPI), predicates...); err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2611, logging.BLOCKER, "Error watching API resources: %v", err)) @@ -171,7 +172,7 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) Reconcile(ctx context.Cont } func (ratelimitReconsiler *RateLimitPolicyReconciler) getRatelimitForAPI(ctx context.Context, obj k8client.Object) []reconcile.Request { - api, ok := obj.(*dpv1alpha1.API) + api, ok := obj.(*dpv1alpha2.API) if !ok { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2622, logging.TRIVIAL, "Unexpected object type, bypassing reconciliation: %v", api)) @@ -240,7 +241,7 @@ func (ratelimitReconsiler *RateLimitPolicyReconciler) marshelRateLimit(ctx conte ratelimitPolicy dpv1alpha1.RateLimitPolicy) ([]dpv1alpha1.ResolveRateLimitAPIPolicy, error) { policyList := []dpv1alpha1.ResolveRateLimitAPIPolicy{} - var api dpv1alpha1.API + var api dpv1alpha2.API if err := ratelimitReconsiler.client.Get(ctx, types.NamespacedName{ Namespace: ratelimitKey.Namespace, diff --git a/common-controller/internal/operator/controller/suite_test.go b/common-controller/internal/operator/controller/suite_test.go index da4387e3e..cddbedb23 100644 --- a/common-controller/internal/operator/controller/suite_test.go +++ b/common-controller/internal/operator/controller/suite_test.go @@ -30,7 +30,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" //+kubebuilder:scaffold:imports ) diff --git a/common-controller/internal/operator/hack/boilerplate.go.txt b/common-controller/internal/operator/hack/boilerplate.go.txt index 4d1df243d..c32be1a39 100644 --- a/common-controller/internal/operator/hack/boilerplate.go.txt +++ b/common-controller/internal/operator/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common-controller/internal/operator/operator.go b/common-controller/internal/operator/operator.go index c512b71ef..f241cbfb6 100644 --- a/common-controller/internal/operator/operator.go +++ b/common-controller/internal/operator/operator.go @@ -26,8 +26,6 @@ import ( "github.com/wso2/apk/adapter/pkg/logging" cache "github.com/wso2/apk/common-controller/internal/cache" "github.com/wso2/apk/common-controller/internal/loggers" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" - dpcontrollers "github.com/wso2/apk/common-controller/internal/operator/controller" "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" @@ -35,6 +33,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/healthz" "sigs.k8s.io/controller-runtime/pkg/log/zap" gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1beta1" + + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2" + dpcontrollers "github.com/wso2/apk/common-controller/internal/operator/controller" //+kubebuilder:scaffold:imports ) @@ -47,6 +49,7 @@ func init() { utilruntime.Must(clientgoscheme.AddToScheme(scheme)) utilruntime.Must(gwapiv1b1.AddToScheme(scheme)) utilruntime.Must(dpv1alpha1.AddToScheme(scheme)) + utilruntime.Must(dpv1alpha2.AddToScheme(scheme)) //+kubebuilder:scaffold:scheme } @@ -97,6 +100,11 @@ func InitOperator() { "Unable to create webhook API, error: %v", err)) } + if err = (&dpv1alpha2.API{}).SetupWebhookWithManager(mgr); err != nil { + loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2601, logging.MAJOR, + "Unable to create webhook API, error: %v", err)) + } + if err = (&dpv1alpha1.RateLimitPolicy{}).SetupWebhookWithManager(mgr); err != nil { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2637, logging.MAJOR, "Unable to create webhook for Ratelimit, error: %v", err)) diff --git a/common-controller/internal/xds/ratelimiter_cache.go b/common-controller/internal/xds/ratelimiter_cache.go index a540cbc16..b9193f6ec 100644 --- a/common-controller/internal/xds/ratelimiter_cache.go +++ b/common-controller/internal/xds/ratelimiter_cache.go @@ -30,7 +30,7 @@ import ( logger "github.com/sirupsen/logrus" "github.com/wso2/apk/adapter/pkg/logging" "github.com/wso2/apk/common-controller/internal/loggers" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" constants "github.com/wso2/apk/common-controller/internal/operator/constant" ) diff --git a/common-controller/internal/xds/server.go b/common-controller/internal/xds/server.go index 5ed7d9960..1f105aa25 100644 --- a/common-controller/internal/xds/server.go +++ b/common-controller/internal/xds/server.go @@ -23,7 +23,7 @@ import ( corev3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3" envoy_cachev3 "github.com/envoyproxy/go-control-plane/pkg/cache/v3" - dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/apis/dp/v1alpha1" + dpv1alpha1 "github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1" ) const ( diff --git a/helm-charts/crds/dp.wso2.com_apis.yaml b/helm-charts/crds/dp.wso2.com_apis.yaml index 77406468b..1da03bb32 100644 --- a/helm-charts/crds/dp.wso2.com_apis.yaml +++ b/helm-charts/crds/dp.wso2.com_apis.yaml @@ -32,6 +32,178 @@ spec: name: Age type: date name: v1alpha1 + schema: + openAPIV3Schema: + description: API is the Schema for the apis API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: APISpec defines the desired state of API + properties: + apiName: + description: APIName is the unique name of the API can be used to + uniquely identify an API. + maxLength: 60 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&$\[\]\/]*$ + type: string + apiProperties: + description: APIProperties denotes the custom properties of the API. + items: + description: Property holds key value pair of APIProperties + properties: + name: + type: string + value: + type: string + type: object + nullable: true + type: array + apiType: + description: APIType denotes the type of the API. Possible values + could be REST, GraphQL, Async + enum: + - REST + type: string + apiVersion: + description: APIVersion is the version number of the API. + maxLength: 30 + minLength: 1 + pattern: ^[^~!@#;:%^*()+={}|\<>"'',&/$\[\]\s+\/]+$ + type: string + basePath: + description: 'BasePath denotes the basepath of the API. e.g: /pet-store-api/1.0.6' + pattern: ^[/][a-zA-Z0-9~/_.-]*$ + type: string + definitionFileRef: + description: DefinitionFileRef contains the OpenAPI 3 or Swagger definition + of the API in a ConfigMap. + type: string + definitionPath: + default: /api-definition + description: DefinitionPath contains the path to expose the API definition. + minLength: 1 + type: string + isDefaultVersion: + description: IsDefaultVersion indicates whether this API version should + be used as a default API + type: boolean + organization: + description: Organization denotes the organization. related to the + API + type: string + production: + description: 'Production contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + sandbox: + description: 'Sandbox contains a list of references to HttpRoutes + of type HttpRoute. xref: https://github.com/kubernetes-sigs/gateway-api/blob/main/apis/v1beta1/httproute_types.go' + items: + description: EnvConfig contains the environment specific configuration + properties: + httpRouteRefs: + description: HTTPRouteRefs denotes the environment of the API. + items: + type: string + type: array + required: + - httpRouteRefs + type: object + maxItems: 1 + nullable: true + type: array + systemAPI: + description: SystemAPI denotes if it is an internal system API. + type: boolean + required: + - apiName + - apiType + - apiVersion + - basePath + - definitionPath + type: object + status: + description: APIStatus defines the observed state of API + properties: + deploymentStatus: + description: DeploymentStatus denotes the deployment status of the + API + properties: + accepted: + description: Accepted represents whether the API is accepted or + not. + type: boolean + events: + description: Events contains a list of events related to the API. + items: + type: string + type: array + message: + description: Message represents a user friendly message that explains + the current state of the API. + type: string + status: + description: Status denotes the state of the API in its lifecycle. + Possible values could be Accepted, Invalid, Deploy etc. + type: string + transitionTime: + description: TransitionTime represents the last known transition + timestamp. + format: date-time + type: string + required: + - accepted + - status + - transitionTime + type: object + type: object + type: object + served: true + storage: false + subresources: + status: {} + - additionalPrinterColumns: + - jsonPath: .spec.apiName + name: API Name + type: string + - jsonPath: .spec.apiVersion + name: Version + type: string + - jsonPath: .spec.basePath + name: BasePath + type: string + - jsonPath: .spec.organization + name: Organization + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 schema: openAPIV3Schema: description: API is the Schema for the apis API @@ -96,8 +268,7 @@ spec: minLength: 1 type: string environment: - description: Environment denotes the environment of the API. This - is a virtual environment on top of the segmented gateway. + description: Environment denotes the environment of the API. nullable: true type: string isDefaultVersion: diff --git a/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-mutating-webhook-config.yaml b/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-mutating-webhook-config.yaml index 605b5e3a9..f8a52b741 100644 --- a/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-mutating-webhook-config.yaml +++ b/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-mutating-webhook-config.yaml @@ -29,14 +29,14 @@ webhooks: service: name: {{ template "apk-helm.resource.prefix" . }}-common-controller-service namespace: {{ .Release.Namespace }} - path: /mutate-dp-wso2-com-v1alpha1-api + path: /mutate-dp-wso2-com-v1alpha2-api failurePolicy: Fail name: mapi.kb.io rules: - apiGroups: - dp.wso2.com apiVersions: - - v1alpha1 + - v1alpha2 operations: - CREATE - UPDATE diff --git a/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-validation-webhook-config.yaml b/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-validation-webhook-config.yaml index b80e61065..a91d74199 100644 --- a/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-validation-webhook-config.yaml +++ b/helm-charts/templates/data-plane/gateway-components/common-controller/webhook/adapter-validation-webhook-config.yaml @@ -49,14 +49,14 @@ webhooks: service: name: {{ template "apk-helm.resource.prefix" . }}-common-controller-service namespace: {{ .Release.Namespace }} - path: /validate-dp-wso2-com-v1alpha1-api + path: /validate-dp-wso2-com-v1alpha2-api failurePolicy: Fail name: vapi.kb.io rules: - apiGroups: - dp.wso2.com apiVersions: - - v1alpha1 + - v1alpha2 operations: - CREATE - UPDATE diff --git a/runtime/config-deployer-service/ballerina/K8sClient.bal b/runtime/config-deployer-service/ballerina/K8sClient.bal index d673b97f3..744b28254 100644 --- a/runtime/config-deployer-service/ballerina/K8sClient.bal +++ b/runtime/config-deployer-service/ballerina/K8sClient.bal @@ -56,7 +56,7 @@ isolated function getConfigMapValueFromNameAndNamespace(string name, string name } isolated function deleteAPICR(string name, string namespace) returns http:Response|http:ClientError { - string endpoint = "/apis/dp.wso2.com/v1alpha1/namespaces/" + namespace + "/apis/" + name; + string endpoint = "/apis/dp.wso2.com/v1alpha2/namespaces/" + namespace + "/apis/" + name; return k8sApiServerEp->delete(endpoint, targetType = http:Response); } @@ -99,12 +99,12 @@ isolated function deleteConfigMap(string name, string namespace) returns http:Re } isolated function deployAPICR(model:API api, string namespace) returns http:Response|http:ClientError { - string endpoint = "/apis/dp.wso2.com/v1alpha1/namespaces/" + namespace + "/apis"; + string endpoint = "/apis/dp.wso2.com/v1alpha2/namespaces/" + namespace + "/apis"; return k8sApiServerEp->post(endpoint, api, targetType = http:Response); } isolated function updateAPICR(model:API api, string namespace) returns http:Response|http:ClientError { - string endpoint = "/apis/dp.wso2.com/v1alpha1/namespaces/" + namespace + "/apis/" + api.metadata.name; + string endpoint = "/apis/dp.wso2.com/v1alpha2/namespaces/" + namespace + "/apis/" + api.metadata.name; return k8sApiServerEp->put(endpoint, api, targetType = http:Response); } @@ -129,7 +129,7 @@ isolated function updateHttpRoute(model:Httproute httproute, string namespace) r } public isolated function getK8sAPIByNameAndNamespace(string name, string namespace) returns model:API?|commons:APKError { - string endpoint = "/apis/dp.wso2.com/v1alpha1/namespaces/" + namespace + "/apis/" + name; + string endpoint = "/apis/dp.wso2.com/v1alpha2/namespaces/" + namespace + "/apis/" + name; do { http:Response response = check k8sApiServerEp->get(endpoint); if response.statusCode == 200 { diff --git a/runtime/config-deployer-service/ballerina/modules/model/API.bal b/runtime/config-deployer-service/ballerina/modules/model/API.bal index 1f71e6430..b0510e540 100644 --- a/runtime/config-deployer-service/ballerina/modules/model/API.bal +++ b/runtime/config-deployer-service/ballerina/modules/model/API.bal @@ -18,7 +18,7 @@ public type API record { string kind = "API"; - string apiVersion = "dp.wso2.com/v1alpha1"; + string apiVersion = "dp.wso2.com/v1alpha2"; Metadata metadata; APISpec spec; APIStatus? status = (); @@ -62,7 +62,7 @@ public type EnvConfig record { }; public type APIList record { - string apiVersion = "dp.wso2.com/v1alpha1"; + string apiVersion = "dp.wso2.com/v1alpha2"; string kind = "APIList"; API[] items; ListMeta metadata; diff --git a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java index c19592166..6d7e446b5 100644 --- a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java +++ b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java @@ -229,7 +229,7 @@ public void waitForNextMinuteStrictly() throws InterruptedException { LocalDateTime now = LocalDateTime.now(); LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - Thread.sleep((secondsToWait+1) * 1000); + Thread.sleep((secondsToWait+2) * 1000); logger.info("Current time: " + LocalDateTime.now()); } From f959e8a4d286dced3c951218775f4fd23f63175d Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Sat, 21 Oct 2023 19:30:38 +0530 Subject: [PATCH 21/24] Updating integration tests for multi-envs --- common-controller/coverage.out | 258 +++++++++--------- .../operator/api/dp/v1alpha2/api_webhook.go | 7 - test/cucumber-tests/scripts/setup-hosts.sh | 1 + .../wso2/apk/integration/api/BaseSteps.java | 2 +- .../tests/api/MultiEnvironment.feature | 13 +- 5 files changed, 143 insertions(+), 138 deletions(-) diff --git a/common-controller/coverage.out b/common-controller/coverage.out index 9104190df..c2f3d6260 100644 --- a/common-controller/coverage.out +++ b/common-controller/coverage.out @@ -1,39 +1,43 @@ mode: atomic -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:61.2,66.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:45.43,47.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:52.40,54.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:58.37,60.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:71.58,89.43 13 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:92.2,96.40 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:99.2,102.37 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:105.2,110.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:65.82,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:70.64,75.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:77.47,80.24 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.2,89.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:94.2,94.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:80.24,81.54 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:30.39,36.2 5 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:39.32,40.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:43.2,45.12 3 0 @@ -345,6 +349,37 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_gener github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1139.40,1140.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1143.2,1145.12 3 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1140.15,1142.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:61.2,66.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:45.43,47.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:52.40,54.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:58.37,60.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:71.58,89.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:92.2,96.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:99.2,102.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:105.2,110.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:33.69,37.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:46.32,46.33 0 0 @@ -360,106 +395,8 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolic github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:75.107,78.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:79.22,83.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:88.66,91.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:65.82,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:70.64,75.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:77.47,80.24 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.2,89.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:94.2,94.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:80.24,81.54 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_types.go:194.13,196.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go:21.20,21.21 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_types.go:200.13,202.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:45.63,53.2 4 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:62.26,64.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:72.60,74.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:77.78,79.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:82.60,86.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:89.35,97.25 6 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:104.2,104.27 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:113.2,113.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:117.2,117.243 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:122.2,123.32 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:126.2,126.29 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.2,130.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.2,135.43 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:140.2,140.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:146.2,148.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:97.25,98.48 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:98.48,101.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:104.27,106.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:106.8,106.98 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:106.98,108.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.8,108.78 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.78,110.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:113.31,115.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:117.243,120.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:123.32,125.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:126.29,128.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.43,133.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.43,138.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:140.22,144.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:151.51,152.30 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:157.2,157.14 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:152.30,153.16 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:153.16,155.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:160.73,163.16 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:168.2,170.30 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:206.2,206.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:163.16,167.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:170.30,172.68 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:172.68,176.54 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:183.4,183.31 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:176.54,182.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:183.31,186.34 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:196.5,196.73 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:186.34,187.77 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:187.77,193.7 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:196.73,202.6 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:209.39,214.23 5 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:232.2,232.18 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:214.23,216.69 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:220.3,221.34 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:216.69,219.4 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:222.8,223.40 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:223.40,225.90 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:229.4,229.41 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:225.90,228.5 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:235.75,236.50 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:239.2,239.11 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:236.50,238.3 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:243.56,245.21 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:248.2,248.17 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:245.21,247.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:30.39,36.2 5 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:39.32,40.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:43.2,45.12 3 0 @@ -507,6 +444,69 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_gener github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:188.42,189.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:192.2,194.12 3 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:189.15,191.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go:21.20,21.21 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_types.go:200.13,202.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:45.63,51.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:60.26,62.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:70.60,72.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:75.78,77.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:80.60,84.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:87.35,92.25 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:99.2,99.27 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.2,108.31 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:112.2,112.243 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:117.2,118.32 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:121.2,121.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:125.2,125.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.2,130.43 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.2,135.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:141.2,141.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:92.25,93.48 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:93.48,96.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:99.27,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:101.8,101.98 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:101.98,103.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:103.8,103.78 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:103.78,105.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:108.31,110.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:112.243,115.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:118.32,120.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:121.29,123.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:125.43,128.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:130.43,133.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:135.22,139.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:144.51,145.30 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:150.2,150.14 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:145.30,146.16 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:146.16,148.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:153.73,156.16 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:161.2,163.30 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:199.2,199.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:156.16,160.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:163.30,165.68 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:165.68,169.54 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:176.4,176.31 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:169.54,175.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:176.31,179.34 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:189.5,189.73 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:179.34,180.77 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:180.77,186.7 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:189.73,195.6 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:202.39,207.23 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:225.2,225.18 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:207.23,209.69 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:213.3,214.34 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:209.69,212.4 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:215.8,216.40 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:216.40,218.90 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:222.4,222.41 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:218.90,221.5 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:228.75,229.50 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:232.2,232.11 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:229.50,231.3 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:236.56,238.21 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:241.2,241.17 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:238.21,240.3 1 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:69.98,76.45 3 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:81.2,82.16 2 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:88.2,92.106 3 0 diff --git a/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go index 6c05a6235..c2f297bbc 100644 --- a/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go +++ b/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go @@ -45,8 +45,6 @@ var c client.Client func (r *API) SetupWebhookWithManager(mgr ctrl.Manager) error { c = mgr.GetClient() - loggers.LoggerAPK.Infof("API validation Skipped for namespace v2222222 ---DDDD--: %v", r.Namespace) - loggers.LoggerAPK.Infof("API validation Skipped for namespace setup ---DDD--: %v", r.Namespace) return ctrl.NewWebhookManagedBy(mgr). For(r). Complete() @@ -88,9 +86,6 @@ func (r *API) ValidateDelete() (admission.Warnings, error) { // validateAPI validate api crd fields func (r *API) validateAPI() error { - loggers.LoggerAPK.Infof("API validation Skipped for namespace APPPPPPv2KKKK ---v2--: %v", r.Namespace) - loggers.LoggerAPK.Infof("API validation Skipped for namespace APPPPPPKKKK ---v2 new--: %v", r.TypeMeta.APIVersion) - var allErrs field.ErrorList conf := config.ReadConfigs() namespaces := conf.CommonController.Operator.Namespaces @@ -143,8 +138,6 @@ func (r *API) validateAPI() error { r.Name, allErrs) } - loggers.LoggerAPKOperator.Infof("End of APKKkk ---- test ---new : %v", r.Namespace) - loggers.LoggerAPKOperator.Infof("End of APKKkk ---- test ---new : %v", r) return nil } diff --git a/test/cucumber-tests/scripts/setup-hosts.sh b/test/cucumber-tests/scripts/setup-hosts.sh index abec38beb..3e11766fc 100644 --- a/test/cucumber-tests/scripts/setup-hosts.sh +++ b/test/cucumber-tests/scripts/setup-hosts.sh @@ -18,6 +18,7 @@ sudo echo "$IP org3.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org4.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default.sandbox.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP default-dev.gw.wso2.com" | sudo tee -a /etc/hosts +sudo echo "$IP default-qa.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org3-qa.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org4-qa.gw.wso2.com" | sudo tee -a /etc/hosts sudo echo "$IP org4-dev.gw.wso2.com" | sudo tee -a /etc/hosts diff --git a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java index 6d7e446b5..c19592166 100644 --- a/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java +++ b/test/cucumber-tests/src/test/java/org/wso2/apk/integration/api/BaseSteps.java @@ -229,7 +229,7 @@ public void waitForNextMinuteStrictly() throws InterruptedException { LocalDateTime now = LocalDateTime.now(); LocalDateTime nextMinute = now.plusMinutes(1).withSecond(0).withNano(0); long secondsToWait = now.until(nextMinute, ChronoUnit.SECONDS); - Thread.sleep((secondsToWait+2) * 1000); + Thread.sleep((secondsToWait+1) * 1000); logger.info("Current time: " + LocalDateTime.now()); } diff --git a/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature index d57664c83..7c49dd524 100644 --- a/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature +++ b/test/cucumber-tests/src/test/resources/tests/api/MultiEnvironment.feature @@ -44,7 +44,7 @@ Feature: Deploy APIs in multiple environments When I undeploy the API whose ID is "without-env-api" and organization "org4" Then the response status code should be 202 - Scenario: Deploying an API in Dev environment and token issuer has no environments. + Scenario: Deploying APIs in Dev and QA environments and token issuer has no environments. Given The system is ready And I have a valid subscription When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_dev.yaml" @@ -54,10 +54,21 @@ Feature: Deploy APIs in multiple environments Then I set headers |Authorization|bearer ${accessToken}| And I send "GET" request to "https://default-dev.gw.wso2.com:9095/multienv/3.14/employee/" with body "" + And I eventually receive 200 response code, not accepting + |429| + When I use the APK Conf file "artifacts/apk-confs/multi-env/employees_conf_qa.yaml" + And the definition file "artifacts/definitions/employees_api.json" + And make the API deployment request + Then the response status code should be 200 + Then I set headers + |Authorization|bearer ${accessToken}| + And I send "GET" request to "https://default-qa.gw.wso2.com:9095/multienv/3.14/employee/" with body "" And I eventually receive 200 response code, not accepting |429| When I undeploy the API whose ID is "multi-env-dev-api" Then the response status code should be 202 + When I undeploy the API whose ID is "multi-env-qa-api" + Then the response status code should be 202 Scenario: Deploying an API in QA environment and token issuer has all(*) environments. Given The system is ready From 8aa27841d44fc3e09c394da747614cebe0cf2f3b Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Sat, 21 Oct 2023 19:50:22 +0530 Subject: [PATCH 22/24] Fixing build failures --- .../apis/cp/v1alpha1/zz_generated.deepcopy.go | 2 +- .../apis/dp/v1alpha1/zz_generated.deepcopy.go | 2 +- common-controller/coverage.out | 182 +++++++++--------- .../SubscriptionDataStoreImpl.java | 1 + 4 files changed, 94 insertions(+), 93 deletions(-) diff --git a/adapter/internal/operator/apis/cp/v1alpha1/zz_generated.deepcopy.go b/adapter/internal/operator/apis/cp/v1alpha1/zz_generated.deepcopy.go index 8d1786434..3fcc395b8 100644 --- a/adapter/internal/operator/apis/cp/v1alpha1/zz_generated.deepcopy.go +++ b/adapter/internal/operator/apis/cp/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go index 154577d6a..bd61ec012 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2022, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/common-controller/coverage.out b/common-controller/coverage.out index c2f3d6260..f0b515d27 100644 --- a/common-controller/coverage.out +++ b/common-controller/coverage.out @@ -1,9 +1,4 @@ mode: atomic -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 @@ -16,28 +11,29 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:30.39,36.2 5 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:39.32,40.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:43.2,45.12 3 0 @@ -349,23 +345,6 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_gener github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1139.40,1140.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1143.2,1145.12 3 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1140.15,1142.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 @@ -380,7 +359,7 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conv github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:33.69,37.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:46.32,46.33 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:54.66,56.2 1 0 @@ -395,55 +374,29 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolic github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:75.107,78.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:79.22,83.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:88.66,91.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_types.go:194.13,196.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:30.39,36.2 5 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:39.32,40.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:43.2,45.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:40.15,42.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:49.48,50.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:53.2,53.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:50.34,52.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:57.47,61.21 4 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:61.21,64.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:64.22,66.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:71.40,72.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:75.2,77.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:72.15,74.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:81.52,82.34 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:85.2,85.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:82.34,84.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:89.47,91.26 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.2,98.23 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.2,105.29 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:91.26,94.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:94.22,96.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.23,101.22 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:101.22,103.4 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.29,109.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:113.40,114.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:117.2,119.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:114.15,116.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:123.51,126.2 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:129.44,130.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:133.2,135.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:130.15,132.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:139.65,141.30 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.2,145.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:141.30,144.3 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.22,149.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:153.58,154.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:157.2,159.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:154.15,156.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:163.51,165.29 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:165.29,169.3 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:173.44,174.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:177.2,179.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:174.15,176.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:183.49,185.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:188.42,189.15 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:192.2,194.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:189.15,191.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go:21.20,21.21 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_types.go:200.13,202.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:45.63,51.2 2 0 @@ -507,6 +460,53 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webh github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:236.56,238.21 2 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:241.2,241.17 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:238.21,240.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:30.39,36.2 5 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:39.32,40.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:43.2,45.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:40.15,42.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:49.48,50.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:53.2,53.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:50.34,52.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:57.47,61.21 4 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:61.21,64.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:64.22,66.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:71.40,72.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:75.2,77.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:72.15,74.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:81.52,82.34 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:85.2,85.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:82.34,84.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:89.47,91.26 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.2,98.23 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.2,105.29 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:91.26,94.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:94.22,96.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:98.23,101.22 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:101.22,103.4 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:105.29,109.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:113.40,114.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:117.2,119.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:114.15,116.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:123.51,126.2 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:129.44,130.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:133.2,135.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:130.15,132.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:139.65,141.30 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.2,145.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:141.30,144.3 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:145.22,149.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:153.58,154.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:157.2,159.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:154.15,156.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:163.51,165.29 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:165.29,169.3 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:173.44,174.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:177.2,179.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:174.15,176.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:183.49,185.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:188.42,189.15 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:192.2,194.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/zz_generated.deepcopy.go:189.15,191.3 1 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:69.98,76.45 3 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:81.2,82.16 2 0 github.com/wso2/apk/common-controller/internal/operator/controller/ratelimitpolicy_controller.go:88.2,92.106 3 0 diff --git a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java index a6db55d51..f74061775 100644 --- a/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java +++ b/gateway/enforcer/org.wso2.apk.enforcer/src/main/java/org/wso2/apk/enforcer/subscription/SubscriptionDataStoreImpl.java @@ -49,6 +49,7 @@ import java.io.IOException; import java.security.cert.CertificateException; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; From bba085aed14eb6669175aec4f0def9f678a9a668 Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Sat, 21 Oct 2023 20:47:48 +0530 Subject: [PATCH 23/24] Fixing revive failure --- common-controller/coverage.out | 108 ++++++++++++++++----------------- common-controller/revive.toml | 2 +- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/common-controller/coverage.out b/common-controller/coverage.out index f0b515d27..d651655b8 100644 --- a/common-controller/coverage.out +++ b/common-controller/coverage.out @@ -1,4 +1,54 @@ mode: atomic +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:61.2,66.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:45.43,47.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:52.40,54.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:58.37,60.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:71.58,89.43 13 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:92.2,96.40 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:99.2,102.37 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:105.2,110.12 3 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_types.go:194.13,196.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:35.67,39.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:48.29,52.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:60.64,62.2 1 0 @@ -11,29 +61,15 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:81.54,82.44 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:82.44,85.5 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_webhook.go:89.22,93.3 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:28.78,32.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:41.41,41.42 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:49.75,52.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:55.93,58.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_webhook.go:61.75,64.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_types.go:138.13,140.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/custom_ratelimit_policy.go:32.94,40.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/interceptorservice_types.go:91.13,93.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_types.go:114.13,116.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:33.75,37.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:46.38,48.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:56.72,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:63.90,67.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:70.72,74.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:77.52,79.33 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:83.2,84.51 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.2,88.107 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.2,93.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:98.2,98.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:79.33,82.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:84.51,87.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:88.107,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/ratelimitpolicy_webhook.go:93.22,97.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:30.39,36.2 5 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:39.32,40.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:43.2,45.12 3 0 @@ -345,21 +381,8 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_gener github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1139.40,1140.15 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1143.2,1145.12 3 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/zz_generated.deepcopy.go:1140.15,1142.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:27.56,45.43 13 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:48.2,52.40 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:55.2,58.37 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:61.2,66.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:45.43,47.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:52.40,54.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:58.37,60.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:71.58,89.43 13 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:92.2,96.40 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:99.2,102.37 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:105.2,110.12 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:89.43,91.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:96.40,98.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_conversion.go:102.37,104.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_webhook.go:25.63,29.2 1 0 +github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:33.69,37.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:46.32,46.33 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:54.66,56.2 1 0 @@ -374,29 +397,6 @@ github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolic github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:75.107,78.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:79.22,83.3 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/apipolicy_webhook.go:88.66,91.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_types.go:109.13,111.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/api_types.go:194.13,196.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backend_types.go:280.13,282.2 1 1 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:34.70,38.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:47.33,49.2 0 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:57.67,60.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:63.85,66.2 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:68.48,71.31 3 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.2,97.22 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:102.2,102.12 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:71.31,73.18 2 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:74.14,75.55 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:78.16,79.65 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:82.15,83.60 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:86.15,87.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:90.15,91.67 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:75.55,77.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:79.65,81.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:83.60,85.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:87.67,89.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:91.67,93.5 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:97.22,101.3 1 0 -github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha1/backendjwt_webhook.go:106.67,109.2 1 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_conversion.go:21.20,21.21 0 0 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_types.go:200.13,202.2 1 1 github.com/wso2/apk/common-controller/internal/operator/api/dp/v1alpha2/api_webhook.go:45.63,51.2 2 0 diff --git a/common-controller/revive.toml b/common-controller/revive.toml index 7c070644d..d52be3ca3 100644 --- a/common-controller/revive.toml +++ b/common-controller/revive.toml @@ -8,7 +8,7 @@ warningCode = 0 [rule.context-as-argument] [rule.context-keys-type] [rule.dot-imports] -exclude = ["internal/operator/apis/dp/v1alpha1/webhook_suite_test.go", "internal/operator/controller/suite_test.go"] +exclude = ["internal/operator/api/dp/v1alpha1/webhook_suite_test.go", "internal/operator/controller/suite_test.go", "internal/operator/api/dp/v1alpha2/webhook_suite_test.go"] [rule.error-return] [rule.error-strings] [rule.error-naming] From c3b98963318ec17d4761f3fbcfc4ffc8a50953dc Mon Sep 17 00:00:00 2001 From: Pubudu Gunatilaka Date: Sun, 22 Oct 2023 19:53:12 +0530 Subject: [PATCH 24/24] Adding TokenIssuer v1alpha2 version --- adapter/internal/operator/PROJECT | 8 + .../apis/dp/v1alpha1/tokenIssuer_types.go | 6 - .../dp/v1alpha1/tokenissuer_conversion.go | 144 ++++++++++++ .../apis/dp/v1alpha1/zz_generated.deepcopy.go | 5 - .../dp/v1alpha2/tokenissuer_conversion.go | 21 ++ .../apis/dp/v1alpha2/tokenissuer_types.go | 151 ++++++++++++ .../apis/dp/v1alpha2/zz_generated.deepcopy.go | 219 ++++++++++++++++++ .../crd/bases/dp.wso2.com_tokenissuers.yaml | 203 ++++++++++++++++ .../operator/config/crd/kustomization.yaml | 2 + .../cainjection_in_dp_tokenissuers.yaml | 7 + .../rbac/dp_tokenissuer_editor_role.yaml | 31 +++ .../rbac/dp_tokenissuer_viewer_role.yaml | 27 +++ .../samples/dp_v1alpha2_tokenissuer.yaml | 12 + .../controllers/dp/tokenissuer_controller.go | 29 ++- adapter/internal/operator/utils/utils.go | 9 + .../crds/dp.wso2.com_tokenissuers.yaml | 203 ++++++++++++++++ test/cucumber-tests/CRs/artifacts.yaml | 4 +- 17 files changed, 1064 insertions(+), 17 deletions(-) create mode 100644 adapter/internal/operator/apis/dp/v1alpha1/tokenissuer_conversion.go create mode 100644 adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_conversion.go create mode 100644 adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_types.go create mode 100644 adapter/internal/operator/config/crd/patches/cainjection_in_dp_tokenissuers.yaml create mode 100644 adapter/internal/operator/config/rbac/dp_tokenissuer_editor_role.yaml create mode 100644 adapter/internal/operator/config/rbac/dp_tokenissuer_viewer_role.yaml create mode 100644 adapter/internal/operator/config/samples/dp_v1alpha2_tokenissuer.yaml diff --git a/adapter/internal/operator/PROJECT b/adapter/internal/operator/PROJECT index 20893575b..04d0992dc 100644 --- a/adapter/internal/operator/PROJECT +++ b/adapter/internal/operator/PROJECT @@ -143,4 +143,12 @@ resources: kind: API path: github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2 version: v1alpha2 +- api: + crdVersion: v1 + namespaced: true + domain: wso2.com + group: dp + kind: TokenIssuer + path: github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2 + version: v1alpha2 version: "3" diff --git a/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go b/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go index 1aeeb7959..9c20f4919 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/tokenIssuer_types.go @@ -62,12 +62,6 @@ type TokenIssuerSpec struct { // TargetRef denotes the reference to the which gateway it applies to TargetRef *gwapiv1b1.PolicyTargetReference `json:"targetRef,omitempty"` - - // Environments denotes the environments that are applicable for the token issuer. - // - // +optional - // +nullable - Environments []string `json:"environments,omitempty"` } // ClaimMapping defines the reference configuration diff --git a/adapter/internal/operator/apis/dp/v1alpha1/tokenissuer_conversion.go b/adapter/internal/operator/apis/dp/v1alpha1/tokenissuer_conversion.go new file mode 100644 index 000000000..481e51a47 --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha1/tokenissuer_conversion.go @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha1 + +import ( + "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" + "sigs.k8s.io/controller-runtime/pkg/conversion" +) + +// ConvertTo converts this TokenIssuer CR to the Hub version (v1alpha2). +// src is v1alpha1.TokenIssuer and dst is v1alpha2.TokenIssuer. +func (src *TokenIssuer) ConvertTo(dstRaw conversion.Hub) error { + + dst := dstRaw.(*v1alpha2.TokenIssuer) + dst.ObjectMeta = src.ObjectMeta + + // Spec + dst.Spec.Name = src.Spec.Name + dst.Spec.Organization = src.Spec.Organization + dst.Spec.Issuer = src.Spec.Issuer + dst.Spec.ConsumerKeyClaim = src.Spec.ConsumerKeyClaim + dst.Spec.ScopesClaim = src.Spec.ScopesClaim + + sig := *src.Spec.SignatureValidation + jwks := *sig.JWKS + certificate := *sig.Certificate + + jwksv2 := v1alpha2.JWKS{ + URL: jwks.URL, + TLS: &v1alpha2.CERTConfig{ + CertificateInline: jwks.TLS.CertificateInline, + SecretRef: &v1alpha2.RefConfig{ + Name: jwks.TLS.SecretRef.Name, + Key: jwks.TLS.SecretRef.Key, + }, + ConfigMapRef: &v1alpha2.RefConfig{ + Name: jwks.TLS.ConfigMapRef.Name, + Key: jwks.TLS.ConfigMapRef.Key, + }, + }, + } + + certv2 := v1alpha2.CERTConfig{ + CertificateInline: certificate.CertificateInline, + SecretRef: &v1alpha2.RefConfig{ + Name: certificate.SecretRef.Name, + Key: certificate.SecretRef.Key, + }, + ConfigMapRef: &v1alpha2.RefConfig{ + Name: certificate.ConfigMapRef.Name, + Key: certificate.ConfigMapRef.Key, + }, + } + + dst.Spec.SignatureValidation = &v1alpha2.SignatureValidation{ + JWKS: &jwksv2, + Certificate: &certv2, + } + + var claimMappings []v1alpha2.ClaimMapping + for _, p := range *src.Spec.ClaimMappings { + claimMappings = append(claimMappings, v1alpha2.ClaimMapping(p)) + } + dst.Spec.ClaimMappings = &claimMappings + + dst.Spec.TargetRef = src.Spec.TargetRef + return nil +} + +// ConvertFrom converts from the Hub version (v1alpha2) to this version. +// src is v1alpha1.TokenIssuer and dst is v1alpha2.TokenIssuer. +func (src *TokenIssuer) ConvertFrom(srcRaw conversion.Hub) error { + + dst := srcRaw.(*v1alpha2.TokenIssuer) + src.ObjectMeta = dst.ObjectMeta + + // Spec + src.Spec.Name = dst.Spec.Name + src.Spec.Organization = dst.Spec.Organization + src.Spec.Issuer = dst.Spec.Issuer + src.Spec.ConsumerKeyClaim = dst.Spec.ConsumerKeyClaim + src.Spec.ScopesClaim = dst.Spec.ScopesClaim + + sig := *dst.Spec.SignatureValidation + jwks := *sig.JWKS + certificate := *sig.Certificate + + jwksv1 := JWKS{ + URL: jwks.URL, + TLS: &CERTConfig{ + CertificateInline: jwks.TLS.CertificateInline, + SecretRef: &RefConfig{ + Name: jwks.TLS.SecretRef.Name, + Key: jwks.TLS.SecretRef.Key, + }, + ConfigMapRef: &RefConfig{ + Name: jwks.TLS.ConfigMapRef.Name, + Key: jwks.TLS.ConfigMapRef.Key, + }, + }, + } + + certv1 := CERTConfig{ + CertificateInline: certificate.CertificateInline, + SecretRef: &RefConfig{ + Name: certificate.SecretRef.Name, + Key: certificate.SecretRef.Key, + }, + ConfigMapRef: &RefConfig{ + Name: certificate.ConfigMapRef.Name, + Key: certificate.ConfigMapRef.Key, + }, + } + + src.Spec.SignatureValidation = &SignatureValidation{ + JWKS: &jwksv1, + Certificate: &certv1, + } + + var claimMappings []ClaimMapping + for _, p := range *dst.Spec.ClaimMappings { + claimMappings = append(claimMappings, ClaimMapping(p)) + } + src.Spec.ClaimMappings = &claimMappings + + src.Spec.TargetRef = dst.Spec.TargetRef + + return nil +} diff --git a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go index bd61ec012..d70d020d7 100644 --- a/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go +++ b/adapter/internal/operator/apis/dp/v1alpha1/zz_generated.deepcopy.go @@ -1732,11 +1732,6 @@ func (in *TokenIssuerSpec) DeepCopyInto(out *TokenIssuerSpec) { *out = new(v1alpha2.PolicyTargetReference) (*in).DeepCopyInto(*out) } - if in.Environments != nil { - in, out := &in.Environments, &out.Environments - *out = make([]string, len(*in)) - copy(*out, *in) - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuerSpec. diff --git a/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_conversion.go b/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_conversion.go new file mode 100644 index 000000000..52742c4ef --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_conversion.go @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +// Hub marks this type as a conversion hub. +func (*TokenIssuer) Hub() {} diff --git a/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_types.go b/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_types.go new file mode 100644 index 000000000..1a382fcdf --- /dev/null +++ b/adapter/internal/operator/apis/dp/v1alpha2/tokenissuer_types.go @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package v1alpha2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + gwapiv1b1 "sigs.k8s.io/gateway-api/apis/v1alpha2" +) + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// TokenIssuerSpec defines the desired state of TokenIssuer +type TokenIssuerSpec struct { + // Name is the unique name of the Token Issuer in + // the Organization defined . "Organization/Name" can + // be used to uniquely identify an Issuer. + // + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Organization denotes the organization of the Token Issuer. + // + // +kubebuilder:validation:MinLength=1 + Organization string `json:"organization"` + + // Issuer denotes the issuer of the Token Issuer. + // + // +kubebuilder:validation:MinLength=1 + Issuer string `json:"issuer"` + + // ConsumerKeyClaim denotes the claim key of the consumer key. + // + // +kubebuilder:validation:MinLength=1 + ConsumerKeyClaim string `json:"consumerKeyClaim"` + + // ScopesClaim denotes the claim key of the scopes. + // + // +kubebuilder:validation:MinLength=1 + ScopesClaim string `json:"scopesClaim"` + + // SignatureValidation denotes the signature validation method of jwt + SignatureValidation *SignatureValidation `json:"signatureValidation"` + + // ClaimMappings denotes the claim mappings of the jwt + ClaimMappings *[]ClaimMapping `json:"claimMappings,omitempty"` + + // TargetRef denotes the reference to the which gateway it applies to + TargetRef *gwapiv1b1.PolicyTargetReference `json:"targetRef,omitempty"` + + // Environments denotes the environments that are applicable for the token issuer. + // + // +optional + // +nullable + Environments []string `json:"environments,omitempty"` +} + +// ClaimMapping defines the reference configuration +type ClaimMapping struct { + // RemoteClaim denotes the remote claim + RemoteClaim string `json:"remoteClaim"` + // LocalClaim denotes the local claim + LocalClaim string `json:"localClaim"` +} + +// SignatureValidation defines the signature validation method +type SignatureValidation struct { + // JWKS denotes the JWKS endpoint information + JWKS *JWKS `json:"jwks,omitempty"` + // Certificate denotes the certificate information + Certificate *CERTConfig `json:"certificate,omitempty"` +} + +// JWKS defines the JWKS endpoint +type JWKS struct { + // URL is the URL of the JWKS endpoint + URL string `json:"url"` + // TLS denotes the TLS configuration of the JWKS endpoint + TLS *CERTConfig `json:"tls,omitempty"` +} + +// CERTConfig defines the certificate configuration +type CERTConfig struct { + // CertificateInline is the Inline Certificate entry + CertificateInline *string `json:"certificateInline,omitempty"` + // SecretRef denotes the reference to the Secret that contains the Certificate + SecretRef *RefConfig `json:"secretRef,omitempty"` + // ConfigMapRef denotes the reference to the ConfigMap that contains the Certificate + ConfigMapRef *RefConfig `json:"configMapRef,omitempty"` +} + +// RefConfig holds a config for a secret or a configmap +type RefConfig struct { + // Name of the secret or configmap + // + // +kubebuilder:validation:MinLength=1 + Name string `json:"name"` + + // Key of the secret or configmap + // + // +kubebuilder:validation:MinLength=1 + Key string `json:"key"` +} + +// TokenIssuerStatus defines the observed state of TokenIssuer +type TokenIssuerStatus struct { + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster + // Important: Run "make" to regenerate code after modifying this file +} + +// +genclient +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status +//+kubebuilder:storageversion + +// TokenIssuer is the Schema for the tokenissuers API +type TokenIssuer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec TokenIssuerSpec `json:"spec,omitempty"` + Status TokenIssuerStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// TokenIssuerList contains a list of TokenIssuer +type TokenIssuerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TokenIssuer `json:"items"` +} + +func init() { + SchemeBuilder.Register(&TokenIssuer{}, &TokenIssuerList{}) +} diff --git a/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go b/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go index 278eb999a..566b24869 100644 --- a/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go +++ b/adapter/internal/operator/apis/dp/v1alpha2/zz_generated.deepcopy.go @@ -24,6 +24,7 @@ package v1alpha2 import ( runtime "k8s.io/apimachinery/pkg/runtime" + apisv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -135,6 +136,51 @@ func (in *APIStatus) DeepCopy() *APIStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CERTConfig) DeepCopyInto(out *CERTConfig) { + *out = *in + if in.CertificateInline != nil { + in, out := &in.CertificateInline, &out.CertificateInline + *out = new(string) + **out = **in + } + if in.SecretRef != nil { + in, out := &in.SecretRef, &out.SecretRef + *out = new(RefConfig) + **out = **in + } + if in.ConfigMapRef != nil { + in, out := &in.ConfigMapRef, &out.ConfigMapRef + *out = new(RefConfig) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CERTConfig. +func (in *CERTConfig) DeepCopy() *CERTConfig { + if in == nil { + return nil + } + out := new(CERTConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClaimMapping) DeepCopyInto(out *ClaimMapping) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClaimMapping. +func (in *ClaimMapping) DeepCopy() *ClaimMapping { + if in == nil { + return nil + } + out := new(ClaimMapping) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DeploymentStatus) DeepCopyInto(out *DeploymentStatus) { *out = *in @@ -179,6 +225,26 @@ func (in *EnvConfig) DeepCopy() *EnvConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *JWKS) DeepCopyInto(out *JWKS) { + *out = *in + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(CERTConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWKS. +func (in *JWKS) DeepCopy() *JWKS { + if in == nil { + return nil + } + out := new(JWKS) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Property) DeepCopyInto(out *Property) { *out = *in @@ -193,3 +259,156 @@ func (in *Property) DeepCopy() *Property { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RefConfig) DeepCopyInto(out *RefConfig) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RefConfig. +func (in *RefConfig) DeepCopy() *RefConfig { + if in == nil { + return nil + } + out := new(RefConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SignatureValidation) DeepCopyInto(out *SignatureValidation) { + *out = *in + if in.JWKS != nil { + in, out := &in.JWKS, &out.JWKS + *out = new(JWKS) + (*in).DeepCopyInto(*out) + } + if in.Certificate != nil { + in, out := &in.Certificate, &out.Certificate + *out = new(CERTConfig) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SignatureValidation. +func (in *SignatureValidation) DeepCopy() *SignatureValidation { + if in == nil { + return nil + } + out := new(SignatureValidation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenIssuer) DeepCopyInto(out *TokenIssuer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuer. +func (in *TokenIssuer) DeepCopy() *TokenIssuer { + if in == nil { + return nil + } + out := new(TokenIssuer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TokenIssuer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenIssuerList) DeepCopyInto(out *TokenIssuerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TokenIssuer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuerList. +func (in *TokenIssuerList) DeepCopy() *TokenIssuerList { + if in == nil { + return nil + } + out := new(TokenIssuerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TokenIssuerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenIssuerSpec) DeepCopyInto(out *TokenIssuerSpec) { + *out = *in + if in.SignatureValidation != nil { + in, out := &in.SignatureValidation, &out.SignatureValidation + *out = new(SignatureValidation) + (*in).DeepCopyInto(*out) + } + if in.ClaimMappings != nil { + in, out := &in.ClaimMappings, &out.ClaimMappings + *out = new([]ClaimMapping) + if **in != nil { + in, out := *in, *out + *out = make([]ClaimMapping, len(*in)) + copy(*out, *in) + } + } + if in.TargetRef != nil { + in, out := &in.TargetRef, &out.TargetRef + *out = new(apisv1alpha2.PolicyTargetReference) + (*in).DeepCopyInto(*out) + } + if in.Environments != nil { + in, out := &in.Environments, &out.Environments + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuerSpec. +func (in *TokenIssuerSpec) DeepCopy() *TokenIssuerSpec { + if in == nil { + return nil + } + out := new(TokenIssuerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TokenIssuerStatus) DeepCopyInto(out *TokenIssuerStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TokenIssuerStatus. +func (in *TokenIssuerStatus) DeepCopy() *TokenIssuerStatus { + if in == nil { + return nil + } + out := new(TokenIssuerStatus) + in.DeepCopyInto(out) + return out +} diff --git a/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml b/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml index 325ff1a2a..df170450a 100644 --- a/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml +++ b/adapter/internal/operator/config/crd/bases/dp.wso2.com_tokenissuers.yaml @@ -19,6 +19,209 @@ spec: schema: openAPIV3Schema: description: TokenIssuer is the Schema for the tokenIssuer API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: TokenIssuerSpec defines the desired state of TokenIssuer + properties: + claimMappings: + description: ClaimMappings denotes the claim mappings of the jwt + items: + description: ClaimMapping defines the reference configuration + properties: + localClaim: + description: LocalClaim denotes the local claim + type: string + remoteClaim: + description: RemoteClaim denotes the remote claim + type: string + required: + - localClaim + - remoteClaim + type: object + type: array + consumerKeyClaim: + description: ConsumerKeyClaim denotes the claim key of the consumer + key. + minLength: 1 + type: string + issuer: + description: Issuer denotes the issuer of the Token Issuer. + minLength: 1 + type: string + name: + description: Name is the unique name of the Token Issuer in the Organization + defined . "Organization/Name" can be used to uniquely identify an + Issuer. + minLength: 1 + type: string + organization: + description: Organization denotes the organization of the Token Issuer. + minLength: 1 + type: string + scopesClaim: + description: ScopesClaim denotes the claim key of the scopes. + minLength: 1 + type: string + signatureValidation: + description: SignatureValidation denotes the signature validation + method of jwt + properties: + certificate: + description: Certificate denotes the certificate information + properties: + certificateInline: + description: CertificateInline is the Inline Certificate entry + type: string + configMapRef: + description: ConfigMapRef denotes the reference to the ConfigMap + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + secretRef: + description: SecretRef denotes the reference to the Secret + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + type: object + jwks: + description: JWKS denotes the JWKS endpoint information + properties: + tls: + description: TLS denotes the TLS configuration of the JWKS + endpoint + properties: + certificateInline: + description: CertificateInline is the Inline Certificate + entry + type: string + configMapRef: + description: ConfigMapRef denotes the reference to the + ConfigMap that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + secretRef: + description: SecretRef denotes the reference to the Secret + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + type: object + url: + description: URL is the URL of the JWKS endpoint + type: string + required: + - url + type: object + type: object + targetRef: + description: TargetRef denotes the reference to the which gateway + it applies to + properties: + group: + description: Group is the group of the target resource. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the target resource. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the target resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: Namespace is the namespace of the referent. When + unspecified, the local namespace is inferred. Even when policy + targets a resource in a different namespace, it MUST only apply + to traffic originating from the same namespace as the policy. + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - group + - kind + - name + type: object + required: + - consumerKeyClaim + - issuer + - name + - organization + - scopesClaim + - signatureValidation + type: object + status: + description: TokenIssuerStatus defines the observed state of TokenIssuer + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: TokenIssuer is the Schema for the tokenissuers API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/adapter/internal/operator/config/crd/kustomization.yaml b/adapter/internal/operator/config/crd/kustomization.yaml index 3b66cea55..2a61fd5a0 100644 --- a/adapter/internal/operator/config/crd/kustomization.yaml +++ b/adapter/internal/operator/config/crd/kustomization.yaml @@ -13,6 +13,7 @@ resources: - bases/dp.wso2.com_interceptorservices.yaml - bases/dp.wso2.com_jwtissuers.yaml - bases/dp.wso2.com_backendjwts.yaml +- bases/dp.wso2.com_tokenissuers.yaml #+kubebuilder:scaffold:crdkustomizeresource patchesStrategicMerge: @@ -44,6 +45,7 @@ patchesStrategicMerge: #- patches/cainjection_in_interceptorservices.yaml #- patches/cainjection_in_jwtissuers.yaml #- patches/cainjection_in_backendjwts.yaml +#- patches/cainjection_in_tokenissuers.yaml #+kubebuilder:scaffold:crdkustomizecainjectionpatch # the following config is for teaching kustomize how to do kustomization for CRDs. diff --git a/adapter/internal/operator/config/crd/patches/cainjection_in_dp_tokenissuers.yaml b/adapter/internal/operator/config/crd/patches/cainjection_in_dp_tokenissuers.yaml new file mode 100644 index 000000000..0d2bd32a2 --- /dev/null +++ b/adapter/internal/operator/config/crd/patches/cainjection_in_dp_tokenissuers.yaml @@ -0,0 +1,7 @@ +# The following patch adds a directive for certmanager to inject CA into the CRD +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) + name: tokenissuers.dp.wso2.com diff --git a/adapter/internal/operator/config/rbac/dp_tokenissuer_editor_role.yaml b/adapter/internal/operator/config/rbac/dp_tokenissuer_editor_role.yaml new file mode 100644 index 000000000..f8f7a8f31 --- /dev/null +++ b/adapter/internal/operator/config/rbac/dp_tokenissuer_editor_role.yaml @@ -0,0 +1,31 @@ +# permissions for end users to edit tokenissuers. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: tokenissuer-editor-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: tokenissuer-editor-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - tokenissuers + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - dp.wso2.com + resources: + - tokenissuers/status + verbs: + - get diff --git a/adapter/internal/operator/config/rbac/dp_tokenissuer_viewer_role.yaml b/adapter/internal/operator/config/rbac/dp_tokenissuer_viewer_role.yaml new file mode 100644 index 000000000..35ba43c02 --- /dev/null +++ b/adapter/internal/operator/config/rbac/dp_tokenissuer_viewer_role.yaml @@ -0,0 +1,27 @@ +# permissions for end users to view tokenissuers. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + app.kubernetes.io/name: clusterrole + app.kubernetes.io/instance: tokenissuer-viewer-role + app.kubernetes.io/component: rbac + app.kubernetes.io/created-by: operator + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + name: tokenissuer-viewer-role +rules: +- apiGroups: + - dp.wso2.com + resources: + - tokenissuers + verbs: + - get + - list + - watch +- apiGroups: + - dp.wso2.com + resources: + - tokenissuers/status + verbs: + - get diff --git a/adapter/internal/operator/config/samples/dp_v1alpha2_tokenissuer.yaml b/adapter/internal/operator/config/samples/dp_v1alpha2_tokenissuer.yaml new file mode 100644 index 000000000..fead00d94 --- /dev/null +++ b/adapter/internal/operator/config/samples/dp_v1alpha2_tokenissuer.yaml @@ -0,0 +1,12 @@ +apiVersion: dp.wso2.com/v1alpha2 +kind: TokenIssuer +metadata: + labels: + app.kubernetes.io/name: tokenissuer + app.kubernetes.io/instance: tokenissuer-sample + app.kubernetes.io/part-of: operator + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: operator + name: tokenissuer-sample +spec: + # TODO(user): Add fields here diff --git a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go index bc60713ef..33f5da3df 100644 --- a/adapter/internal/operator/controllers/dp/tokenissuer_controller.go +++ b/adapter/internal/operator/controllers/dp/tokenissuer_controller.go @@ -25,6 +25,7 @@ import ( "github.com/wso2/apk/adapter/internal/discovery/xds" "github.com/wso2/apk/adapter/internal/loggers" dpv1alpha1 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha1" + dpv1alpha2 "github.com/wso2/apk/adapter/internal/operator/apis/dp/v1alpha2" "github.com/wso2/apk/adapter/internal/operator/constants" "github.com/wso2/apk/adapter/internal/operator/utils" "github.com/wso2/apk/adapter/pkg/discovery/api/wso2/discovery/subscription" @@ -205,7 +206,7 @@ func marshalJWTIssuerList(jwtIssuerMapping dpv1alpha1.JWTIssuerMapping) *subscri // getJWTIssuers returns the JWTIssuers for the given JWTIssuerMapping func getJWTIssuers(ctx context.Context, client k8client.Client, namespace types.NamespacedName) (dpv1alpha1.JWTIssuerMapping, error) { jwtIssuerMapping := make(dpv1alpha1.JWTIssuerMapping) - jwtIssuerList := &dpv1alpha1.TokenIssuerList{} + jwtIssuerList := &dpv1alpha2.TokenIssuerList{} if err := client.List(ctx, jwtIssuerList); err != nil { return nil, err } @@ -222,7 +223,17 @@ func getJWTIssuers(ctx context.Context, client k8client.Client, namespace types. jwks := &dpv1alpha1.ResolvedJWKS{} jwks.URL = jwtIssuer.Spec.SignatureValidation.JWKS.URL if jwtIssuer.Spec.SignatureValidation.JWKS.TLS != nil { - tlsCertificate, err := utils.ResolveCertificate(ctx, client, jwtIssuer.ObjectMeta.Namespace, *&jwtIssuer.Spec.SignatureValidation.JWKS.TLS.CertificateInline, *&jwtIssuer.Spec.SignatureValidation.JWKS.TLS.ConfigMapRef, *&jwtIssuer.Spec.SignatureValidation.JWKS.TLS.SecretRef) + + var tlsConfigMapRef *dpv1alpha1.RefConfig + var tlsSecretRef *dpv1alpha1.RefConfig + if jwtIssuer.Spec.SignatureValidation.JWKS.TLS.ConfigMapRef != nil { + tlsConfigMapRef = utils.ConvertRefConfigsV2ToV1(jwtIssuer.Spec.SignatureValidation.JWKS.TLS.ConfigMapRef) + } + if jwtIssuer.Spec.SignatureValidation.JWKS.TLS.SecretRef != nil { + tlsSecretRef = utils.ConvertRefConfigsV2ToV1(jwtIssuer.Spec.SignatureValidation.JWKS.TLS.SecretRef) + } + + tlsCertificate, err := utils.ResolveCertificate(ctx, client, jwtIssuer.ObjectMeta.Namespace, jwtIssuer.Spec.SignatureValidation.JWKS.TLS.CertificateInline, tlsConfigMapRef, tlsSecretRef) if err != nil || tlsCertificate == "" { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2659, logging.MAJOR, "Error resolving certificate for JWKS %v", err.Error())) continue @@ -232,7 +243,17 @@ func getJWTIssuers(ctx context.Context, client k8client.Client, namespace types. signatureValidation.JWKS = jwks } if jwtIssuer.Spec.SignatureValidation.Certificate != nil { - tlsCertificate, err := utils.ResolveCertificate(ctx, client, jwtIssuer.ObjectMeta.Namespace, jwtIssuer.Spec.SignatureValidation.Certificate.CertificateInline, *&jwtIssuer.Spec.SignatureValidation.Certificate.ConfigMapRef, *&jwtIssuer.Spec.SignatureValidation.Certificate.SecretRef) + + var tlsConfigMapRef *dpv1alpha1.RefConfig + var tlsSecretRef *dpv1alpha1.RefConfig + if jwtIssuer.Spec.SignatureValidation.Certificate.ConfigMapRef != nil { + tlsConfigMapRef = utils.ConvertRefConfigsV2ToV1(jwtIssuer.Spec.SignatureValidation.Certificate.ConfigMapRef) + } + if jwtIssuer.Spec.SignatureValidation.Certificate.SecretRef != nil { + tlsSecretRef = utils.ConvertRefConfigsV2ToV1(jwtIssuer.Spec.SignatureValidation.Certificate.SecretRef) + } + + tlsCertificate, err := utils.ResolveCertificate(ctx, client, jwtIssuer.ObjectMeta.Namespace, jwtIssuer.Spec.SignatureValidation.Certificate.CertificateInline, tlsConfigMapRef, tlsSecretRef) if err != nil || tlsCertificate == "" { loggers.LoggerAPKOperator.ErrorC(logging.PrintError(logging.Error2659, logging.MAJOR, "Error resolving certificate for JWKS %v", err.Error())) return nil, err @@ -253,7 +274,7 @@ func getJWTIssuers(ctx context.Context, client k8client.Client, namespace types. } return jwtIssuerMapping, nil } -func getResolvedClaimMapping(claimMappings []dpv1alpha1.ClaimMapping) map[string]string { +func getResolvedClaimMapping(claimMappings []dpv1alpha2.ClaimMapping) map[string]string { resolvedClaimMappings := make(map[string]string) for _, claimMapping := range claimMappings { resolvedClaimMappings[claimMapping.RemoteClaim] = claimMapping.LocalClaim diff --git a/adapter/internal/operator/utils/utils.go b/adapter/internal/operator/utils/utils.go index 3bb47d06b..327f1ca1f 100644 --- a/adapter/internal/operator/utils/utils.go +++ b/adapter/internal/operator/utils/utils.go @@ -560,3 +560,12 @@ func RetrieveAPIList(k8sclient k8client.Client) ([]dpv1alpha2.API, error) { } return apis, nil } + +// ConvertRefConfigsV2ToV1 converts RefConfig v2 to v1 +func ConvertRefConfigsV2ToV1(refConfig *dpv1alpha2.RefConfig) *dpv1alpha1.RefConfig { + + return &dpv1alpha1.RefConfig{ + Name: refConfig.Name, + Key: refConfig.Key, + } +} diff --git a/helm-charts/crds/dp.wso2.com_tokenissuers.yaml b/helm-charts/crds/dp.wso2.com_tokenissuers.yaml index 325ff1a2a..df170450a 100644 --- a/helm-charts/crds/dp.wso2.com_tokenissuers.yaml +++ b/helm-charts/crds/dp.wso2.com_tokenissuers.yaml @@ -19,6 +19,209 @@ spec: schema: openAPIV3Schema: description: TokenIssuer is the Schema for the tokenIssuer API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: TokenIssuerSpec defines the desired state of TokenIssuer + properties: + claimMappings: + description: ClaimMappings denotes the claim mappings of the jwt + items: + description: ClaimMapping defines the reference configuration + properties: + localClaim: + description: LocalClaim denotes the local claim + type: string + remoteClaim: + description: RemoteClaim denotes the remote claim + type: string + required: + - localClaim + - remoteClaim + type: object + type: array + consumerKeyClaim: + description: ConsumerKeyClaim denotes the claim key of the consumer + key. + minLength: 1 + type: string + issuer: + description: Issuer denotes the issuer of the Token Issuer. + minLength: 1 + type: string + name: + description: Name is the unique name of the Token Issuer in the Organization + defined . "Organization/Name" can be used to uniquely identify an + Issuer. + minLength: 1 + type: string + organization: + description: Organization denotes the organization of the Token Issuer. + minLength: 1 + type: string + scopesClaim: + description: ScopesClaim denotes the claim key of the scopes. + minLength: 1 + type: string + signatureValidation: + description: SignatureValidation denotes the signature validation + method of jwt + properties: + certificate: + description: Certificate denotes the certificate information + properties: + certificateInline: + description: CertificateInline is the Inline Certificate entry + type: string + configMapRef: + description: ConfigMapRef denotes the reference to the ConfigMap + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + secretRef: + description: SecretRef denotes the reference to the Secret + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + type: object + jwks: + description: JWKS denotes the JWKS endpoint information + properties: + tls: + description: TLS denotes the TLS configuration of the JWKS + endpoint + properties: + certificateInline: + description: CertificateInline is the Inline Certificate + entry + type: string + configMapRef: + description: ConfigMapRef denotes the reference to the + ConfigMap that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + secretRef: + description: SecretRef denotes the reference to the Secret + that contains the Certificate + properties: + key: + description: Key of the secret or configmap + minLength: 1 + type: string + name: + description: Name of the secret or configmap + minLength: 1 + type: string + required: + - key + - name + type: object + type: object + url: + description: URL is the URL of the JWKS endpoint + type: string + required: + - url + type: object + type: object + targetRef: + description: TargetRef denotes the reference to the which gateway + it applies to + properties: + group: + description: Group is the group of the target resource. + maxLength: 253 + pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + type: string + kind: + description: Kind is kind of the target resource. + maxLength: 63 + minLength: 1 + pattern: ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ + type: string + name: + description: Name is the name of the target resource. + maxLength: 253 + minLength: 1 + type: string + namespace: + description: Namespace is the namespace of the referent. When + unspecified, the local namespace is inferred. Even when policy + targets a resource in a different namespace, it MUST only apply + to traffic originating from the same namespace as the policy. + maxLength: 63 + minLength: 1 + pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + type: string + required: + - group + - kind + - name + type: object + required: + - consumerKeyClaim + - issuer + - name + - organization + - scopesClaim + - signatureValidation + type: object + status: + description: TokenIssuerStatus defines the observed state of TokenIssuer + type: object + type: object + served: true + storage: false + subresources: + status: {} + - name: v1alpha2 + schema: + openAPIV3Schema: + description: TokenIssuer is the Schema for the tokenissuers API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/test/cucumber-tests/CRs/artifacts.yaml b/test/cucumber-tests/CRs/artifacts.yaml index b969f7f78..c947f850d 100644 --- a/test/cucumber-tests/CRs/artifacts.yaml +++ b/test/cucumber-tests/CRs/artifacts.yaml @@ -579,7 +579,7 @@ spec: name: default --- kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 +apiVersion: dp.wso2.com/v1alpha2 metadata: name: multi-env-token-issuer-all-envs namespace: apk-integration-test @@ -603,7 +603,7 @@ spec: name: default --- kind: TokenIssuer -apiVersion: dp.wso2.com/v1alpha1 +apiVersion: dp.wso2.com/v1alpha2 metadata: name: multi-env-token-issuer-dev-env namespace: apk-integration-test