Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor logging touchups #852

Merged
merged 3 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ require (
sigs.k8s.io/controller-runtime v0.9.7
)

require go.uber.org/zap v1.19.1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why go mod tidy did this.


require (
cloud.google.com/go v0.97.0 // indirect
contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect
Expand Down Expand Up @@ -67,7 +69,6 @@ require (
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/automaxprocs v1.4.0 // indirect
go.uber.org/zap v1.19.1 // indirect
golang.org/x/net v0.0.0-20211101193420-4a448f8816b3 // indirect
golang.org/x/oauth2 v0.0.0-20211028175245-ba495a64dcb5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
Expand Down
6 changes: 2 additions & 4 deletions pkg/controllers/metrics/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ package metrics

import (
"context"
"fmt"
"time"

"github.com/aws/karpenter/pkg/apis/provisioning/v1alpha5"
"github.com/aws/karpenter/pkg/cloudprovider"
"go.uber.org/multierr"
"go.uber.org/zap"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/sets"
Expand All @@ -47,9 +47,7 @@ func NewController(kubeClient client.Client, cloudProvider cloudprovider.CloudPr
}

func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
loggerName := fmt.Sprintf("%s.provisioner/%s", controllerName, req.Name)
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named(loggerName))

ctx = logging.WithLogger(ctx, zap.NewNop().Sugar())
// Does the provisioner exist?
provisioner := &v1alpha5.Provisioner{}
if err := c.KubeClient.Get(ctx, req.NamespacedName, provisioner); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/node/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ type Controller struct {

// Reconcile executes a reallocation control loop for the resource
func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("node").With("node", req.String()))
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("node").With("node", req.Name))
// 1. Retrieve Node, ignore if not provisioned or terminating
stored := &v1.Node{}
if err := c.kubeClient.Get(ctx, req.NamespacedName, stored); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/termination/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func NewController(ctx context.Context, kubeClient client.Client, coreV1Client c

// Reconcile executes a termination control loop for the resource
func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("termination").With("node", req.String()))
ctx = logging.WithLogger(ctx, logging.FromContext(ctx).Named("termination").With("node", req.Name))

// 1. Retrieve node from reconcile request
node := &v1.Node{}
Expand Down