Skip to content

Commit

Permalink
add debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke-Smartnews committed May 16, 2024
1 parent bb9def0 commit 4ce36e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/controllers/provisioning/provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,13 @@ func (p *Provisioner) isPodHandled(ctx context.Context, pod *v1.Pod) (err error)
"involvedObject.name": pod.Name,
"reason": "HandledByKarpenter",
}
logging.FromContext(ctx).Infof("get event for %s/%s", pod.Namespace, pod.Name)
if err := p.kubeClient.List(ctx, &events, filter); err == nil {
for _, event := range events.Items {
logging.FromContext(ctx).Infof("process event %s", event.Name)
// ignore the pod if it's already handled in 3 minute
if !time.Now().Add(3 * time.Minute).After(event.LastTimestamp.Time) {
logging.FromContext(ctx).Infof("%s/%s is being handled", pod.Namespace, pod.Name)
return fmt.Errorf("pod is handled")
}
}
Expand Down

0 comments on commit 4ce36e2

Please sign in to comment.