external: set RequireMsgr2 if v2 port is configured
Currently if we use the msgr2 port,
cs-cluster-config-json looks like
"monitors":["192.59.109.11:3300","192.59.109.13:6789","192.59.109.12:6789"]
The first monitor is passed by python script and rest are
Discovered by rook operator, so if the first mon is using the v2 port
lets update the other mons also by setting up the RequireMsgr2 flag
Signed-off-by: parth-gr <paarora@redhat.com>
(cherry picked from commit 2c4897f88c)
This commit is contained in:
1 parent
d1dccf5b19
commit
d237dff985
1 file changed
+15
@@ -24,6 +24,7 @@ import (
|
||||
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
"github.com/rook/rook/pkg/daemon/ceph/client"
|
||||
"github.com/rook/rook/pkg/daemon/ceph/util"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/mgr"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/nodedaemon"
|
||||
@@ -112,6 +113,20 @@ func (c *ClusterController) configureExternalCephCluster(cluster *cluster) error
|
||||
return errors.Wrap(err, "failed to create csi config map")
|
||||
}
|
||||
|
||||
// update the msgr2 flag
|
||||
for _, m := range cluster.ClusterInfo.Monitors {
|
||||
// m.Endpoint=10.1.115.104:3300
|
||||
monPort := util.GetPortFromEndpoint(m.Endpoint)
|
||||
if monPort == client.Msgr2port {
|
||||
if cluster.Spec.Network.Connections == nil {
|
||||
cluster.Spec.Network.Connections = &cephv1.ConnectionsSpec{}
|
||||
}
|
||||
cluster.Spec.Network.Connections.RequireMsgr2 = true
|
||||
logger.Debugf("a v2 port was found for a mon endpoint, so msgr2 is required")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Save CSI configmap
|
||||
monEndpoints := csi.MonEndpoints(cluster.ClusterInfo.Monitors, cluster.Spec.RequireMsgr2())
|
||||
err = csi.SaveClusterConfig(c.context.Clientset, c.namespacedName.Namespace, cluster.ClusterInfo, &csi.CsiClusterConfigEntry{Namespace: cluster.ClusterInfo.Namespace, Monitors: monEndpoints})
|
||||
|
||||
Reference in new issue
Block a user