Skip to content

Commit

Permalink
chore: add pod information to debug log (#2087)
Browse files Browse the repository at this point in the history
When analyzing a log it would have been helpful to know which pod
this log referred to.
  • Loading branch information
tzneal authored Jul 8, 2022
1 parent 007c192 commit 0b49113
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/controllers/provisioning/scheduling/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
v1 "k8s.io/api/core/v1"
"knative.dev/pkg/logging"
"knative.dev/pkg/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/aws/karpenter/pkg/utils/pretty"
)
Expand All @@ -38,7 +39,10 @@ func (p *Preferences) Relax(ctx context.Context, pod *v1.Pod) bool {
p.toleratePreferNoScheduleTaints,
} {
if reason := relaxFunc(pod); reason != nil {
logging.FromContext(ctx).Debugf("Relaxing soft constraints for pod since it previously failed to schedule, %s", ptr.StringValue(reason))

logging.FromContext(ctx).
With("pod", client.ObjectKeyFromObject(pod)).
Debugf("Relaxing soft constraints for pod since it previously failed to schedule, %s", ptr.StringValue(reason))
return true
}
}
Expand Down

0 comments on commit 0b49113

Please sign in to comment.