Skip to content

Commit 2179e0e

Browse files
committed
allocator: improve consistency in logging messages
Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 971b9d5 commit 2179e0e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

manager/allocator/network.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,10 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd
10241024

10251025
lbAttachment.Network = network.Copy()
10261026
if err := a.netCtx.nwkAllocator.AllocateAttachment(node, lbAttachment); err != nil {
1027-
log.G(ctx).WithError(err).Errorf("Failed to allocate network resources for node %s", node.ID)
1027+
log.G(ctx).WithError(err).WithField("network.id", lbAttachment.Network.ID).Errorf(
1028+
"failed to allocate network resources for node %s",
1029+
node.ID,
1030+
)
10281031
// TODO: Should we add a unallocatedNode and retry allocating resources like we do for network, tasks, services?
10291032
// right now, we will only retry allocating network resources for the node when the node is updated.
10301033
continue
@@ -1057,9 +1060,9 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd
10571060

10581061
if err := a.netCtx.nwkAllocator.DeallocateAttachment(node, na); err != nil {
10591062
// failed to deallocate; there's nothing we can do besides log an error and keep going
1060-
log.G(ctx).WithError(err).Errorf(
1061-
"error deallocating attachment for network %v on node %v",
1062-
na.Network.ID, node.ID,
1063+
log.G(ctx).WithError(err).WithField("network.id", na.Network.ID).Errorf(
1064+
"failed to deallocate network resources on node %s",
1065+
node.ID,
10631066
)
10641067
}
10651068
// strictly speaking, nothing was allocated, but something was

0 commit comments

Comments
 (0)