From 350828a260f7801436243d611b54392631b78778 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Wed, 5 Nov 2025 19:23:26 +0000 Subject: [PATCH] Prefer IP addresses over hostnames for cluster communication This change modifies the `clusterEndpointEffectiveURL` function to prioritize IP addresses over hostnames when building cluster endpoint URLs. This eliminates excessive DNS lookups that can overwhelm DNS servers (e.g., pi-hole), which was causing hundreds of thousands of unnecessary DNS queries. When Pulse communicates with Proxmox cluster nodes, it will now: 1. First try to use the IP address from ClusterEndpoint.IP 2. Fall back to ClusterEndpoint.Host only if IP is not available This is a minimal, backwards-compatible change that maintains existing functionality while dramatically reducing DNS traffic for clusters where node IPs are already known and stored. Related to #620 --- internal/monitoring/monitor.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go index dab3314..b5b00bd 100644 --- a/internal/monitoring/monitor.go +++ b/internal/monitoring/monitor.go @@ -281,12 +281,13 @@ func ensureClusterEndpointURL(raw string) string { } func clusterEndpointEffectiveURL(endpoint config.ClusterEndpoint) string { - if endpoint.Host != "" { - return ensureClusterEndpointURL(endpoint.Host) - } + // Prefer IP address to avoid excessive DNS lookups if endpoint.IP != "" { return ensureClusterEndpointURL(endpoint.IP) } + if endpoint.Host != "" { + return ensureClusterEndpointURL(endpoint.Host) + } return "" }