From ed650557aef9bb1d18b755ffdf891fcb26bb20cb Mon Sep 17 00:00:00 2001 From: Brenton Leanhardt Date: Tue, 24 Nov 2015 15:05:27 -0500 Subject: Properly setting scheduleability for HA Master scenarios If the only Nodes we have are also on Masters we set the scheduleable. --- utils/src/ooinstall/cli_installer.py | 4 ++-- utils/src/ooinstall/openshift_ansible.py | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) (limited to 'utils/src/ooinstall') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 812a42795..c62461ad3 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -270,11 +270,11 @@ https://docs.openshift.org/latest/install_config/install/advanced_install.html#m """ confirm_continue(message) - nodes = [host.node for host in oo_cfg.hosts] + nodes = [host for host in oo_cfg.hosts if host.node] if len(masters) == len(nodes): message = """ No dedicated Nodes specified. By default, colocated Masters have their Nodes -set to unscheduleable. Continuing at this point will lable all nodes as +set to unscheduleable. Continuing at this point will label all nodes as scheduleable. """ confirm_continue(message) diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py index 66b9ead93..75125084c 100644 --- a/utils/src/ooinstall/openshift_ansible.py +++ b/utils/src/ooinstall/openshift_ansible.py @@ -57,14 +57,20 @@ def generate_inventory(hosts): write_host(master, base_inventory) base_inventory.write('\n[nodes]\n') - for node in nodes: - # TODO: Until the Master can run the SDN itself we have to configure the Masters - # as Nodes too. - scheduleable = True - # If there's only one Node and it's also a Master we want it to be scheduleable: - if node in masters and len(masters) != len(nodes): - scheduleable = False - write_host(node, base_inventory, scheduleable) + + # TODO: It would be much better to calculate the scheduleability elsewhere + # and store it on the Node object. + if set(nodes) == set(masters): + for node in nodes: + write_host(node, base_inventory) + else: + for node in nodes: + # TODO: Until the Master can run the SDN itself we have to configure the Masters + # as Nodes too. + scheduleable = True + if node in masters: + scheduleable = False + write_host(node, base_inventory, scheduleable) if not getattr(proxy, 'preconfigured', True): base_inventory.write('\n[lb]\n') -- cgit v1.2.3