Skip to content

Commit

Permalink
add constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
cjerad committed Sep 24, 2021
1 parent 3e579f1 commit 61fb971
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/controllers/metrics/node/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand Down

0 comments on commit 61fb971

Please sign in to comment.