From 8975a6146d171e1990b331a92122f5f9ef5eef8d Mon Sep 17 00:00:00 2001 From: Manjunath A Kumatagi Date: Mon, 12 Sep 2022 17:24:15 +0530 Subject: [PATCH] Enhance the gci lint --- .golangci.yml | 11 ++++++++++- api/v1alpha3/conversion.go | 4 +++- api/v1alpha3/groupversion_info.go | 1 + api/v1alpha3/ibmvpccluster_types.go | 1 + api/v1alpha4/conversion.go | 1 + api/v1alpha4/groupversion_info.go | 1 + api/v1alpha4/ibmpowervs_conversion.go | 4 +++- api/v1alpha4/ibmpowervscluster_types.go | 1 + api/v1alpha4/ibmvpc_conversion.go | 1 + api/v1alpha4/ibmvpccluster_types.go | 1 + api/v1beta1/groupversion_info.go | 1 + api/v1beta1/ibmpowervscluster_types.go | 1 + api/v1beta1/ibmpowervscluster_webhook.go | 1 + api/v1beta1/ibmpowervsimage_types.go | 1 + api/v1beta1/ibmpowervsimage_webhook.go | 1 + api/v1beta1/ibmpowervsmachine_types.go | 1 + api/v1beta1/ibmpowervsmachine_webhook.go | 1 + api/v1beta1/ibmpowervsmachinetemplate_webhook.go | 1 + api/v1beta1/ibmvpccluster_types.go | 1 + api/v1beta1/ibmvpccluster_webhook.go | 1 + api/v1beta1/ibmvpcmachine_webhook.go | 1 + api/v1beta1/ibmvpcmachinetemplate_webhook.go | 1 + cloud/scope/cluster.go | 10 +++++++--- cloud/scope/machine.go | 10 +++++++--- cloud/scope/powervs_cluster.go | 10 +++++++--- cloud/scope/powervs_image.go | 10 +++++++--- cloud/scope/powervs_machine.go | 10 +++++++--- controllers/ibmpowervscluster_controller.go | 7 +++++-- controllers/ibmpowervsimage_controller.go | 12 ++++++++---- controllers/ibmpowervsmachine_controller.go | 12 ++++++++---- controllers/ibmvpccluster_controller.go | 14 +++++++++----- controllers/ibmvpcmachine_controller.go | 10 +++++++--- main.go | 8 ++++++-- pkg/cloud/services/utils/accounts.go | 3 ++- pkg/record/record.go | 1 + test/helpers/crd.go | 1 + test/helpers/envtest.go | 7 +++++-- util/util.go | 1 + 38 files changed, 123 insertions(+), 41 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 57e5b15c7..b96aa8fd5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -56,7 +56,16 @@ linters-settings: - '^ \+.*' - '^ ANCHOR.*' gci: - local-prefixes: "sigs.k8s.io/cluster-api-provider-ibmcloud" + sections: + - standard + - default + - prefix(github.com/IBM) + - prefix(k8s.io) + - prefix(sigs.k8s.io) + - prefix(sigs.k8s.io/cluster-api) + - prefix(sigs.k8s.io/cluster-api-provider-ibmcloud) + - blank + - dot importas: no-unaliased: true alias: diff --git a/api/v1alpha3/conversion.go b/api/v1alpha3/conversion.go index 27d3d36c8..4ee49facd 100644 --- a/api/v1alpha3/conversion.go +++ b/api/v1alpha3/conversion.go @@ -18,9 +18,11 @@ package v1alpha3 import ( apiconversion "k8s.io/apimachinery/pkg/conversion" + + "sigs.k8s.io/controller-runtime/pkg/conversion" + capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/controller-runtime/pkg/conversion" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" ) diff --git a/api/v1alpha3/groupversion_info.go b/api/v1alpha3/groupversion_info.go index 26e597bd6..70929d818 100644 --- a/api/v1alpha3/groupversion_info.go +++ b/api/v1alpha3/groupversion_info.go @@ -21,6 +21,7 @@ package v1alpha3 import ( "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" ) diff --git a/api/v1alpha3/ibmvpccluster_types.go b/api/v1alpha3/ibmvpccluster_types.go index 5d8e9c755..ef3310c4a 100644 --- a/api/v1alpha3/ibmvpccluster_types.go +++ b/api/v1alpha3/ibmvpccluster_types.go @@ -18,6 +18,7 @@ package v1alpha3 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3" ) diff --git a/api/v1alpha4/conversion.go b/api/v1alpha4/conversion.go index 8b8d41607..d918b7913 100644 --- a/api/v1alpha4/conversion.go +++ b/api/v1alpha4/conversion.go @@ -18,6 +18,7 @@ package v1alpha4 import ( apiconversion "k8s.io/apimachinery/pkg/conversion" + capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/api/v1alpha4/groupversion_info.go b/api/v1alpha4/groupversion_info.go index 0986718ae..afb71aa81 100644 --- a/api/v1alpha4/groupversion_info.go +++ b/api/v1alpha4/groupversion_info.go @@ -21,6 +21,7 @@ package v1alpha4 import ( "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" ) diff --git a/api/v1alpha4/ibmpowervs_conversion.go b/api/v1alpha4/ibmpowervs_conversion.go index 3c7ebcae6..2af58b2f3 100644 --- a/api/v1alpha4/ibmpowervs_conversion.go +++ b/api/v1alpha4/ibmpowervs_conversion.go @@ -18,9 +18,11 @@ package v1alpha4 import ( apiconversion "k8s.io/apimachinery/pkg/conversion" - utilconversion "sigs.k8s.io/cluster-api/util/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" + utilconversion "sigs.k8s.io/cluster-api/util/conversion" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" ) diff --git a/api/v1alpha4/ibmpowervscluster_types.go b/api/v1alpha4/ibmpowervscluster_types.go index 755666223..76c8ae634 100644 --- a/api/v1alpha4/ibmpowervscluster_types.go +++ b/api/v1alpha4/ibmpowervscluster_types.go @@ -18,6 +18,7 @@ package v1alpha4 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" ) diff --git a/api/v1alpha4/ibmvpc_conversion.go b/api/v1alpha4/ibmvpc_conversion.go index c3a6d3adf..66754f7f2 100644 --- a/api/v1alpha4/ibmvpc_conversion.go +++ b/api/v1alpha4/ibmvpc_conversion.go @@ -18,6 +18,7 @@ package v1alpha4 import ( apiconversion "k8s.io/apimachinery/pkg/conversion" + "sigs.k8s.io/controller-runtime/pkg/conversion" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" diff --git a/api/v1alpha4/ibmvpccluster_types.go b/api/v1alpha4/ibmvpccluster_types.go index 86decc1bd..c2c1f2eae 100644 --- a/api/v1alpha4/ibmvpccluster_types.go +++ b/api/v1alpha4/ibmvpccluster_types.go @@ -18,6 +18,7 @@ package v1alpha4 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4" ) diff --git a/api/v1beta1/groupversion_info.go b/api/v1beta1/groupversion_info.go index 79c7142cc..6d3c4533e 100644 --- a/api/v1beta1/groupversion_info.go +++ b/api/v1beta1/groupversion_info.go @@ -21,6 +21,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" ) diff --git a/api/v1beta1/ibmpowervscluster_types.go b/api/v1beta1/ibmpowervscluster_types.go index 7048c6754..926a92aaa 100644 --- a/api/v1beta1/ibmpowervscluster_types.go +++ b/api/v1beta1/ibmpowervscluster_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/api/v1beta1/ibmpowervscluster_webhook.go b/api/v1beta1/ibmpowervscluster_webhook.go index f26b58c7a..b28352cc4 100644 --- a/api/v1beta1/ibmpowervscluster_webhook.go +++ b/api/v1beta1/ibmpowervscluster_webhook.go @@ -21,6 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmpowervsimage_types.go b/api/v1beta1/ibmpowervsimage_types.go index 198489b0e..f87eb5a29 100644 --- a/api/v1beta1/ibmpowervsimage_types.go +++ b/api/v1beta1/ibmpowervsimage_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/api/v1beta1/ibmpowervsimage_webhook.go b/api/v1beta1/ibmpowervsimage_webhook.go index 3549d6bdf..80c7e94b4 100644 --- a/api/v1beta1/ibmpowervsimage_webhook.go +++ b/api/v1beta1/ibmpowervsimage_webhook.go @@ -18,6 +18,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmpowervsmachine_types.go b/api/v1beta1/ibmpowervsmachine_types.go index 3be40f1e0..11622ccf7 100644 --- a/api/v1beta1/ibmpowervsmachine_types.go +++ b/api/v1beta1/ibmpowervsmachine_types.go @@ -19,6 +19,7 @@ package v1beta1 import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/errors" ) diff --git a/api/v1beta1/ibmpowervsmachine_webhook.go b/api/v1beta1/ibmpowervsmachine_webhook.go index 51b3b01ce..ba804d209 100644 --- a/api/v1beta1/ibmpowervsmachine_webhook.go +++ b/api/v1beta1/ibmpowervsmachine_webhook.go @@ -21,6 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmpowervsmachinetemplate_webhook.go b/api/v1beta1/ibmpowervsmachinetemplate_webhook.go index eea70818f..235567c84 100644 --- a/api/v1beta1/ibmpowervsmachinetemplate_webhook.go +++ b/api/v1beta1/ibmpowervsmachinetemplate_webhook.go @@ -21,6 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmvpccluster_types.go b/api/v1beta1/ibmvpccluster_types.go index b3e01b5ff..a93a743d2 100644 --- a/api/v1beta1/ibmvpccluster_types.go +++ b/api/v1beta1/ibmvpccluster_types.go @@ -18,6 +18,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" ) diff --git a/api/v1beta1/ibmvpccluster_webhook.go b/api/v1beta1/ibmvpccluster_webhook.go index 037721c0a..2b9ea9875 100644 --- a/api/v1beta1/ibmvpccluster_webhook.go +++ b/api/v1beta1/ibmvpccluster_webhook.go @@ -18,6 +18,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmvpcmachine_webhook.go b/api/v1beta1/ibmvpcmachine_webhook.go index e29101033..8ce799cb8 100644 --- a/api/v1beta1/ibmvpcmachine_webhook.go +++ b/api/v1beta1/ibmvpcmachine_webhook.go @@ -18,6 +18,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/api/v1beta1/ibmvpcmachinetemplate_webhook.go b/api/v1beta1/ibmvpcmachinetemplate_webhook.go index 9ebd586b7..eb1ba5d13 100644 --- a/api/v1beta1/ibmvpcmachinetemplate_webhook.go +++ b/api/v1beta1/ibmvpcmachinetemplate_webhook.go @@ -18,6 +18,7 @@ package v1beta1 import ( "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" logf "sigs.k8s.io/controller-runtime/pkg/log" "sigs.k8s.io/controller-runtime/pkg/webhook" diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index d17cd9186..4c36aa147 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -20,14 +20,18 @@ import ( "context" "fmt" - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" + "k8s.io/klog/v2/klogr" + + "sigs.k8s.io/controller-runtime/pkg/client" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" - "sigs.k8s.io/controller-runtime/pkg/client" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/vpc" diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index c3a40eba5..5d950c8f6 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -19,16 +19,20 @@ package scope import ( "context" - "github.com/IBM/go-sdk-core/v5/core" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM/go-sdk-core/v5/core" + "github.com/IBM/vpc-go-sdk/vpcv1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog/v2/klogr" + + "sigs.k8s.io/controller-runtime/pkg/client" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" - "sigs.k8s.io/controller-runtime/pkg/client" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/vpc" diff --git a/cloud/scope/powervs_cluster.go b/cloud/scope/powervs_cluster.go index ceacc72a2..71218396c 100644 --- a/cloud/scope/powervs_cluster.go +++ b/cloud/scope/powervs_cluster.go @@ -20,15 +20,19 @@ import ( "context" "fmt" + "github.com/go-logr/logr" + "github.com/pkg/errors" + "github.com/IBM-Cloud/power-go-client/ibmpisession" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" - "github.com/go-logr/logr" - "github.com/pkg/errors" + "k8s.io/klog/v2/klogr" + + "sigs.k8s.io/controller-runtime/pkg/client" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util/patch" - "sigs.k8s.io/controller-runtime/pkg/client" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs" diff --git a/cloud/scope/powervs_image.go b/cloud/scope/powervs_image.go index 88e2380c6..71f6ff851 100644 --- a/cloud/scope/powervs_image.go +++ b/cloud/scope/powervs_image.go @@ -20,16 +20,20 @@ import ( "context" "fmt" + "github.com/go-logr/logr" + "github.com/pkg/errors" + "github.com/IBM-Cloud/power-go-client/ibmpisession" "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" - "github.com/go-logr/logr" - "github.com/pkg/errors" + "k8s.io/klog/v2/klogr" - "sigs.k8s.io/cluster-api/util/patch" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/cluster-api/util/patch" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/resourcecontroller" diff --git a/cloud/scope/powervs_machine.go b/cloud/scope/powervs_machine.go index de86885d4..c60a8f289 100644 --- a/cloud/scope/powervs_machine.go +++ b/cloud/scope/powervs_machine.go @@ -23,22 +23,26 @@ import ( "strconv" "strings" + "github.com/go-logr/logr" + "github.com/pkg/errors" + "github.com/IBM-Cloud/power-go-client/ibmpisession" "github.com/IBM-Cloud/power-go-client/power/client/p_cloud_p_vm_instances" "github.com/IBM-Cloud/power-go-client/power/models" "github.com/IBM/go-sdk-core/v5/core" "github.com/IBM/platform-services-go-sdk/resourcecontrollerv2" - "github.com/go-logr/logr" - "github.com/pkg/errors" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/cache" "k8s.io/klog/v2/klogr" "k8s.io/utils/pointer" + + "sigs.k8s.io/controller-runtime/pkg/client" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util/patch" - "sigs.k8s.io/controller-runtime/pkg/client" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/cloud/services/powervs" diff --git a/controllers/ibmpowervscluster_controller.go b/controllers/ibmpowervscluster_controller.go index 405362363..a6f741d86 100644 --- a/controllers/ibmpowervscluster_controller.go +++ b/controllers/ibmpowervscluster_controller.go @@ -23,18 +23,21 @@ import ( "github.com/go-logr/logr" "github.com/pkg/errors" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/tools/record" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/cluster-api/util" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/util" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints" diff --git a/controllers/ibmpowervsimage_controller.go b/controllers/ibmpowervsimage_controller.go index 2f370e585..bc21df4a7 100644 --- a/controllers/ibmpowervsimage_controller.go +++ b/controllers/ibmpowervsimage_controller.go @@ -21,21 +21,25 @@ import ( "fmt" "time" - "github.com/IBM-Cloud/power-go-client/power/models" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM-Cloud/power-go-client/power/models" + apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - clusterv1util "sigs.k8s.io/cluster-api/util" - "sigs.k8s.io/cluster-api/util/conditions" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1util "sigs.k8s.io/cluster-api/util" + "sigs.k8s.io/cluster-api/util/conditions" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints" diff --git a/controllers/ibmpowervsmachine_controller.go b/controllers/ibmpowervsmachine_controller.go index 4627b6cac..f6c223007 100644 --- a/controllers/ibmpowervsmachine_controller.go +++ b/controllers/ibmpowervsmachine_controller.go @@ -20,20 +20,24 @@ import ( "context" "time" - "github.com/IBM-Cloud/power-go-client/power/models" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM-Cloud/power-go-client/power/models" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/record" + + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" - ctrl "sigs.k8s.io/controller-runtime" - "sigs.k8s.io/controller-runtime/pkg/client" - "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope" diff --git a/controllers/ibmvpccluster_controller.go b/controllers/ibmvpccluster_controller.go index c837f2aa0..e2e7917a7 100644 --- a/controllers/ibmvpccluster_controller.go +++ b/controllers/ibmvpccluster_controller.go @@ -20,21 +20,25 @@ import ( "context" "time" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM/vpc-go-sdk/vpcv1" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/cluster-api/util" - "sigs.k8s.io/cluster-api/util/conditions" - "sigs.k8s.io/cluster-api/util/predicates" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/util" + "sigs.k8s.io/cluster-api/util/conditions" + "sigs.k8s.io/cluster-api/util/predicates" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints" diff --git a/controllers/ibmvpcmachine_controller.go b/controllers/ibmvpcmachine_controller.go index de96b42a3..c770f072d 100644 --- a/controllers/ibmvpcmachine_controller.go +++ b/controllers/ibmvpcmachine_controller.go @@ -21,20 +21,24 @@ import ( "fmt" "time" - "github.com/IBM/vpc-go-sdk/vpcv1" "github.com/go-logr/logr" "github.com/pkg/errors" + + "github.com/IBM/vpc-go-sdk/vpcv1" + corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" "k8s.io/utils/pointer" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - "sigs.k8s.io/cluster-api/util" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + "sigs.k8s.io/cluster-api/util" + infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" "sigs.k8s.io/cluster-api-provider-ibmcloud/cloud/scope" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints" diff --git a/main.go b/main.go index 1fe0f8b2e..ca331f214 100644 --- a/main.go +++ b/main.go @@ -25,15 +25,17 @@ import ( // +kubebuilder:scaffold:imports "github.com/spf13/pflag" + "k8s.io/apimachinery/pkg/runtime" clientgoscheme "k8s.io/client-go/kubernetes/scheme" - _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" cgrecord "k8s.io/client-go/tools/record" "k8s.io/klog/v2" "k8s.io/klog/v2/klogr" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + ctrl "sigs.k8s.io/controller-runtime" + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + infrav1alpha3 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha3" infrav1alpha4 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1alpha4" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1" @@ -41,6 +43,8 @@ import ( "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/endpoints" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/options" "sigs.k8s.io/cluster-api-provider-ibmcloud/pkg/record" + + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" ) var ( diff --git a/pkg/cloud/services/utils/accounts.go b/pkg/cloud/services/utils/accounts.go index 813ccc349..03e896f40 100644 --- a/pkg/cloud/services/utils/accounts.go +++ b/pkg/cloud/services/utils/accounts.go @@ -21,8 +21,9 @@ import ( "net/http" "strings" - "github.com/IBM/go-sdk-core/v5/core" "github.com/golang-jwt/jwt" + + "github.com/IBM/go-sdk-core/v5/core" ) // GetAccount is function parses the account number from the token and returns it. diff --git a/pkg/record/record.go b/pkg/record/record.go index 6182915d0..b212a0721 100644 --- a/pkg/record/record.go +++ b/pkg/record/record.go @@ -21,6 +21,7 @@ import ( "golang.org/x/text/cases" "golang.org/x/text/language" + corev1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" cgrecord "k8s.io/client-go/tools/record" diff --git a/test/helpers/crd.go b/test/helpers/crd.go index 81fbb5043..0839cb05e 100644 --- a/test/helpers/crd.go +++ b/test/helpers/crd.go @@ -19,6 +19,7 @@ package helpers import ( "golang.org/x/text/cases" "golang.org/x/text/language" + apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/utils/pointer" diff --git a/test/helpers/envtest.go b/test/helpers/envtest.go index 1ba58904e..4cc1ba3ee 100644 --- a/test/helpers/envtest.go +++ b/test/helpers/envtest.go @@ -29,6 +29,7 @@ import ( "time" "github.com/pkg/errors" + admissionv1 "k8s.io/api/admissionregistration/v1" corev1 "k8s.io/api/core/v1" apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" @@ -40,12 +41,14 @@ import ( "k8s.io/client-go/rest" "k8s.io/klog/v2" "k8s.io/klog/v2/klogr" - capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" - utilyaml "sigs.k8s.io/cluster-api/util/yaml" + ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/envtest" "sigs.k8s.io/controller-runtime/pkg/manager" + + capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + utilyaml "sigs.k8s.io/cluster-api/util/yaml" ) const ( diff --git a/util/util.go b/util/util.go index 6726d8dd3..9a9e9f95f 100644 --- a/util/util.go +++ b/util/util.go @@ -20,6 +20,7 @@ import ( "context" "github.com/pkg/errors" + "sigs.k8s.io/controller-runtime/pkg/client" infrav1beta1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"