diff --git a/cmd/controller/main.go b/cmd/controller/main.go index a7bc063901e1..dbdc0aaf83e8 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -90,7 +90,7 @@ func main() { allocation.NewController(manager.GetClient(), clientSet.CoreV1(), cloudProvider), termination.NewController(ctx, manager.GetClient(), clientSet.CoreV1(), cloudProvider), node.NewController(manager.GetClient()), - &nodemetrics.Controller{KubeClient: manager.GetClient()}, + nodemetrics.NewController(manager.GetClient()), ).Start(ctx); err != nil { panic(fmt.Sprintf("Unable to start manager, %s", err.Error())) } diff --git a/pkg/controllers/metrics/node/controller.go b/pkg/controllers/metrics/node/controller.go index 7571740bb479..a72b0da68941 100644 --- a/pkg/controllers/metrics/node/controller.go +++ b/pkg/controllers/metrics/node/controller.go @@ -35,6 +35,10 @@ type Controller struct { KubeClient client.Client } +func NewController(kubeClient client.Client) *Controller { + return &Controller{KubeClient: kubeClient} +} + func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("NodeMetrics"))