Skip to content

Commit

Permalink
Fix log which causes panic (aws#407)
Browse files Browse the repository at this point in the history
* Fix log which causes panic

* Consistent key name

* consistent naming
  • Loading branch information
GnatorX authored and yash97 committed Nov 14, 2024
1 parent ac17ccc commit 0a0ebc9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/provider/branch/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (b *branchENIProvider) DeleteNode(nodeName string) (ctrl.Result, error) {
trunkENI.DeleteAllBranchENIs()
b.removeTrunkFromCache(nodeName)

b.log.Info("de-initialized resource provider successfully", "node name", nodeName)
b.log.Info("de-initialized resource provider successfully", "nodeName", nodeName)

return ctrl.Result{}, nil
}
Expand Down Expand Up @@ -276,7 +276,7 @@ func (b *branchENIProvider) ReconcileNode(nodeName string) bool {
log := b.log.WithValues("node", nodeName)
if !isPresent {
// return true to set the node next clean up asap since we don't know why trunk is missing
log.Info("no trunk ENI is pointing to the given node", "NodeName", nodeName)
log.Info("no trunk ENI is pointing to the given node", "nodeName", nodeName)
return true
}
podList, err := b.apiWrapper.PodAPI.ListPods(nodeName)
Expand All @@ -288,7 +288,7 @@ func (b *branchENIProvider) ReconcileNode(nodeName string) bool {
}
foundLeakedENI := trunkENI.Reconcile(podList.Items)

log.Info("completed reconcile node cleanup on branch ENIs", "NodeName", nodeName)
log.Info("completed reconcile node cleanup on branch ENIs", "nodeName", nodeName)

return foundLeakedENI
}
Expand Down Expand Up @@ -348,7 +348,7 @@ func (b *branchENIProvider) CreateAndAnnotateResources(podNamespace string, podN
"Security Groups %v", securityGroups), v1.EventTypeNormal)
}

log := b.log.WithValues("pod namespace", pod.Namespace, "pod name", pod.Name, "node name", pod.Spec.NodeName)
log := b.log.WithValues("pod namespace", pod.Namespace, "pod name", pod.Name, "nodeName", pod.Spec.NodeName)

start := time.Now()
trunkENI, isPresent := b.getTrunkFromCache(pod.Spec.NodeName)
Expand Down Expand Up @@ -411,7 +411,7 @@ func (b *branchENIProvider) DeleteBranchUsedByPods(nodeName string, UID string)
// trunk cache is local map with lock. it shouldn't return not found error if trunk exists
// if the node's trunk is not found, we shouldn't retry
// worst case we rely on node based clean up goroutines to clean branch ENIs up
b.log.Info("failed to find trunk ENI for the node %s", nodeName)
b.log.Info("failed to find trunk ENI for the node", "nodeName", nodeName)
return ctrl.Result{}, nil
}

Expand Down

0 comments on commit 0a0ebc9

Please sign in to comment.