@@ -25,9 +25,12 @@ import (
2525 "sort"
2626 "strings"
2727
28+ teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
29+ appsv1 "k8s.io/api/apps/v1"
30+ scalev1 "k8s.io/api/autoscaling/v1"
31+ corev1 "k8s.io/api/core/v1"
32+ networkingv1 "k8s.io/api/networking/v1"
2833 "k8s.io/apimachinery/pkg/runtime"
29- utilruntime "k8s.io/apimachinery/pkg/util/runtime"
30- clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3134
3235 // Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
3336 // to ensure that exec-entrypoint and run can make use of them.
@@ -39,7 +42,6 @@ import (
3942 metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
4043 "sigs.k8s.io/controller-runtime/pkg/webhook"
4144
42- teranodev1alpha1 "github.com/bsv-blockchain/teranode-operator/api/v1alpha1"
4345 "github.com/bsv-blockchain/teranode-operator/internal/controller"
4446)
4547
@@ -55,13 +57,6 @@ const (
5557 CreateControllerError = "unable to create controller"
5658)
5759
58- func init () {
59- utilruntime .Must (clientgoscheme .AddToScheme (scheme ))
60-
61- utilruntime .Must (teranodev1alpha1 .AddToScheme (scheme ))
62- //+kubebuilder:scaffold:scheme
63- }
64-
6560//nolint:gocognit,gocyclo // Main function complexity is acceptable for initialization
6661func main () {
6762 var metricsAddr string
@@ -70,7 +65,7 @@ func main() {
7065 var secureMetrics bool
7166 var enableHTTP2 bool
7267 flag .StringVar (& metricsAddr , "metrics-bind-address" , ":8080" , "The address the metric endpoint binds to." )
73- flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8081 " , "The address the probe endpoint binds to." )
68+ flag .StringVar (& probeAddr , "health-probe-bind-address" , ":8181 " , "The address the probe endpoint binds to." )
7469 flag .BoolVar (& enableLeaderElection , "leader-elect" , false ,
7570 "Enable leader election for controller manager. " +
7671 "Enabling this will ensure there is only one active controller manager." )
@@ -84,6 +79,33 @@ func main() {
8479 opts .BindFlags (flag .CommandLine )
8580 flag .Parse ()
8681
82+ if err := scalev1 .AddToScheme (scheme ); err != nil {
83+ setupLog .Error (err , "unable to add autoscaling/v1 scheme" )
84+ os .Exit (1 )
85+ }
86+
87+ if err := teranodev1alpha1 .AddToScheme (scheme ); err != nil {
88+ setupLog .Error (err , "unable to add v1alpha1 scheme" )
89+ os .Exit (1 )
90+ }
91+
92+ if err := appsv1 .AddToScheme (scheme ); err != nil {
93+ setupLog .Error (err , "unable to add apps/v1 scheme" )
94+ os .Exit (1 )
95+ }
96+
97+ if err := corev1 .AddToScheme (scheme ); err != nil {
98+ setupLog .Error (err , "unable to add core/v1 scheme" )
99+ os .Exit (1 )
100+ }
101+
102+ if err := networkingv1 .AddToScheme (scheme ); err != nil {
103+ setupLog .Error (err , "unable to add networking/v1 scheme" )
104+ os .Exit (1 )
105+ }
106+
107+ //+kubebuilder:scaffold:scheme
108+
87109 ctrl .SetLogger (zap .New (zap .UseFlagOptions (& opts )))
88110
89111 // if the enable-http2 flag is false (the default), http/2 should be disabled
0 commit comments