From 79d4c315be0ac87005b9bf3cf55a2c3853498354 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Wed, 7 Feb 2024 20:52:32 +0000 Subject: [PATCH 1/3] Add goimports Adds new Make targets to sort and group project imports `make imports` and verify imports are sorted and grouped `make verify-imports`. Sorting and grouping based on openshift-goimports defaults see https://github.com/openshift-eng/openshift-goimports, with all kuadrant imports added as an intermediate so they are grouped nearer the modules imports. --- Makefile | 13 +++++++++++++ hack/verify-imports.sh | 18 ++++++++++++++++++ make/verify.mk | 4 ++++ 3 files changed, 35 insertions(+) create mode 100755 hack/verify-imports.sh diff --git a/Makefile b/Makefile index 812d65b2a..4c7b1f059 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,13 @@ $(ACT): .PHONY: act act: $(ACT) ## Download act locally if necessary. +OPENSHIFT_GOIMPORTS ?= $(PROJECT_PATH)/bin/openshift-goimports +OPENSHIFT_GOIMPORTS_VERSION ?= c70783e636f2213cac683f6865d88c5edace3157 +.PHONY: openshift-goimports +openshift-goimports: $(OPENSHIFT_GOIMPORTS) ## Download openshift-goimports locally if necessary +$(OPENSHIFT_GOIMPORTS): + $(call go-install-tool,$(OPENSHIFT_GOIMPORTS),github.com/openshift-eng/openshift-goimports@$(OPENSHIFT_GOIMPORTS_VERSION)) + ##@ Development define patch-config envsubst \ @@ -274,12 +281,18 @@ dependencies-manifests: ## Update kuadrant dependencies manifests. generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: fmt fmt: ## Run go fmt against code. go fmt ./... +.PHONY: vet vet: ## Run go vet against code. go vet ./... +.PHONY: imports +imports: openshift-goimports ## Run openshift goimports against code. + $(OPENSHIFT_GOIMPORTS) -m github.com/kuadrant/kuadrant-operator -i github.com/kuadrant + .PHONY: clean-cov clean-cov: ## Remove coverage reports rm -rf coverage diff --git a/hack/verify-imports.sh b/hack/verify-imports.sh new file mode 100755 index 000000000..31517bbea --- /dev/null +++ b/hack/verify-imports.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +make -C "$( dirname "${BASH_SOURCE[0]}")/../" imports +if ! git diff --quiet --exit-code ; then + cat << EOF +ERROR: This check enforces that import statements are ordered correctly. +ERROR: The import statements are out of order. Run the following command +ERROR: to regenerate the statements: +ERROR: $ make imports +ERROR: The following differences were found: +EOF + git diff + exit 1 +fi diff --git a/make/verify.mk b/make/verify.mk index 25d11a5bc..98e4fec2b 100644 --- a/make/verify.mk +++ b/make/verify.mk @@ -16,3 +16,7 @@ verify-bundle: bundle ## Verify bundle update. .PHONY: verify-fmt verify-fmt: fmt ## Verify fmt update. git diff --exit-code ./api ./controllers + +.PHONY: verify-imports +verify-imports: ## Verify go imports are sorted and grouped correctly. + hack/verify-imports.sh From 781eaeee955b44231e41e3e92f88fcd6517f6dfa Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Wed, 7 Feb 2024 21:06:46 +0000 Subject: [PATCH 2/3] Add verify-imports CI job --- .github/workflows/test.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f97fee460..d686c93d4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -144,6 +144,21 @@ jobs: run: | make verify-fmt + verify-imports: + name: Verify imports + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.21.x + uses: actions/setup-go@v4 + with: + go-version: 1.21.x + id: go + - name: Check out code + uses: actions/checkout@v3 + - name: Run make verify-imports + run: | + make verify-imports + test-scripts: name: Test Scripts strategy: From d0182ac0dca5a27aa3b0146d4af035367ab83ef2 Mon Sep 17 00:00:00 2001 From: Michael Nairn Date: Wed, 7 Feb 2024 21:09:30 +0000 Subject: [PATCH 3/3] Run `make imports` to group and sort all imports --- api/v1beta1/kuadrant_types.go | 4 ++- api/v1beta1/zz_generated.deepcopy.go | 3 ++- api/v1beta2/authpolicy_types.go | 2 ++ api/v1beta2/authpolicy_types_test.go | 1 + api/v1beta2/ratelimitpolicy_types.go | 4 ++- api/v1beta2/route_selectors.go | 4 +-- api/v1beta2/zz_generated.deepcopy.go | 3 ++- controllers/authpolicy_authconfig.go | 2 ++ controllers/authpolicy_authconfig_test.go | 3 ++- controllers/authpolicy_controller.go | 2 ++ controllers/authpolicy_controller_test.go | 7 +++-- .../authpolicy_istio_authorizationpolicy.go | 8 +++--- ...thpolicy_istio_authorizationpolicy_test.go | 1 + controllers/authpolicy_status.go | 2 ++ controllers/gateway_eventmapper.go | 1 + controllers/gateway_kuadrant_controller.go | 1 + .../gateway_kuadrant_controller_test.go | 1 + controllers/helper_test.go | 7 ++--- controllers/httproute_eventmapper.go | 1 + .../httprouteparentrefs_eventmapper.go | 1 + controllers/kuadrant_controller.go | 19 +++++++------- controllers/kuadrant_status.go | 4 ++- ...imitador_cluster_envoyfilter_controller.go | 4 ++- ...dor_cluster_envoyfilter_controller_test.go | 4 ++- controllers/ratelimitpolicy_controller.go | 1 + .../ratelimitpolicy_controller_test.go | 13 ++++++---- .../ratelimitpolicy_istio_wasmplugin.go | 1 + controllers/ratelimitpolicy_limits.go | 4 ++- controllers/ratelimitpolicy_status.go | 1 + controllers/suite_test.go | 15 ++++++----- main.go | 26 ++++++++----------- .../apimachinery_status_conditions_test.go | 1 + pkg/common/authorino_conditions_test.go | 1 + pkg/common/istio_utils.go | 1 + pkg/common/istio_utils_test.go | 1 + pkg/common/k8s_utils_test.go | 7 +++-- pkg/common/mesh_config.go | 1 + pkg/common/mesh_config_test.go | 1 + pkg/common/yaml_decoder.go | 1 + pkg/common/yaml_decoder_test.go | 7 ++--- pkg/istio/envoy_filters.go | 1 + pkg/istio/mesh_config.go | 6 +++-- pkg/istio/mesh_config_test.go | 8 +++--- pkg/kuadranttools/limitador_tools.go | 6 +++-- pkg/kuadranttools/limitador_tools_test.go | 9 ++++--- pkg/log/log.go | 1 + pkg/log/log_test.go | 4 +-- pkg/reconcilers/base_reconciler.go | 1 + pkg/reconcilers/base_reconciler_test.go | 1 + pkg/reconcilers/targetref_reconciler.go | 1 + pkg/reconcilers/targetref_reconciler_test.go | 3 ++- pkg/rlptools/rate_limit_index.go | 4 ++- pkg/rlptools/rate_limit_index_test.go | 3 ++- pkg/rlptools/utils_test.go | 3 ++- pkg/rlptools/wasm/types.go | 1 + pkg/rlptools/wasm_utils.go | 1 + pkg/rlptools/wasm_utils_test.go | 1 + 57 files changed, 145 insertions(+), 80 deletions(-) diff --git a/api/v1beta1/kuadrant_types.go b/api/v1beta1/kuadrant_types.go index 0c608cd88..8d60f874d 100644 --- a/api/v1beta1/kuadrant_types.go +++ b/api/v1beta1/kuadrant_types.go @@ -19,10 +19,12 @@ package v1beta1 import ( "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index fd8dba47c..0e067a9bb 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -21,10 +21,11 @@ limitations under the License. package v1beta1 import ( - "github.com/kuadrant/limitador-operator/api/v1alpha1" "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" + + "github.com/kuadrant/limitador-operator/api/v1alpha1" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/api/v1beta2/authpolicy_types.go b/api/v1beta2/authpolicy_types.go index 5e7cc687a..697092a72 100644 --- a/api/v1beta2/authpolicy_types.go +++ b/api/v1beta2/authpolicy_types.go @@ -5,12 +5,14 @@ import ( "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/api/v1beta2/authpolicy_types_test.go b/api/v1beta2/authpolicy_types_test.go index 7b645bd3c..2b2afdfc9 100644 --- a/api/v1beta2/authpolicy_types_test.go +++ b/api/v1beta2/authpolicy_types_test.go @@ -12,6 +12,7 @@ import ( gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/api/v1beta2/ratelimitpolicy_types.go b/api/v1beta2/ratelimitpolicy_types.go index 4e0cccb0e..fdf524014 100644 --- a/api/v1beta2/ratelimitpolicy_types.go +++ b/api/v1beta2/ratelimitpolicy_types.go @@ -21,11 +21,13 @@ import ( "github.com/go-logr/logr" "github.com/google/go-cmp/cmp" - "github.com/kuadrant/kuadrant-operator/pkg/common" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + + "github.com/kuadrant/kuadrant-operator/pkg/common" ) // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! diff --git a/api/v1beta2/route_selectors.go b/api/v1beta2/route_selectors.go index 880ae16be..136c6fd2e 100644 --- a/api/v1beta2/route_selectors.go +++ b/api/v1beta2/route_selectors.go @@ -1,10 +1,10 @@ package v1beta2 import ( - gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" - orderedmap "github.com/elliotchance/orderedmap/v2" + gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go index e7df27649..4ce8864fe 100644 --- a/api/v1beta2/zz_generated.deepcopy.go +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -21,10 +21,11 @@ limitations under the License. package v1beta2 import ( - apiv1beta2 "github.com/kuadrant/authorino/api/v1beta2" "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" apisv1 "sigs.k8s.io/gateway-api/apis/v1" + + apiv1beta2 "github.com/kuadrant/authorino/api/v1beta2" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. diff --git a/controllers/authpolicy_authconfig.go b/controllers/authpolicy_authconfig.go index 0b1ba8338..4ba411893 100644 --- a/controllers/authpolicy_authconfig.go +++ b/controllers/authpolicy_authconfig.go @@ -8,12 +8,14 @@ import ( "strings" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + api "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/controllers/authpolicy_authconfig_test.go b/controllers/authpolicy_authconfig_test.go index 4d940f7f3..1ba4916f2 100644 --- a/controllers/authpolicy_authconfig_test.go +++ b/controllers/authpolicy_authconfig_test.go @@ -6,9 +6,10 @@ import ( "reflect" "testing" - authorinoapi "github.com/kuadrant/authorino/api/v1beta2" "k8s.io/utils/ptr" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + + authorinoapi "github.com/kuadrant/authorino/api/v1beta2" ) func TestAuthorinoConditionsFromHTTPRouteRule(t *testing.T) { diff --git a/controllers/authpolicy_controller.go b/controllers/authpolicy_controller.go index 0ab6a45f2..f7ba25209 100644 --- a/controllers/authpolicy_controller.go +++ b/controllers/authpolicy_controller.go @@ -5,6 +5,7 @@ import ( "encoding/json" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -13,6 +14,7 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + api "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/reconcilers" diff --git a/controllers/authpolicy_controller_test.go b/controllers/authpolicy_controller_test.go index 3a6bd3b0b..e404ef7b2 100644 --- a/controllers/authpolicy_controller_test.go +++ b/controllers/authpolicy_controller_test.go @@ -10,11 +10,10 @@ import ( "strings" "time" - authorinoapi "github.com/kuadrant/authorino/api/v1beta2" - api "github.com/kuadrant/kuadrant-operator/api/v1beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" secv1beta1resources "istio.io/client-go/pkg/apis/security/v1beta1" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,6 +24,10 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + + authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + + api "github.com/kuadrant/kuadrant-operator/api/v1beta2" ) const ( diff --git a/controllers/authpolicy_istio_authorizationpolicy.go b/controllers/authpolicy_istio_authorizationpolicy.go index 3453d21e5..088f03af7 100644 --- a/controllers/authpolicy_istio_authorizationpolicy.go +++ b/controllers/authpolicy_istio_authorizationpolicy.go @@ -7,20 +7,20 @@ import ( "reflect" "github.com/go-logr/logr" + istiosecurity "istio.io/api/security/v1beta1" + istio "istio.io/client-go/pkg/apis/security/v1beta1" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" + "k8s.io/utils/env" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" - istiosecurity "istio.io/api/security/v1beta1" - istio "istio.io/client-go/pkg/apis/security/v1beta1" - api "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/reconcilers" - "k8s.io/utils/env" ) var KuadrantExtAuthProviderName = env.GetString("AUTH_PROVIDER", "kuadrant-authorization") diff --git a/controllers/authpolicy_istio_authorizationpolicy_test.go b/controllers/authpolicy_istio_authorizationpolicy_test.go index a64baf5d7..5d4f0cf71 100644 --- a/controllers/authpolicy_istio_authorizationpolicy_test.go +++ b/controllers/authpolicy_istio_authorizationpolicy_test.go @@ -7,6 +7,7 @@ import ( "testing" istiosecurity "istio.io/api/security/v1beta1" + "k8s.io/utils/ptr" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" ) diff --git a/controllers/authpolicy_status.go b/controllers/authpolicy_status.go index 3c36e5d9c..73f69a18f 100644 --- a/controllers/authpolicy_status.go +++ b/controllers/authpolicy_status.go @@ -6,6 +6,7 @@ import ( "slices" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -13,6 +14,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + api "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/controllers/gateway_eventmapper.go b/controllers/gateway_eventmapper.go index bd9e7a8f1..c1596cbff 100644 --- a/controllers/gateway_eventmapper.go +++ b/controllers/gateway_eventmapper.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" diff --git a/controllers/gateway_kuadrant_controller.go b/controllers/gateway_kuadrant_controller.go index 21a5cd919..6e686c6d4 100644 --- a/controllers/gateway_kuadrant_controller.go +++ b/controllers/gateway_kuadrant_controller.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/builder" diff --git a/controllers/gateway_kuadrant_controller_test.go b/controllers/gateway_kuadrant_controller_test.go index bf10dce01..947859ecc 100644 --- a/controllers/gateway_kuadrant_controller_test.go +++ b/controllers/gateway_kuadrant_controller_test.go @@ -8,6 +8,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/helper_test.go b/controllers/helper_test.go index 910a5596f..1e29cdcbe 100644 --- a/controllers/helper_test.go +++ b/controllers/helper_test.go @@ -11,11 +11,9 @@ import ( "path/filepath" "time" - kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" - "github.com/kuadrant/kuadrant-operator/pkg/common" - "github.com/google/uuid" . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" v1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -30,6 +28,9 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" logf "sigs.k8s.io/controller-runtime/pkg/log" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + + kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) func ApplyKuadrantCR(namespace string) { diff --git a/controllers/httproute_eventmapper.go b/controllers/httproute_eventmapper.go index 823a92af3..8ecaab00d 100644 --- a/controllers/httproute_eventmapper.go +++ b/controllers/httproute_eventmapper.go @@ -4,6 +4,7 @@ import ( "context" "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" diff --git a/controllers/httprouteparentrefs_eventmapper.go b/controllers/httprouteparentrefs_eventmapper.go index 70bbed511..0ccb580e4 100644 --- a/controllers/httprouteparentrefs_eventmapper.go +++ b/controllers/httprouteparentrefs_eventmapper.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/reconcile" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" diff --git a/controllers/kuadrant_controller.go b/controllers/kuadrant_controller.go index 17a0e5162..984a8055d 100644 --- a/controllers/kuadrant_controller.go +++ b/controllers/kuadrant_controller.go @@ -20,31 +20,32 @@ import ( "context" "encoding/json" - "github.com/kuadrant/kuadrant-operator/pkg/kuadranttools" - corev1 "k8s.io/api/core/v1" - "k8s.io/utils/env" - "github.com/go-logr/logr" - authorinov1beta1 "github.com/kuadrant/authorino-operator/api/v1beta1" - maistrav1 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v1" - maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" "golang.org/x/sync/errgroup" iopv1alpha1 "istio.io/istio/operator/pkg/apis/istio/v1alpha1" + istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" apimeta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" - istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" + "k8s.io/utils/env" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + authorinov1beta1 "github.com/kuadrant/authorino-operator/api/v1beta1" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + + maistrav1 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v1" + maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/istio" + "github.com/kuadrant/kuadrant-operator/pkg/kuadranttools" "github.com/kuadrant/kuadrant-operator/pkg/log" "github.com/kuadrant/kuadrant-operator/pkg/reconcilers" ) diff --git a/controllers/kuadrant_status.go b/controllers/kuadrant_status.go index 7142dc9c7..7f12978df 100644 --- a/controllers/kuadrant_status.go +++ b/controllers/kuadrant_status.go @@ -6,6 +6,7 @@ import ( "slices" "github.com/go-logr/logr" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" @@ -15,9 +16,10 @@ import ( "sigs.k8s.io/controller-runtime/pkg/reconcile" authorinov1beta1 "github.com/kuadrant/authorino-operator/api/v1beta1" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" "github.com/kuadrant/kuadrant-operator/pkg/common" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" ) const ( diff --git a/controllers/limitador_cluster_envoyfilter_controller.go b/controllers/limitador_cluster_envoyfilter_controller.go index 6f6a5cc20..2e854ce7c 100644 --- a/controllers/limitador_cluster_envoyfilter_controller.go +++ b/controllers/limitador_cluster_envoyfilter_controller.go @@ -22,9 +22,9 @@ import ( "fmt" "github.com/go-logr/logr" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" istioapinetworkingv1alpha3 "istio.io/api/networking/v1alpha3" istioclientnetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" + apierrors "k8s.io/apimachinery/pkg/api/errors" meta "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -34,6 +34,8 @@ import ( "sigs.k8s.io/controller-runtime/pkg/predicate" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + "github.com/kuadrant/kuadrant-operator/pkg/common" kuadrantistioutils "github.com/kuadrant/kuadrant-operator/pkg/istio" "github.com/kuadrant/kuadrant-operator/pkg/reconcilers" diff --git a/controllers/limitador_cluster_envoyfilter_controller_test.go b/controllers/limitador_cluster_envoyfilter_controller_test.go index 98fb86c57..7867ebc93 100644 --- a/controllers/limitador_cluster_envoyfilter_controller_test.go +++ b/controllers/limitador_cluster_envoyfilter_controller_test.go @@ -10,6 +10,7 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" istioclientnetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -18,9 +19,10 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" ) var _ = Describe("Limitador Cluster EnvoyFilter controller", func() { diff --git a/controllers/ratelimitpolicy_controller.go b/controllers/ratelimitpolicy_controller.go index 88ac46e30..dcba8ad91 100644 --- a/controllers/ratelimitpolicy_controller.go +++ b/controllers/ratelimitpolicy_controller.go @@ -21,6 +21,7 @@ import ( "encoding/json" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/controllers/ratelimitpolicy_controller_test.go b/controllers/ratelimitpolicy_controller_test.go index b6ba8793a..6f008fa05 100644 --- a/controllers/ratelimitpolicy_controller_test.go +++ b/controllers/ratelimitpolicy_controller_test.go @@ -9,14 +9,10 @@ import ( "strings" "time" - kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" - "github.com/kuadrant/kuadrant-operator/pkg/common" - "github.com/kuadrant/kuadrant-operator/pkg/rlptools" - "github.com/kuadrant/kuadrant-operator/pkg/rlptools/wasm" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -25,6 +21,13 @@ import ( logf "sigs.k8s.io/controller-runtime/pkg/log" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + + kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + "github.com/kuadrant/kuadrant-operator/pkg/common" + "github.com/kuadrant/kuadrant-operator/pkg/rlptools" + "github.com/kuadrant/kuadrant-operator/pkg/rlptools/wasm" ) var _ = Describe("RateLimitPolicy controller", func() { diff --git a/controllers/ratelimitpolicy_istio_wasmplugin.go b/controllers/ratelimitpolicy_istio_wasmplugin.go index 5802b8d3f..84e78571d 100644 --- a/controllers/ratelimitpolicy_istio_wasmplugin.go +++ b/controllers/ratelimitpolicy_istio_wasmplugin.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" istioextensionsv1alpha1 "istio.io/api/extensions/v1alpha1" istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" diff --git a/controllers/ratelimitpolicy_limits.go b/controllers/ratelimitpolicy_limits.go index 1704c74ad..dfea2ef89 100644 --- a/controllers/ratelimitpolicy_limits.go +++ b/controllers/ratelimitpolicy_limits.go @@ -4,9 +4,11 @@ import ( "context" "github.com/go-logr/logr" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" "github.com/kuadrant/kuadrant-operator/pkg/rlptools" diff --git a/controllers/ratelimitpolicy_status.go b/controllers/ratelimitpolicy_status.go index f6e2bd461..e2965006d 100644 --- a/controllers/ratelimitpolicy_status.go +++ b/controllers/ratelimitpolicy_status.go @@ -6,6 +6,7 @@ import ( "slices" "github.com/go-logr/logr" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" ctrl "sigs.k8s.io/controller-runtime" diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 9f8ac9f30..2281245b7 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -23,29 +23,30 @@ import ( "path/filepath" "testing" - authorinoopapi "github.com/kuadrant/authorino-operator/api/v1beta1" - authorinoapi "github.com/kuadrant/authorino/api/v1beta2" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" istioclientnetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" istiosecurityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" istioapis "istio.io/istio/operator/pkg/apis" + istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" + "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/rest" - istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" - gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" - - "github.com/kuadrant/kuadrant-operator/pkg/log" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/log/zap" + gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + + authorinoopapi "github.com/kuadrant/authorino-operator/api/v1beta1" + authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" + "github.com/kuadrant/kuadrant-operator/pkg/log" "github.com/kuadrant/kuadrant-operator/pkg/reconcilers" //+kubebuilder:scaffold:imports ) diff --git a/main.go b/main.go index c8d67118c..a022ef34a 100644 --- a/main.go +++ b/main.go @@ -22,34 +22,30 @@ import ( "os" "runtime" - "k8s.io/utils/env" - "sigs.k8s.io/controller-runtime/pkg/webhook" - - corev1 "k8s.io/api/core/v1" - - // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.) - // to ensure that exec-entrypoint and run can make use of them. - _ "k8s.io/client-go/plugin/pkg/client/auth" - - authorinoopapi "github.com/kuadrant/authorino-operator/api/v1beta1" - authorinoapi "github.com/kuadrant/authorino/api/v1beta2" - maistraapis "github.com/kuadrant/kuadrant-operator/api/external/maistra" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" istioextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" istionetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" istiosecurityv1beta1 "istio.io/client-go/pkg/apis/security/v1beta1" istioapis "istio.io/istio/operator/pkg/apis" + istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" + + corev1 "k8s.io/api/core/v1" apiextv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" k8sruntime "k8s.io/apimachinery/pkg/runtime" utilruntime "k8s.io/apimachinery/pkg/util/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" + _ "k8s.io/client-go/plugin/pkg/client/auth" + "k8s.io/utils/env" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/healthz" metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server" - + "sigs.k8s.io/controller-runtime/pkg/webhook" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" + authorinoopapi "github.com/kuadrant/authorino-operator/api/v1beta1" + authorinoapi "github.com/kuadrant/authorino/api/v1beta2" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + + maistraapis "github.com/kuadrant/kuadrant-operator/api/external/maistra" kuadrantv1beta1 "github.com/kuadrant/kuadrant-operator/api/v1beta1" kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/controllers" diff --git a/pkg/common/apimachinery_status_conditions_test.go b/pkg/common/apimachinery_status_conditions_test.go index 789ae9984..56286167f 100644 --- a/pkg/common/apimachinery_status_conditions_test.go +++ b/pkg/common/apimachinery_status_conditions_test.go @@ -9,6 +9,7 @@ import ( "time" goCmp "github.com/google/go-cmp/cmp" + "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" diff --git a/pkg/common/authorino_conditions_test.go b/pkg/common/authorino_conditions_test.go index efdc55fe5..ccd8e8a95 100644 --- a/pkg/common/authorino_conditions_test.go +++ b/pkg/common/authorino_conditions_test.go @@ -6,6 +6,7 @@ import ( "testing" goCmp "github.com/google/go-cmp/cmp" + authorinov1beta1 "github.com/kuadrant/authorino-operator/api/v1beta1" ) diff --git a/pkg/common/istio_utils.go b/pkg/common/istio_utils.go index d263f401d..e25e32fc1 100644 --- a/pkg/common/istio_utils.go +++ b/pkg/common/istio_utils.go @@ -5,6 +5,7 @@ import ( "github.com/go-logr/logr" istiocommon "istio.io/api/type/v1beta1" + "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" ) diff --git a/pkg/common/istio_utils_test.go b/pkg/common/istio_utils_test.go index a4261d0b4..668c3245b 100644 --- a/pkg/common/istio_utils_test.go +++ b/pkg/common/istio_utils_test.go @@ -8,6 +8,7 @@ import ( "github.com/go-logr/logr" istiocommon "istio.io/api/type/v1beta1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" diff --git a/pkg/common/k8s_utils_test.go b/pkg/common/k8s_utils_test.go index f14adc651..741eec33e 100644 --- a/pkg/common/k8s_utils_test.go +++ b/pkg/common/k8s_utils_test.go @@ -10,15 +10,14 @@ import ( "time" appsv1 "k8s.io/api/apps/v1" - "k8s.io/apimachinery/pkg/util/intstr" - - "github.com/kuadrant/limitador-operator/api/v1alpha1" - corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/client/fake" + + "github.com/kuadrant/limitador-operator/api/v1alpha1" ) func TestObjectKeyListDifference(t *testing.T) { diff --git a/pkg/common/mesh_config.go b/pkg/common/mesh_config.go index 4eec3a4f8..ba6a16137 100644 --- a/pkg/common/mesh_config.go +++ b/pkg/common/mesh_config.go @@ -4,6 +4,7 @@ import ( "fmt" istiomeshv1alpha1 "istio.io/api/mesh/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/common/mesh_config_test.go b/pkg/common/mesh_config_test.go index 836e4fb59..dfbeb0da0 100644 --- a/pkg/common/mesh_config_test.go +++ b/pkg/common/mesh_config_test.go @@ -7,6 +7,7 @@ import ( "gotest.tools/assert" istiomeshv1alpha1 "istio.io/api/mesh/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/common/yaml_decoder.go b/pkg/common/yaml_decoder.go index cf5cfe4ba..072e3e225 100644 --- a/pkg/common/yaml_decoder.go +++ b/pkg/common/yaml_decoder.go @@ -8,6 +8,7 @@ import ( "io" "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/serializer" "k8s.io/apimachinery/pkg/util/yaml" diff --git a/pkg/common/yaml_decoder_test.go b/pkg/common/yaml_decoder_test.go index f77c54752..a34585a0b 100644 --- a/pkg/common/yaml_decoder_test.go +++ b/pkg/common/yaml_decoder_test.go @@ -9,13 +9,14 @@ import ( "testing" "github.com/go-logr/logr" - "github.com/kuadrant/kuadrant-operator/pkg/log" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime/schema" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + + "github.com/kuadrant/kuadrant-operator/pkg/log" ) type testCase struct { diff --git a/pkg/istio/envoy_filters.go b/pkg/istio/envoy_filters.go index dc8741fb6..c5c31bcc7 100644 --- a/pkg/istio/envoy_filters.go +++ b/pkg/istio/envoy_filters.go @@ -6,6 +6,7 @@ import ( istioapiv1alpha3 "istio.io/api/networking/v1alpha3" istionetworkingv1alpha3 "istio.io/client-go/pkg/apis/networking/v1alpha3" + "sigs.k8s.io/controller-runtime/pkg/client" "github.com/kuadrant/kuadrant-operator/pkg/common" diff --git a/pkg/istio/mesh_config.go b/pkg/istio/mesh_config.go index f9d202bf1..25433b796 100644 --- a/pkg/istio/mesh_config.go +++ b/pkg/istio/mesh_config.go @@ -3,17 +3,19 @@ package istio import ( "fmt" - maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/types/known/structpb" istiomeshv1alpha1 "istio.io/api/mesh/v1alpha1" istioapiv1alpha1 "istio.io/api/operator/v1alpha1" iopv1alpha1 "istio.io/istio/operator/pkg/apis/istio/v1alpha1" "istio.io/istio/pkg/util/protomarshal" - corev1 "k8s.io/api/core/v1" istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" "maistra.io/istio-operator/pkg/helm" + + corev1 "k8s.io/api/core/v1" "sigs.k8s.io/controller-runtime/pkg/client" + + maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" ) // The structs below implement the interface defined in pkg/common/mesh_config.go `ConfigWrapper` diff --git a/pkg/istio/mesh_config_test.go b/pkg/istio/mesh_config_test.go index 27e9b784b..6d21b7558 100644 --- a/pkg/istio/mesh_config_test.go +++ b/pkg/istio/mesh_config_test.go @@ -5,16 +5,18 @@ package istio import ( "testing" - maistrav1 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v1" - maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" "google.golang.org/protobuf/types/known/structpb" "gotest.tools/assert" istiomeshv1alpha1 "istio.io/api/mesh/v1alpha1" istioapiv1alpha1 "istio.io/api/operator/v1alpha1" iopv1alpha1 "istio.io/istio/operator/pkg/apis/istio/v1alpha1" - corev1 "k8s.io/api/core/v1" istiov1alpha1 "maistra.io/istio-operator/api/v1alpha1" "maistra.io/istio-operator/pkg/helm" + + corev1 "k8s.io/api/core/v1" + + maistrav1 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v1" + maistrav2 "github.com/kuadrant/kuadrant-operator/api/external/maistra/v2" ) func getStubbedMeshConfig() *istiomeshv1alpha1.MeshConfig { diff --git a/pkg/kuadranttools/limitador_tools.go b/pkg/kuadranttools/limitador_tools.go index 4710cc2ec..03c749cdb 100644 --- a/pkg/kuadranttools/limitador_tools.go +++ b/pkg/kuadranttools/limitador_tools.go @@ -4,9 +4,11 @@ import ( "fmt" "reflect" - "github.com/kuadrant/kuadrant-operator/api/v1beta1" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" + + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + + "github.com/kuadrant/kuadrant-operator/api/v1beta1" ) func LimitadorMutator(existingObj, desiredObj client.Object) (bool, error) { diff --git a/pkg/kuadranttools/limitador_tools_test.go b/pkg/kuadranttools/limitador_tools_test.go index bd531f49a..34e96b65c 100644 --- a/pkg/kuadranttools/limitador_tools_test.go +++ b/pkg/kuadranttools/limitador_tools_test.go @@ -7,14 +7,15 @@ import ( "strings" "testing" - "k8s.io/utils/ptr" - - "github.com/kuadrant/kuadrant-operator/api/v1beta1" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + "k8s.io/utils/ptr" "sigs.k8s.io/controller-runtime/pkg/client" + + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + + "github.com/kuadrant/kuadrant-operator/api/v1beta1" ) func TestLimitadorMutator(t *testing.T) { diff --git a/pkg/log/log.go b/pkg/log/log.go index b5c0d4fd7..35bd04622 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -24,6 +24,7 @@ import ( "github.com/go-logr/logr" "go.uber.org/zap/zapcore" + "k8s.io/klog/v2" ctrl "sigs.k8s.io/controller-runtime" ctrllog "sigs.k8s.io/controller-runtime/pkg/log" diff --git a/pkg/log/log_test.go b/pkg/log/log_test.go index a75171b03..6af484329 100644 --- a/pkg/log/log_test.go +++ b/pkg/log/log_test.go @@ -21,10 +21,10 @@ package log import ( "testing" - // In this package there is no ginkgo tests - // Required to parse command line ginkgo flags -ginkgo.v -ginkgo.progress _ "github.com/onsi/ginkgo/v2" "gotest.tools/assert" + // In this package there is no ginkgo tests + // Required to parse command line ginkgo flags -ginkgo.v -ginkgo.progress ) func TestToLevel(t *testing.T) { diff --git a/pkg/reconcilers/base_reconciler.go b/pkg/reconcilers/base_reconciler.go index addd9f095..b6abcf06c 100644 --- a/pkg/reconcilers/base_reconciler.go +++ b/pkg/reconcilers/base_reconciler.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" diff --git a/pkg/reconcilers/base_reconciler_test.go b/pkg/reconcilers/base_reconciler_test.go index 51d0845cc..9a283bbf2 100644 --- a/pkg/reconcilers/base_reconciler_test.go +++ b/pkg/reconcilers/base_reconciler_test.go @@ -26,6 +26,7 @@ import ( "github.com/go-logr/logr" . "github.com/onsi/ginkgo/v2" + appsv1 "k8s.io/api/apps/v1" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" diff --git a/pkg/reconcilers/targetref_reconciler.go b/pkg/reconcilers/targetref_reconciler.go index 76a0dab91..91c9b5a3a 100644 --- a/pkg/reconcilers/targetref_reconciler.go +++ b/pkg/reconcilers/targetref_reconciler.go @@ -22,6 +22,7 @@ import ( "sort" "github.com/go-logr/logr" + "k8s.io/apimachinery/pkg/api/meta" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/reconcilers/targetref_reconciler_test.go b/pkg/reconcilers/targetref_reconciler_test.go index 532395afb..815361e4c 100644 --- a/pkg/reconcilers/targetref_reconciler_test.go +++ b/pkg/reconcilers/targetref_reconciler_test.go @@ -24,7 +24,7 @@ import ( "testing" "github.com/go-logr/logr" - "github.com/kuadrant/kuadrant-operator/api/v1beta2" + appsv1 "k8s.io/api/apps/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -35,6 +35,7 @@ import ( gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" gatewayapiv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2" + "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/log" ) diff --git a/pkg/rlptools/rate_limit_index.go b/pkg/rlptools/rate_limit_index.go index a14d8cd93..8912278c0 100644 --- a/pkg/rlptools/rate_limit_index.go +++ b/pkg/rlptools/rate_limit_index.go @@ -6,9 +6,11 @@ import ( "strings" "github.com/elliotchance/orderedmap/v2" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + "sigs.k8s.io/controller-runtime/pkg/client" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/pkg/rlptools/rate_limit_index_test.go b/pkg/rlptools/rate_limit_index_test.go index e418f03fd..5e1e00fef 100644 --- a/pkg/rlptools/rate_limit_index_test.go +++ b/pkg/rlptools/rate_limit_index_test.go @@ -6,8 +6,9 @@ import ( "reflect" "testing" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" "sigs.k8s.io/controller-runtime/pkg/client" + + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" ) func TestRateLimitIndexSet(t *testing.T) { diff --git a/pkg/rlptools/utils_test.go b/pkg/rlptools/utils_test.go index c20db49ee..f3e21a850 100644 --- a/pkg/rlptools/utils_test.go +++ b/pkg/rlptools/utils_test.go @@ -7,9 +7,10 @@ import ( "regexp" "testing" - limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + limitadorv1alpha1 "github.com/kuadrant/limitador-operator/api/v1alpha1" + kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" "github.com/kuadrant/kuadrant-operator/pkg/common" ) diff --git a/pkg/rlptools/wasm/types.go b/pkg/rlptools/wasm/types.go index 52deee790..a28a11efe 100644 --- a/pkg/rlptools/wasm/types.go +++ b/pkg/rlptools/wasm/types.go @@ -4,6 +4,7 @@ import ( "encoding/json" _struct "google.golang.org/protobuf/types/known/structpb" + gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" kuadrantv1beta2 "github.com/kuadrant/kuadrant-operator/api/v1beta2" diff --git a/pkg/rlptools/wasm_utils.go b/pkg/rlptools/wasm_utils.go index 0452814e4..c422f9746 100644 --- a/pkg/rlptools/wasm_utils.go +++ b/pkg/rlptools/wasm_utils.go @@ -9,6 +9,7 @@ import ( _struct "google.golang.org/protobuf/types/known/structpb" istioclientgoextensionv1alpha1 "istio.io/client-go/pkg/apis/extensions/v1alpha1" + "k8s.io/utils/env" "sigs.k8s.io/controller-runtime/pkg/client" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1" diff --git a/pkg/rlptools/wasm_utils_test.go b/pkg/rlptools/wasm_utils_test.go index ad728fa90..633791c11 100644 --- a/pkg/rlptools/wasm_utils_test.go +++ b/pkg/rlptools/wasm_utils_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/google/go-cmp/cmp" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" gatewayapiv1 "sigs.k8s.io/gateway-api/apis/v1"