diff --git a/api/v1beta2/ratelimitpolicy_types_test.go b/api/v1beta2/ratelimitpolicy_types_test.go index cde75c2af..707cce8a0 100644 --- a/api/v1beta2/ratelimitpolicy_types_test.go +++ b/api/v1beta2/ratelimitpolicy_types_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - policy2 "github.com/kuadrant/kuadrant-operator/pkg/library/utils" + "github.com/kuadrant/kuadrant-operator/pkg/library/utils" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" @@ -69,7 +69,7 @@ func TestRateLimitPolicyListGetItems(t *testing.T) { if len(result) != 1 { t.Errorf("Expected 1 item, got %d", len(result)) } - _, ok := result[0].(policy2.KuadrantPolicy) + _, ok := result[0].(utils.KuadrantPolicy) if !ok { t.Errorf("Expected item to be a KuadrantPolicy") } diff --git a/pkg/library/reconcilers/gateway_diffs.go b/pkg/library/reconcilers/gateway_diffs.go index eb6b37ec1..5638fa6a5 100644 --- a/pkg/library/reconcilers/gateway_diffs.go +++ b/pkg/library/reconcilers/gateway_diffs.go @@ -6,15 +6,15 @@ import ( "slices" "github.com/go-logr/logr" - policy2 "github.com/kuadrant/kuadrant-operator/pkg/library/utils" + "github.com/kuadrant/kuadrant-operator/pkg/library/utils" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" ) type GatewayDiffs struct { - GatewaysMissingPolicyRef []policy2.GatewayWrapper - GatewaysWithValidPolicyRef []policy2.GatewayWrapper - GatewaysWithInvalidPolicyRef []policy2.GatewayWrapper + GatewaysMissingPolicyRef []utils.GatewayWrapper + GatewaysWithValidPolicyRef []utils.GatewayWrapper + GatewaysWithInvalidPolicyRef []utils.GatewayWrapper } // ComputeGatewayDiffs computes all the differences to reconcile regarding the gateways whose behaviors should/should not be extended by the policy. @@ -38,7 +38,7 @@ func ComputeGatewayDiffs(ctx context.Context, k8sClient client.Reader, policy, t return nil, err } - policyKind, ok := policy.(policy2.Referrer) + policyKind, ok := policy.(utils.Referrer) if !ok { return nil, fmt.Errorf("policy %s is not a referrer", policy.GetObjectKind().GroupVersionKind()) } @@ -59,11 +59,11 @@ func ComputeGatewayDiffs(ctx context.Context, k8sClient client.Reader, policy, t } // gatewaysMissingPolicyRef returns gateways referenced by the policy but that miss the reference to it the annotations -func gatewaysMissingPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind policy2.Referrer) []policy2.GatewayWrapper { - gateways := make([]policy2.GatewayWrapper, 0) +func gatewaysMissingPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind utils.Referrer) []utils.GatewayWrapper { + gateways := make([]utils.GatewayWrapper, 0) for i := range gwList.Items { gateway := gwList.Items[i] - gw := policy2.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} + gw := utils.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} if slices.Contains(policyGwKeys, client.ObjectKeyFromObject(&gateway)) && !gw.ContainsPolicy(policyKey) { gateways = append(gateways, gw) } @@ -72,11 +72,11 @@ func gatewaysMissingPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client } // gatewaysWithValidPolicyRef returns gateways referenced by the policy that also have the reference in the annotations -func gatewaysWithValidPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind policy2.Referrer) []policy2.GatewayWrapper { - gateways := make([]policy2.GatewayWrapper, 0) +func gatewaysWithValidPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind utils.Referrer) []utils.GatewayWrapper { + gateways := make([]utils.GatewayWrapper, 0) for i := range gwList.Items { gateway := gwList.Items[i] - gw := policy2.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} + gw := utils.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} if slices.Contains(policyGwKeys, client.ObjectKeyFromObject(&gateway)) && gw.ContainsPolicy(policyKey) { gateways = append(gateways, gw) } @@ -85,11 +85,11 @@ func gatewaysWithValidPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey clie } // gatewaysWithInvalidPolicyRef returns gateways not referenced by the policy that still have the reference in the annotations -func gatewaysWithInvalidPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind policy2.Referrer) []policy2.GatewayWrapper { - gateways := make([]policy2.GatewayWrapper, 0) +func gatewaysWithInvalidPolicyRef(gwList *gatewayapiv1.GatewayList, policyKey client.ObjectKey, policyGwKeys []client.ObjectKey, policyKind utils.Referrer) []utils.GatewayWrapper { + gateways := make([]utils.GatewayWrapper, 0) for i := range gwList.Items { gateway := gwList.Items[i] - gw := policy2.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} + gw := utils.GatewayWrapper{Gateway: &gateway, Referrer: policyKind} if !slices.Contains(policyGwKeys, client.ObjectKeyFromObject(&gateway)) && gw.ContainsPolicy(policyKey) { gateways = append(gateways, gw) }