rbd-provisioner storage class exclude 3rd monitor
rbd-provisioner's storage class is referencing all configured Ceph monitors. When a compute node is deleted and another one is configured to run the 3rd ceph-mon then the storage class definition is updated as expected in the overrides but then platform-integ-apps fails to re-apply because storage class is immutable (you would need to remove the app first then apply it) To avoid this issue exclude 3rd monitor from rbd-provisioner's storage class when generating the overrides. Change-Id: I546dfc255c5ec362169d23f1804e70b805b2a316 Closes-bug: 1843569 Signed-off-by: Daniel Badea <daniel.badea@windriver.com>
This commit is contained in:
parent
080b4453a2
commit
b5322a892e
@ -1468,3 +1468,9 @@ CLOCK_SYNCHRONIZATION = [
|
||||
NTP,
|
||||
PTP
|
||||
]
|
||||
|
||||
# ceph-mon IP placeholders (keys)
|
||||
CEPH_MON_0 = 'ceph-mon-0-ip'
|
||||
CEPH_MON_1 = 'ceph-mon-1-ip'
|
||||
CEPH_MON_2 = 'ceph-mon-2-ip'
|
||||
CEPH_FLOATING_MON = 'ceph-floating-mon-ip'
|
||||
|
@ -197,38 +197,29 @@ class StorageBackendConfig(object):
|
||||
|
||||
@staticmethod
|
||||
def get_ceph_mon_ip_addresses(dbapi):
|
||||
network_type = constants.NETWORK_TYPE_MGMT
|
||||
floating_network_name = constants.CONTROLLER_HOSTNAME
|
||||
|
||||
targets = {
|
||||
'%s-%s' % (floating_network_name,
|
||||
network_type): 'ceph-floating-mon-ip',
|
||||
'%s-%s' % (constants.CONTROLLER_0_HOSTNAME,
|
||||
network_type): 'ceph-mon-0-ip',
|
||||
'%s-%s' % (constants.CONTROLLER_1_HOSTNAME,
|
||||
network_type): 'ceph-mon-1-ip',
|
||||
# map hostname to ceph-mon ip placeholder
|
||||
host2ph = {
|
||||
constants.CONTROLLER_HOSTNAME: constants.CEPH_FLOATING_MON,
|
||||
constants.CONTROLLER_0_HOSTNAME: constants.CEPH_MON_0,
|
||||
constants.CONTROLLER_1_HOSTNAME: constants.CEPH_MON_1,
|
||||
}
|
||||
|
||||
ceph_mons = dbapi.ceph_mon_get_list()
|
||||
ceph_mon = None
|
||||
for ceph_mon in ceph_mons:
|
||||
if ceph_mon['hostname'] == constants.CONTROLLER_0_HOSTNAME:
|
||||
targets.update({'%s-%s' % (constants.CONTROLLER_0_HOSTNAME,
|
||||
network_type): 'ceph-mon-0-ip'})
|
||||
elif ceph_mon['hostname'] == constants.CONTROLLER_1_HOSTNAME:
|
||||
targets.update({'%s-%s' % (constants.CONTROLLER_1_HOSTNAME,
|
||||
network_type): 'ceph-mon-1-ip'})
|
||||
else:
|
||||
targets.update({'%s-%s' % (ceph_mon['hostname'],
|
||||
network_type): 'ceph-mon-2-ip'})
|
||||
|
||||
results = {}
|
||||
addrs = dbapi.addresses_get_all()
|
||||
for addr in addrs:
|
||||
if addr.name in targets:
|
||||
results[targets[addr.name]] = addr.address
|
||||
|
||||
return results
|
||||
# find 3rd ceph-mon host name (if any)
|
||||
for mon in dbapi.ceph_mon_get_list():
|
||||
host = mon['hostname']
|
||||
if host not in host2ph:
|
||||
host2ph[host] = constants.CEPH_MON_2
|
||||
# map host interface to ceph-mon ip placeholder
|
||||
hostif2ph = {}
|
||||
for host, ph in host2ph.items():
|
||||
hostif = '%s-%s' % (host, constants.NETWORK_TYPE_MGMT)
|
||||
hostif2ph[hostif] = ph
|
||||
# map placeholder to ceph-mon ip address
|
||||
ph2ipaddr = {}
|
||||
for addr in dbapi.addresses_get_all():
|
||||
if addr.name in hostif2ph:
|
||||
ph = hostif2ph[addr.name]
|
||||
ph2ipaddr[ph] = addr.address
|
||||
return ph2ipaddr
|
||||
|
||||
@staticmethod
|
||||
def is_ceph_backend_ready(api):
|
||||
|
@ -157,17 +157,23 @@ class BaseHelm(object):
|
||||
def _system_mode(self):
|
||||
return self.dbapi.isystem_get_one().system_mode
|
||||
|
||||
def _get_ceph_monitor_ips(self):
|
||||
def _get_ceph_monitor_ips(self, name_filter=None):
|
||||
if self._system_mode() == constants.SYSTEM_MODE_SIMPLEX:
|
||||
monitors = [self._get_controller_0_management_address()]
|
||||
elif name_filter:
|
||||
monitors = []
|
||||
for name, addr in StorageBackendConfig.get_ceph_mon_ip_addresses(
|
||||
self.dbapi).items():
|
||||
if name_filter(name):
|
||||
monitors.append(addr)
|
||||
else:
|
||||
monitors = StorageBackendConfig.get_ceph_mon_ip_addresses(
|
||||
self.dbapi).values()
|
||||
return monitors
|
||||
|
||||
def _get_formatted_ceph_monitor_ips(self):
|
||||
def _get_formatted_ceph_monitor_ips(self, name_filter=None):
|
||||
port = self.CEPH_MON_SERVICE_PORT
|
||||
monitor_ips = self._get_ceph_monitor_ips()
|
||||
monitor_ips = self._get_ceph_monitor_ips(name_filter)
|
||||
formatted_monitor_ips = [
|
||||
utils.format_ceph_mon_address(mon, port) for mon in monitor_ips
|
||||
]
|
||||
|
@ -46,8 +46,12 @@ class RbdProvisionerHelm(base.BaseHelm):
|
||||
if not ceph_bks:
|
||||
return {} # ceph is not configured
|
||||
|
||||
def _skip_ceph_mon_2(name):
|
||||
return name != constants.CEPH_MON_2
|
||||
|
||||
classdefaults = {
|
||||
"monitors": self._get_formatted_ceph_monitor_ips(),
|
||||
"monitors": self._get_formatted_ceph_monitor_ips(
|
||||
name_filter=_skip_ceph_mon_2),
|
||||
"adminId": constants.K8S_RBD_PROV_USER_NAME,
|
||||
"adminSecretName": constants.K8S_RBD_PROV_ADMIN_SECRET_NAME
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ class CephPuppet(openstack.OpenstackBasePuppet):
|
||||
else:
|
||||
mon_2_host = None
|
||||
|
||||
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.get('ceph-mon-2-ip', None)
|
||||
floating_mon_ip = ceph_mon_ips['ceph-floating-mon-ip']
|
||||
mon_0_ip = ceph_mon_ips[constants.CEPH_MON_0]
|
||||
mon_1_ip = ceph_mon_ips[constants.CEPH_MON_1]
|
||||
mon_2_ip = ceph_mon_ips.get(constants.CEPH_MON_2, None)
|
||||
floating_mon_ip = ceph_mon_ips[constants.CEPH_FLOATING_MON]
|
||||
|
||||
mon_0_addr = self._format_ceph_mon_address(mon_0_ip)
|
||||
mon_1_addr = self._format_ceph_mon_address(mon_1_ip)
|
||||
|
Loading…
Reference in New Issue
Block a user