VAULT-22569: Handle nil node info when retrieving HA peers (#24441)

* add nil check

* changelog

* clarify changelog
This commit is contained in:
miagilepner
2023-12-08 17:34:24 +01:00
committed by GitHub
parent ba386a3389
commit 978945022d
2 changed files with 13 additions and 2 deletions

3
changelog/24441.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
core/ha: fix panic that can occur when an HA cluster contains an active node with version >=1.12.0 and another node with version <1.10
```

View File

@@ -3961,9 +3961,17 @@ func (c *Core) GetHAPeerNodesCached() []PeerNode {
var nodes []PeerNode
for itemClusterAddr, item := range c.clusterPeerClusterAddrsCache.Items() {
info := item.Object.(nodeHAConnectionInfo)
var hostname, apiAddr string
// nodeInfo can be nil if there's a node with a much older version in
// the cluster
if info.nodeInfo != nil {
hostname = info.nodeInfo.Hostname
apiAddr = info.nodeInfo.ApiAddr
}
nodes = append(nodes, PeerNode{
Hostname: info.nodeInfo.Hostname,
APIAddress: info.nodeInfo.ApiAddr,
Hostname: hostname,
APIAddress: apiAddr,
ClusterAddress: itemClusterAddr,
LastEcho: info.lastHeartbeat,
Version: info.version,