Adjust the ceph mon IP for simplex k8s installs

For simplex installs, the loopback interface is assigned the host's mgmt
addresses. The ceph monitor address for a host is the host's mgmt
address. A k8s pod that needs to access the external ceph cluster
requires the ceph monitor IP to be accessible from within the cluster.

Because the pod would use the host's mgmt address (i.e. a loopback
address), the ceph/rbd client within the pod will fail to communicate to
the monitor.

Move the ceph monitor to the OAM address so that it is accessible from
pods within the k8s cluster.

Change-Id: I551dc33c51c1ed42d2e558b303d67618609c6d56
Story: 2002844
Task: 26877
Signed-off-by: Robert Church <robert.church@windriver.com>
This commit is contained in:
Robert Church 2018-10-28 19:09:15 -04:00
parent ec4048574f
commit 0d92352aec
1 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@
import netaddr
import uuid
from sysinv.api.controllers.v1 import utils
from sysinv.common import constants
from sysinv.common.storage_backend_conf import StorageBackendConfig
@ -48,7 +49,15 @@ class CephPuppet(openstack.OpenstackBasePuppet):
ceph_mon_ips = StorageBackendConfig.get_ceph_mon_ip_addresses(
self.dbapi)
mon_0_ip = ceph_mon_ips['ceph-mon-0-ip']
# TODO: k8s on AIO-SX: Temporarily need to move the ceph monitor address
# from a loopback address to the OAM address so the ceph monitor is
# reachable from the cluster pods.
if (utils.is_kubernetes_config(self.dbapi) and
(self.dbapi.isystem_get_one().system_mode ==
constants.SYSTEM_MODE_SIMPLEX)):
mon_0_ip = self._get_oam_address()
else:
mon_0_ip = ceph_mon_ips['ceph-mon-0-ip']
mon_1_ip = ceph_mon_ips['ceph-mon-1-ip']
mon_2_ip = ceph_mon_ips['ceph-mon-2-ip']