Skip to content

Commit

Permalink
chore: log KubeSpan IPs overlaps
Browse files Browse the repository at this point in the history
Should be helpful for debugging.

Signed-off-by: Alexey Palazhchenko <alexey.palazhchenko@talos-systems.com>
  • Loading branch information
AlekSi committed Nov 10, 2021
1 parent 82a1ad1 commit e7f715e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal/app/machined/pkg/controllers/kubespan/peer_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ func (ctrl *PeerSpecController) Run(ctx context.Context, r controller.Runtime, l

for otherPublicKey, otherIPSet := range peerIPSets {
if otherIPSet.Overlaps(ipSet) {
logger.Warn("peer address overlap", zap.String("ignored_peer", spec.KubeSpan.PublicKey), zap.String("other_peer", otherPublicKey))
logger.Warn("peer address overlap", zap.String("ignored_peer", spec.KubeSpan.PublicKey), zap.String("other_peer", otherPublicKey),
zap.Strings("ignored_ips", dumpSet(ipSet)), zap.Strings("other_ips", dumpSet(otherIPSet)))

continue affiliateLoop
}
Expand Down Expand Up @@ -174,3 +175,15 @@ func (ctrl *PeerSpecController) Run(ctx context.Context, r controller.Runtime, l
}
}
}

// dumpSet converts IPSet to a form suitable for logging.
func dumpSet(set *netaddr.IPSet) []string {
ranges := set.Ranges()
res := make([]string, len(ranges))

for i, p := range ranges {
res[i] = p.String()
}

return res
}

0 comments on commit e7f715e

Please sign in to comment.