From 0fe564a92b2f2515b9bf4ce004e186cda1190629 Mon Sep 17 00:00:00 2001 From: Eguzki Astiz Lezaun Date: Wed, 25 Sep 2024 18:44:37 +0200 Subject: [PATCH] ratelimitpolicy v1beta3: more integration tests Signed-off-by: Eguzki Astiz Lezaun --- ...teway_limitador_cluster_controller_test.go | 20 +- tests/envoygateway/wasm_controller_test.go | 38 +- ...dor_cluster_envoyfilter_controller_test.go | 16 +- ...miting_istio_wasmplugin_controller_test.go | 346 +++++++++--------- 4 files changed, 210 insertions(+), 210 deletions(-) diff --git a/tests/envoygateway/envoygateway_limitador_cluster_controller_test.go b/tests/envoygateway/envoygateway_limitador_cluster_controller_test.go index 5c7040343..aad9dab0a 100644 --- a/tests/envoygateway/envoygateway_limitador_cluster_controller_test.go +++ b/tests/envoygateway/envoygateway_limitador_cluster_controller_test.go @@ -20,7 +20,7 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" - kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + kuadrantv1beta3 "github.com/kuadrant/kuadrant-operator/api/v1beta3" "github.com/kuadrant/kuadrant-operator/controllers" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/tests" @@ -52,17 +52,17 @@ var _ = Describe("limitador cluster controller", func() { tests.DeleteNamespace(ctx, testClient(), testNamespace) }, afterEachTimeOut) - policyFactory := func(mutateFns ...func(policy *kuadrantv1beta2.RateLimitPolicy)) *kuadrantv1beta2.RateLimitPolicy { - policy := &kuadrantv1beta2.RateLimitPolicy{ + policyFactory := func(mutateFns ...func(policy *kuadrantv1beta3.RateLimitPolicy)) *kuadrantv1beta3.RateLimitPolicy { + policy := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ Kind: "RateLimitPolicy", - APIVersion: kuadrantv1beta2.GroupVersion.String(), + APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: "rlp", Namespace: testNamespace, }, - Spec: kuadrantv1beta2.RateLimitPolicySpec{}, + Spec: kuadrantv1beta3.RateLimitPolicySpec{}, } for _, mutateFn := range mutateFns { @@ -88,7 +88,7 @@ var _ = Describe("limitador cluster controller", func() { Context("RateLimitPolicy attached to the gateway", func() { var ( - gwPolicy *kuadrantv1beta2.RateLimitPolicy + gwPolicy *kuadrantv1beta3.RateLimitPolicy gwRoute *gatewayapiv1.HTTPRoute ) @@ -98,15 +98,15 @@ var _ = Describe("limitador cluster controller", func() { Expect(err).ToNot(HaveOccurred()) Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(gwRoute))).WithContext(ctx).Should(BeTrue()) - gwPolicy = policyFactory(func(policy *kuadrantv1beta2.RateLimitPolicy) { + gwPolicy = policyFactory(func(policy *kuadrantv1beta3.RateLimitPolicy) { policy.Name = "gw" policy.Spec.TargetRef.Group = gatewayapiv1.GroupName policy.Spec.TargetRef.Kind = "Gateway" policy.Spec.TargetRef.Name = TestGatewayName - policy.Spec.Defaults = &kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + policy.Spec.Defaults = &kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { Limit: 1, Duration: 3, Unit: "minute", }, diff --git a/tests/envoygateway/wasm_controller_test.go b/tests/envoygateway/wasm_controller_test.go index a2f835d5b..4aa3f89bc 100644 --- a/tests/envoygateway/wasm_controller_test.go +++ b/tests/envoygateway/wasm_controller_test.go @@ -17,7 +17,7 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" - kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + kuadrantv1beta3 "github.com/kuadrant/kuadrant-operator/api/v1beta3" "github.com/kuadrant/kuadrant-operator/controllers" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/rlptools/wasm" @@ -50,17 +50,17 @@ var _ = Describe("wasm controller", func() { tests.DeleteNamespace(ctx, testClient(), testNamespace) }, afterEachTimeOut) - policyFactory := func(mutateFns ...func(policy *kuadrantv1beta2.RateLimitPolicy)) *kuadrantv1beta2.RateLimitPolicy { - policy := &kuadrantv1beta2.RateLimitPolicy{ + policyFactory := func(mutateFns ...func(policy *kuadrantv1beta3.RateLimitPolicy)) *kuadrantv1beta3.RateLimitPolicy { + policy := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ Kind: "RateLimitPolicy", - APIVersion: kuadrantv1beta2.GroupVersion.String(), + APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: "rlp", Namespace: testNamespace, }, - Spec: kuadrantv1beta2.RateLimitPolicySpec{}, + Spec: kuadrantv1beta3.RateLimitPolicySpec{}, } for _, mutateFn := range mutateFns { @@ -77,7 +77,7 @@ var _ = Describe("wasm controller", func() { Context("RateLimitPolicy attached to the gateway", func() { var ( - gwPolicy *kuadrantv1beta2.RateLimitPolicy + gwPolicy *kuadrantv1beta3.RateLimitPolicy gwRoute *gatewayapiv1.HTTPRoute ) @@ -87,15 +87,15 @@ var _ = Describe("wasm controller", func() { Expect(err).ToNot(HaveOccurred()) Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(gwRoute))).WithContext(ctx).Should(BeTrue()) - gwPolicy = policyFactory(func(policy *kuadrantv1beta2.RateLimitPolicy) { + gwPolicy = policyFactory(func(policy *kuadrantv1beta3.RateLimitPolicy) { policy.Name = "gw" policy.Spec.TargetRef.Group = gatewayapiv1.GroupName policy.Spec.TargetRef.Kind = "Gateway" policy.Spec.TargetRef.Name = TestGatewayName - policy.Spec.Defaults = &kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + policy.Spec.Defaults = &kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { Limit: 1, Duration: 3, Unit: "minute", }, @@ -158,12 +158,12 @@ var _ = Describe("wasm controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -225,7 +225,7 @@ var _ = Describe("wasm controller", func() { Context("RateLimitPolicy attached to the route", func() { var ( - routePolicy *kuadrantv1beta2.RateLimitPolicy + routePolicy *kuadrantv1beta3.RateLimitPolicy gwRoute *gatewayapiv1.HTTPRoute ) @@ -235,15 +235,15 @@ var _ = Describe("wasm controller", func() { Expect(err).ToNot(HaveOccurred()) Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(gwRoute))).WithContext(ctx).Should(BeTrue()) - routePolicy = policyFactory(func(policy *kuadrantv1beta2.RateLimitPolicy) { + routePolicy = policyFactory(func(policy *kuadrantv1beta3.RateLimitPolicy) { policy.Name = "route" policy.Spec.TargetRef.Group = gatewayapiv1.GroupName policy.Spec.TargetRef.Kind = "HTTPRoute" policy.Spec.TargetRef.Name = TestHTTPRouteName - policy.Spec.Defaults = &kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + policy.Spec.Defaults = &kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { Limit: 1, Duration: 3, Unit: "minute", }, @@ -305,12 +305,12 @@ var _ = Describe("wasm controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, diff --git a/tests/istio/limitador_cluster_envoyfilter_controller_test.go b/tests/istio/limitador_cluster_envoyfilter_controller_test.go index 3de996083..6effe5fec 100644 --- a/tests/istio/limitador_cluster_envoyfilter_controller_test.go +++ b/tests/istio/limitador_cluster_envoyfilter_controller_test.go @@ -18,7 +18,7 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + kuadrantv1beta3 "github.com/kuadrant/kuadrant-operator/api/v1beta3" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant" "github.com/kuadrant/kuadrant-operator/tests" @@ -79,27 +79,27 @@ var _ = Describe("Limitador Cluster EnvoyFilter controller", func() { Context("RLP targeting Gateway", func() { It("EnvoyFilter created when RLP exists and deleted with RLP is deleted", func(ctx SpecContext) { // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ Kind: "RateLimitPolicy", - APIVersion: kuadrantv1beta2.GroupVersion.String(), + APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: rlpName, Namespace: testNamespace, }, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, diff --git a/tests/istio/rate_limiting_istio_wasmplugin_controller_test.go b/tests/istio/rate_limiting_istio_wasmplugin_controller_test.go index a5b06a1f0..e017c136d 100644 --- a/tests/istio/rate_limiting_istio_wasmplugin_controller_test.go +++ b/tests/istio/rate_limiting_istio_wasmplugin_controller_test.go @@ -19,7 +19,7 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + kuadrantv1beta3 "github.com/kuadrant/kuadrant-operator/api/v1beta3" "github.com/kuadrant/kuadrant-operator/controllers" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant" @@ -81,23 +81,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -139,12 +139,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -205,29 +205,29 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ Kind: "RateLimitPolicy", - APIVersion: kuadrantv1beta2.GroupVersion.String(), + APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{ Name: rlpName, Namespace: testNamespace, }, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "toys": { - Rates: []kuadrantv1beta2.Rate{ - {Limit: 50, Duration: 1, Unit: kuadrantv1beta2.TimeUnit("minute")}, + Rates: []kuadrantv1beta3.Rate{ + {Limit: 50, Duration: 1, Unit: kuadrantv1beta3.TimeUnit("minute")}, }, - Counters: []kuadrantv1beta2.ContextSelector{"auth.identity.username"}, - RouteSelectors: []kuadrantv1beta2.RouteSelector{ + Counters: []kuadrantv1beta3.ContextSelector{"auth.identity.username"}, + RouteSelectors: []kuadrantv1beta3.RouteSelector{ { // selects the 1st HTTPRouteRule (i.e. get|post /toys*) for one of the hostnames Matches: []gatewayapiv1.HTTPRouteMatch{ { @@ -240,20 +240,20 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Hostnames: []gatewayapiv1.Hostname{"*.toystore.acme.com"}, }, }, - When: []kuadrantv1beta2.WhenCondition{ + When: []kuadrantv1beta3.WhenCondition{ { Selector: "auth.identity.group", - Operator: kuadrantv1beta2.WhenConditionOperator("neq"), + Operator: kuadrantv1beta3.WhenConditionOperator("neq"), Value: "admin", }, }, }, "assets": { - Rates: []kuadrantv1beta2.Rate{ - {Limit: 5, Duration: 1, Unit: kuadrantv1beta2.TimeUnit("minute")}, - {Limit: 100, Duration: 12, Unit: kuadrantv1beta2.TimeUnit("hour")}, + Rates: []kuadrantv1beta3.Rate{ + {Limit: 5, Duration: 1, Unit: kuadrantv1beta3.TimeUnit("minute")}, + {Limit: 100, Duration: 12, Unit: kuadrantv1beta3.TimeUnit("hour")}, }, - RouteSelectors: []kuadrantv1beta2.RouteSelector{ + RouteSelectors: []kuadrantv1beta3.RouteSelector{ { // selects the 2nd HTTPRouteRule (i.e. /assets*) for all hostnames Matches: []gatewayapiv1.HTTPRouteMatch{ { @@ -297,22 +297,22 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toys", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, { Selector: "request.host", - Operator: wasm.PatternOperator(kuadrantv1beta2.EndsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EndsWithOperator), Value: ".toystore.acme.com", }, { Selector: "auth.identity.group", - Operator: wasm.PatternOperator(kuadrantv1beta2.NotEqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.NotEqualOperator), Value: "admin", }, }, @@ -321,22 +321,22 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toys", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "POST", }, { Selector: "request.host", - Operator: wasm.PatternOperator(kuadrantv1beta2.EndsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EndsWithOperator), Value: ".toystore.acme.com", }, { Selector: "auth.identity.group", - Operator: wasm.PatternOperator(kuadrantv1beta2.NotEqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.NotEqualOperator), Value: "admin", }, }, @@ -351,7 +351,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { }, { Selector: &wasm.SelectorSpec{ - Selector: kuadrantv1beta2.ContextSelector("auth.identity.username"), + Selector: kuadrantv1beta3.ContextSelector("auth.identity.username"), }, }, }, @@ -362,7 +362,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/assets", }, }, @@ -389,23 +389,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -442,12 +442,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -489,23 +489,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { It("Wasmplugin must not be created", func(ctx SpecContext) { // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -557,21 +557,21 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create ratelimitpolicy with no matching routes - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - RouteSelectors: []kuadrantv1beta2.RouteSelector{ + RouteSelectors: []kuadrantv1beta3.RouteSelector{ { // does no select any HTTPRouteRule (i.e. GET /toys*) Matches: []gatewayapiv1.HTTPRouteMatch{ { @@ -583,9 +583,9 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { }, }, }, - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -631,23 +631,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRouteB))).WithContext(ctx).Should(BeTrue()) // create RLP A -> Gw A - rlpA := &kuadrantv1beta2.RateLimitPolicy{ + rlpA := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpAName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -683,21 +683,21 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRouteC))).WithContext(ctx).Should(BeTrue()) // create RLP B -> Route C (however, no matching routes) - rlpB := &kuadrantv1beta2.RateLimitPolicy{ + rlpB := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpBName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeCName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - RouteSelectors: []kuadrantv1beta2.RouteSelector{ + RouteSelectors: []kuadrantv1beta3.RouteSelector{ { // does no select any HTTPRouteRule (i.e. GET /otherPathRouteC*) Matches: []gatewayapiv1.HTTPRouteMatch{ { @@ -709,9 +709,9 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { }, }, }, - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -757,12 +757,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -829,23 +829,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { // Gw A will be the pre-existing $gateway with name $TestGatewayName // create RLP A -> Gw A - rlpA := &kuadrantv1beta2.RateLimitPolicy{ + rlpA := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -905,12 +905,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1038,23 +1038,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create RLP A -> Route A - rlpA := &kuadrantv1beta2.RateLimitPolicy{ + rlpA := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1100,12 +1100,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1216,12 +1216,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1335,23 +1335,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { // // create RLP R -> Route A // - rlpR := &kuadrantv1beta2.RateLimitPolicy{ + rlpR := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeAName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1397,12 +1397,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeA", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1437,7 +1437,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { // From RLP R -> Route A // To RLP R -> Route B Eventually(func(g Gomega) { - rlpUpdated := &kuadrantv1beta2.RateLimitPolicy{} + rlpUpdated := &kuadrantv1beta3.RateLimitPolicy{} err = testClient().Get(ctx, client.ObjectKeyFromObject(rlpR), rlpUpdated) g.Expect(err).ToNot(HaveOccurred()) rlpUpdated.Spec.TargetRef.Name = gatewayapiv1.ObjectName(routeBName) @@ -1476,12 +1476,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeB", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1570,23 +1570,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRouteA))).WithContext(ctx).Should(BeTrue()) // create RLP 1 -> Gw A - rlp1 := &kuadrantv1beta2.RateLimitPolicy{ + rlp1 := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlp1Name, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "gatewaylimit": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1632,12 +1632,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeA", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1674,23 +1674,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { // // create RLP 2 -> Route A // - rlp2 := &kuadrantv1beta2.RateLimitPolicy{ + rlp2 := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlp2Name, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeAName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "routelimit": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 4, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 4, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1736,12 +1736,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeA", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -1833,23 +1833,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRouteA))).WithContext(ctx).Should(BeTrue()) // create RLP 1 -> Gw A - rlp1 := &kuadrantv1beta2.RateLimitPolicy{ + rlp1 := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlp1Name, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "gatewaylimit": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1864,23 +1864,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(assertPolicyIsAcceptedAndEnforced(ctx, rlp1Key)).WithContext(ctx).Should(BeTrue()) // create RLP 2 -> Route A - rlp2 := &kuadrantv1beta2.RateLimitPolicy{ + rlp2 := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlp2Name, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeAName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "routelimit": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 4, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 4, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -1926,12 +1926,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeA", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -2020,12 +2020,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeB", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -2054,12 +2054,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/routeA", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -2121,21 +2121,21 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create ratelimitpolicy - rlp := &kuadrantv1beta2.RateLimitPolicy{ + rlp := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: rlpName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "l1": { - RouteSelectors: []kuadrantv1beta2.RouteSelector{ + RouteSelectors: []kuadrantv1beta3.RouteSelector{ { // Route does not specify any hostname // gateway's listener specifies *.gw.example.com @@ -2143,9 +2143,9 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { }, }, - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -2182,12 +2182,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -2227,7 +2227,7 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.GatewayIsReady(ctx, testClient(), gateway)).WithContext(ctx).Should(BeTrue()) } - expectedWasmPluginConfig := func(rlpKey client.ObjectKey, rlp *kuadrantv1beta2.RateLimitPolicy, key, hostname string) *wasm.Config { + expectedWasmPluginConfig := func(rlpKey client.ObjectKey, rlp *kuadrantv1beta3.RateLimitPolicy, key, hostname string) *wasm.Config { return &wasm.Config{ FailureMode: wasm.FailureModeDeny, RateLimitPolicies: []wasm.RateLimitPolicy{ @@ -2241,12 +2241,12 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { AllOf: []wasm.PatternExpression{ { Selector: "request.url_path", - Operator: wasm.PatternOperator(kuadrantv1beta2.StartsWithOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.StartsWithOperator), Value: "/toy", }, { Selector: "request.method", - Operator: wasm.PatternOperator(kuadrantv1beta2.EqualOperator), + Operator: wasm.PatternOperator(kuadrantv1beta3.EqualOperator), Value: "GET", }, }, @@ -2278,23 +2278,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Eventually(tests.RouteIsAccepted(ctx, testClient(), client.ObjectKeyFromObject(httpRoute))).WithContext(ctx).Should(BeTrue()) // create GW ratelimitpolicy with defaults - gwRLP := &kuadrantv1beta2.RateLimitPolicy{ + gwRLP := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: gwRLPName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "Gateway", Name: gatewayapiv1.ObjectName(TestGatewayName), }, - Defaults: &kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + Defaults: &kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "gateway": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 1, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 1, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, }, @@ -2319,23 +2319,23 @@ var _ = Describe("Rate Limiting WasmPlugin controller", func() { Expect(existingWASMConfig).To(Equal(expectedWasmPluginConfig(gwRLPKey, gwRLP, wasm.LimitNameToLimitadorIdentifier(gwRLPKey, "gateway"), "*"))) // Create Route RLP - routeRLP := &kuadrantv1beta2.RateLimitPolicy{ + routeRLP := &kuadrantv1beta3.RateLimitPolicy{ TypeMeta: metav1.TypeMeta{ - Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta2.GroupVersion.String(), + Kind: "RateLimitPolicy", APIVersion: kuadrantv1beta3.GroupVersion.String(), }, ObjectMeta: metav1.ObjectMeta{Name: routeRLPName, Namespace: testNamespace}, - Spec: kuadrantv1beta2.RateLimitPolicySpec{ + Spec: kuadrantv1beta3.RateLimitPolicySpec{ TargetRef: gatewayapiv1alpha2.LocalPolicyTargetReference{ Group: gatewayapiv1.GroupName, Kind: "HTTPRoute", Name: gatewayapiv1.ObjectName(routeName), }, - RateLimitPolicyCommonSpec: kuadrantv1beta2.RateLimitPolicyCommonSpec{ - Limits: map[string]kuadrantv1beta2.Limit{ + RateLimitPolicyCommonSpec: kuadrantv1beta3.RateLimitPolicyCommonSpec{ + Limits: map[string]kuadrantv1beta3.Limit{ "route": { - Rates: []kuadrantv1beta2.Rate{ + Rates: []kuadrantv1beta3.Rate{ { - Limit: 10, Duration: 3, Unit: kuadrantv1beta2.TimeUnit("minute"), + Limit: 10, Duration: 3, Unit: kuadrantv1beta3.TimeUnit("minute"), }, }, },