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

Fix log which causes panic #407

Merged
merged 3 commits into from
Apr 21, 2024
Merged
Changes from all 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
12 changes: 6 additions & 6 deletions pkg/provider/branch/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func timeSinceMs(start time.Time) float64 {
// cache for use in future Create/Delete Requests
func (b *branchENIProvider) InitResource(instance ec2.EC2Instance) error {
nodeName := instance.Name()
log := b.log.WithValues("node name", nodeName)
log := b.log.WithValues("nodeName", nodeName)
trunkENI := trunk.NewTrunkENI(log, instance, b.apiWrapper.EC2API)

// Initialize the Trunk ENI
Expand Down Expand Up @@ -242,7 +242,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 @@ -272,7 +272,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 @@ -284,7 +284,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 @@ -344,7 +344,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 @@ -406,7 +406,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
Loading