ceph: do not use external node IP for mon endpoint
When the cluster is using HostNetworking, Rook was either picking up the external or internal IP of the node. This resulted in mon endpoints have public IP addresses. Those IP are not reachable from within the cluster so OSD/CSI couldn't access the monitors from the configmap endpoint. Also, exposing the cluster on a public network does not seem realistic, so sticky with private/internal IP addresses is better. Closes: https://github.com/rook/rook/issues/5495 Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
1 parent
fc648970c4
commit
bfa3b4daf4
3 files changed
+10
-6
No files matched your search
@@ -52,14 +52,14 @@ func getNodeInfoFromNode(n v1.Node) (*NodeInfo, error) {
|
||||
}
|
||||
|
||||
for _, ip := range n.Status.Addresses {
|
||||
if ip.Type == v1.NodeExternalIP || ip.Type == v1.NodeInternalIP {
|
||||
logger.Debugf("using IP %s for node %s", ip.Address, n.Name)
|
||||
if ip.Type == v1.NodeInternalIP {
|
||||
logger.Debugf("using internal IP %s for node %s", ip.Address, n.Name)
|
||||
nr.Address = ip.Address
|
||||
break
|
||||
}
|
||||
}
|
||||
if nr.Address == "" {
|
||||
return nil, errors.Errorf("couldn't get IP of node %s", nr.Name)
|
||||
return nil, errors.Errorf("failed to find any internal IP on node %s", nr.Name)
|
||||
}
|
||||
return nr, nil
|
||||
}
|
||||
@@ -212,7 +212,11 @@ func TestGetNodeInfoFromNode(t *testing.T) {
|
||||
|
||||
var info *NodeInfo
|
||||
info, err = getNodeInfoFromNode(*node)
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, err)
|
||||
|
||||
assert.Equal(t, "1.1.1.1", info.Address)
|
||||
node.Status.Addresses[0].Type = v1.NodeInternalIP
|
||||
node.Status.Addresses[0].Address = "172.17.0.1"
|
||||
info, err = getNodeInfoFromNode(*node)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, "172.17.0.1", info.Address)
|
||||
}
|
||||
@@ -42,7 +42,7 @@ func New(t *testing.T, nodes int) *fake.Clientset {
|
||||
},
|
||||
Addresses: []v1.NodeAddress{
|
||||
{
|
||||
Type: v1.NodeExternalIP,
|
||||
Type: v1.NodeInternalIP,
|
||||
Address: fmt.Sprintf("%d.%d.%d.%d", i, i, i, i),
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user