Set the module's server_addr path with the mgr's name.

To enable multiple mgrs to run properly, we need to set the respective server_addr path with the mgr's name for the modules of each mgr.

When multiple mgrs are running, the modules( e.g. dashboard and Prometheus ) of each mgr need to bind its own server_addr when it is started. The way to get server_addr when ceph mgr starts the module is as follows:  first,  get the server_addr value by "mgr/<module-name>/<mgr-daemonid>/server_addr" path;  and if this path does not exist, then get the server_addr value by" mgr/<module-name>/server_addr" path.
According to the original rook setting for server_addr,  the modules of all mgrs take the same server_addr on ceph luminous and mimic, this produces a wrong result that only one mgr's modules can run properly ( the modules of other mgrs failed to start with the wrong server_addr).
This change is made to be compatible with ceph luminous, mimic, and nautilus.  and Modify according to: the "HOST NAME AND PORT" description of http://docs.ceph.com/docs/master/mgr/dashboard/ .

Signed-off-by: wangxiao86 <wangxiao1@sensetime.com>
This commit is contained in:
wangxiao86 committed 2019-04-30 17:14:07 +08:00
1 parent 0cc8af0877
commit a5a8d22478
1 file changed
+1 -1
+1 -1
View File
@@ -135,7 +135,7 @@ func (c *Cluster) makeSetServerAddrInitContainer(mgrConfig *mgrConfig, mgrModule
} else {
cfgSetArgs = append(cfgSetArgs, fmt.Sprintf("mgr.%s", mgrConfig.DaemonID))
}
cfgPath := fmt.Sprintf("mgr/%s/server_addr", mgrModule)
cfgPath := fmt.Sprintf("mgr/%s/%s/server_addr", mgrModule, mgrConfig.DaemonID)
cfgSetArgs = append(cfgSetArgs, cfgPath, opspec.ContainerEnvVarReference(podIPEnvVar))
if c.clusterInfo.CephVersion.IsAtLeastNautilus() {
cfgSetArgs = append(cfgSetArgs, "--force")