fix: prevent panic on health check if a member has no IPs
If a member has no IP addresses, prevent cluster health checks from failing with a panic by checking for the length of member IPs and not assuming there's always at least 1 IP. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
parent
7471d7f017
commit
0847400f72
@ -5,6 +5,7 @@
|
||||
package check
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/netip"
|
||||
|
||||
"github.com/talos-systems/talos/pkg/cluster"
|
||||
@ -72,6 +73,10 @@ func memberToNodeInfo(member *clussterres.Member) (cluster.NodeInfo, error) {
|
||||
return cluster.NodeInfo{}, err
|
||||
}
|
||||
|
||||
if len(ips) == 0 {
|
||||
return cluster.NodeInfo{}, fmt.Errorf("no IP address found for member: %s", member.Metadata().ID())
|
||||
}
|
||||
|
||||
return cluster.NodeInfo{
|
||||
InternalIP: ips[0],
|
||||
IPs: ips,
|
||||
|
Loading…
x
Reference in New Issue
Block a user