Skip to content

Commit 6841338

Browse files
committed
refactor(controller): reorganize imports for consistency
Moved import statements for 'teranodev1alpha1' and 'utils' to a consistent position across multiple controller files to improve readability and maintainability.
1 parent bab5d00 commit 6841338

93 files changed

Lines changed: 214 additions & 211 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cmd/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,22 @@ import (
2525
"sort"
2626
"strings"
2727

28-
"sigs.k8s.io/controller-runtime/pkg/cache"
28+
"k8s.io/apimachinery/pkg/runtime"
29+
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
30+
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
2931

3032
// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
3133
// to ensure that exec-entrypoint and run can make use of them.
3234
_ "k8s.io/client-go/plugin/pkg/client/auth"
33-
34-
"k8s.io/apimachinery/pkg/runtime"
35-
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
36-
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3735
ctrl "sigs.k8s.io/controller-runtime"
36+
"sigs.k8s.io/controller-runtime/pkg/cache"
3837
"sigs.k8s.io/controller-runtime/pkg/healthz"
3938
"sigs.k8s.io/controller-runtime/pkg/log/zap"
4039
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
4140
"sigs.k8s.io/controller-runtime/pkg/webhook"
4241

4342
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
4443
"github.com/bsv-blockchain/teranode-operator/internal/controller"
45-
//+kubebuilder:scaffold:imports
4644
)
4745

4846
var (

internal/controller/alert_system_deployment.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package controller
22

33
import (
4-
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
5-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
64
"github.com/go-logr/logr"
75
appsv1 "k8s.io/api/apps/v1"
86
corev1 "k8s.io/api/core/v1"
@@ -11,6 +9,9 @@ import (
119
"k8s.io/apimachinery/pkg/util/intstr"
1210
"k8s.io/utils/ptr"
1311
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
12+
13+
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
14+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
1415
)
1516

1617
// ReconcileDeployment is the alert service deployment reconciler

internal/controller/alert_system_service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package controller
22

33
import (
4-
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
5-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
64
"github.com/go-logr/logr"
75
corev1 "k8s.io/api/core/v1"
86
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
97
"k8s.io/apimachinery/pkg/util/intstr"
108
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
9+
10+
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
11+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
1112
)
1213

1314
// ReconcileService is the alert service reconciler

internal/controller/alertsystem_controller.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,19 @@ import (
2020
"context"
2121
"time"
2222

23-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
2423
"github.com/go-logr/logr"
2524
appsv1 "k8s.io/api/apps/v1"
2625
corev1 "k8s.io/api/core/v1"
2726
apimeta "k8s.io/apimachinery/pkg/api/meta"
2827
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29-
"k8s.io/apimachinery/pkg/types"
30-
3128
"k8s.io/apimachinery/pkg/runtime"
29+
"k8s.io/apimachinery/pkg/types"
3230
ctrl "sigs.k8s.io/controller-runtime"
3331
"sigs.k8s.io/controller-runtime/pkg/client"
3432
"sigs.k8s.io/controller-runtime/pkg/log"
3533

3634
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
35+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
3736
)
3837

3938
// AlertSystemReconciler reconciles a AlertSystem object

internal/controller/alertsystem_controller_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ import (
2222
. "github.com/onsi/ginkgo/v2"
2323
. "github.com/onsi/gomega"
2424
"k8s.io/apimachinery/pkg/api/errors"
25+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
"k8s.io/apimachinery/pkg/types"
2627
"sigs.k8s.io/controller-runtime/pkg/reconcile"
2728

28-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29-
3029
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
3130
)
3231

internal/controller/asset_controller.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,20 @@ import (
2020
"context"
2121
"time"
2222

23-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
2423
"github.com/go-logr/logr"
2524
appsv1 "k8s.io/api/apps/v1"
2625
corev1 "k8s.io/api/core/v1"
2726
networkingv1 "k8s.io/api/networking/v1"
2827
apimeta "k8s.io/apimachinery/pkg/api/meta"
2928
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
30-
"k8s.io/apimachinery/pkg/types"
31-
3229
"k8s.io/apimachinery/pkg/runtime"
30+
"k8s.io/apimachinery/pkg/types"
3331
ctrl "sigs.k8s.io/controller-runtime"
3432
"sigs.k8s.io/controller-runtime/pkg/client"
3533
"sigs.k8s.io/controller-runtime/pkg/log"
3634

3735
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
36+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
3837
)
3938

4039
// AssetReconciler reconciles a Asset object

internal/controller/asset_controller_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ import (
2222
. "github.com/onsi/ginkgo/v2"
2323
. "github.com/onsi/gomega"
2424
"k8s.io/apimachinery/pkg/api/errors"
25+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
"k8s.io/apimachinery/pkg/types"
2627
"sigs.k8s.io/controller-runtime/pkg/reconcile"
2728

28-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
29-
3029
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
3130
)
3231

internal/controller/asset_deployment.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package controller
22

33
import (
4-
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
5-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
64
"github.com/go-logr/logr"
75
appsv1 "k8s.io/api/apps/v1"
86
corev1 "k8s.io/api/core/v1"
@@ -11,6 +9,9 @@ import (
119
"k8s.io/apimachinery/pkg/util/intstr"
1210
"k8s.io/utils/ptr"
1311
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
12+
13+
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
14+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
1415
)
1516

1617
// ReconcileDeployment is the asset service deployment reconciler

internal/controller/asset_ingress.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package controller
22

33
import (
4-
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
54
"github.com/go-logr/logr"
65
v1 "k8s.io/api/networking/v1"
76
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
87
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
8+
9+
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
910
)
1011

1112
// ReconcileHTTPIngress is the ingress for the asset grpc server

internal/controller/asset_service.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package controller
22

33
import (
4-
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
5-
"github.com/bsv-blockchain/teranode-operator/internal/utils"
64
"github.com/go-logr/logr"
75
corev1 "k8s.io/api/core/v1"
86
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
97
"k8s.io/apimachinery/pkg/util/intstr"
108
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
9+
10+
teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
11+
"github.com/bsv-blockchain/teranode-operator/internal/utils"
1112
)
1213

1314
// ReconcileService is the asset service reconciler

0 commit comments

Comments
 (0)