Skip to content

Commit 20c609d

Browse files
committed
allocator: improve consistency in logging messages
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent b0ee1de commit 20c609d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

manager/allocator/network.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd
10261026

10271027
lbAttachment.Network = network.Copy()
10281028
if err := a.netCtx.nwkAllocator.AllocateAttachment(node, lbAttachment); err != nil {
1029-
log.G(ctx).WithError(err).Errorf("Failed to allocate network resources for node %s", node.ID)
1029+
log.G(ctx).WithError(err).WithField("network.id", lbAttachment.Network.ID).Errorf("failed to allocate network resources for node %s", node.ID)
10301030
// TODO: Should we add a unallocatedNode and retry allocating resources like we do for network, tasks, services?
10311031
// right now, we will only retry allocating network resources for the node when the node is updated.
10321032
continue
@@ -1059,8 +1059,7 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd
10591059

10601060
if err := a.netCtx.nwkAllocator.DeallocateAttachment(node, na); err != nil {
10611061
// failed to deallocate; there's nothing we can do besides log an error and keep going
1062-
log.G(ctx).WithError(err).Errorf("error deallocating attachment for network %v on node %v",
1063-
na.Network.ID, node.ID)
1062+
log.G(ctx).WithError(err).WithField("network.id", na.Network.ID).Errorf("failed to deallocate network resources on node %s", node.ID)
10641063
}
10651064

10661065
// strictly speaking, nothing was allocated, but something was

0 commit comments

Comments
 (0)