From 0a0ebc90be71fe7b35c1d5dc8b5f9eadecd1cac8 Mon Sep 17 00:00:00 2001 From: Garvin Pang Date: Sun, 21 Apr 2024 14:57:33 -0700 Subject: [PATCH] Fix log which causes panic (#407) * Fix log which causes panic * Consistent key name * consistent naming --- pkg/provider/branch/provider.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/provider/branch/provider.go b/pkg/provider/branch/provider.go index b52f9504..4028300b 100644 --- a/pkg/provider/branch/provider.go +++ b/pkg/provider/branch/provider.go @@ -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 } @@ -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) @@ -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 } @@ -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) @@ -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 }