Skip to content

Commit

Permalink
fix: overwrite nodes in the gRPC metadata
Browse files Browse the repository at this point in the history
Many places rely on the "replace" semantics, and the change in #3738
broke that assumpion. This was showing up as upgrade test failure when
upgrade code saw a duplicate of config resource (as it saw responses
from two nodes).

Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
  • Loading branch information
smira authored and talos-bot committed Jun 11, 2021
1 parent 6a35c8f commit 5029edf
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/machinery/client/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import (
// WithNodes wraps the context with metadata to send request to set of nodes.
func WithNodes(ctx context.Context, nodes ...string) context.Context {
md, _ := metadata.FromOutgoingContext(ctx)
md = metadata.Join(md, metadata.MD{"nodes": nodes})

// overwrite any previous nodes in the context metadata with new value
md = md.Copy()
md.Set("nodes", nodes...)

return metadata.NewOutgoingContext(ctx, md)
}

0 comments on commit 5029edf

Please sign in to comment.