summaryrefslogtreecommitdiffstats
path: root/utils/src/ooinstall
diff options
context:
space:
mode:
authorDevan Goodwin <dgoodwin@redhat.com>2015-12-01 15:09:10 -0400
committerDevan Goodwin <dgoodwin@redhat.com>2015-12-01 15:09:10 -0400
commitbd43109412c1477fde8152db7e84d73c857d544f (patch)
treededa8de71998f48f7030982d39ab74178f586444 /utils/src/ooinstall
parentd7ff5b10a3de3f7966148d9e08c0468ef3d6a7f0 (diff)
downloadopenshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.gz
openshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.bz2
openshift-bd43109412c1477fde8152db7e84d73c857d544f.tar.xz
openshift-bd43109412c1477fde8152db7e84d73c857d544f.zip
Centralize etcd/schedulability logic for each host.
Diffstat (limited to 'utils/src/ooinstall')
-rw-r--r--utils/src/ooinstall/cli_installer.py9
-rw-r--r--utils/src/ooinstall/oo_config.py26
-rw-r--r--utils/src/ooinstall/openshift_ansible.py21
3 files changed, 37 insertions, 19 deletions
diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py
index dbe3f6c32..8cabe5431 100644
--- a/utils/src/ooinstall/cli_installer.py
+++ b/utils/src/ooinstall/cli_installer.py
@@ -212,16 +212,13 @@ deployment."""
def print_host_summary(all_hosts, host):
- description_tokens = []
- masters = [ahost for ahost in all_hosts if ahost.master]
- nodes = [ahost for ahost in all_hosts if ahost.node]
click.echo("- %s" % host.connect_to)
if host.master:
click.echo(" - OpenShift Master")
if host.node:
- if not host.master:
+ if host.is_dedicated_node():
click.echo(" - OpenShift Node (Dedicated)")
- elif host.master and len(masters) == len(nodes):
+ elif host.is_schedulable_node(all_hosts):
click.echo(" - OpenShift Node")
else:
click.echo(" - OpenShift Node (Unscheduled)")
@@ -231,7 +228,7 @@ def print_host_summary(all_hosts, host):
else:
click.echo(" - Load Balancer (HAProxy)")
if host.master:
- if len(masters) > 1:
+ if host.is_etcd_member(all_hosts):
click.echo(" - Etcd Member")
else:
click.echo(" - Etcd (Embedded)")
diff --git a/utils/src/ooinstall/oo_config.py b/utils/src/ooinstall/oo_config.py
index 37aaf9197..1be85bc1d 100644
--- a/utils/src/ooinstall/oo_config.py
+++ b/utils/src/ooinstall/oo_config.py
@@ -73,6 +73,32 @@ class Host(object):
d[prop] = getattr(self, prop)
return d
+ def is_etcd_member(self, all_hosts):
+ """ Will this host be a member of a standalone etcd cluster. """
+ if not self.master:
+ return False
+ masters = [host for host in all_hosts if host.master]
+ if len(masters) > 1:
+ return True
+ return False
+
+ def is_dedicated_node(self):
+ """ Will this host be a dedicated node. (not a master) """
+ return self.node and not self.master
+
+ def is_schedulable_node(self, all_hosts):
+ """ Will this host be a node marked as schedulable. """
+ if not self.node:
+ return False
+ if not self.master:
+ return True
+
+ masters = [host for host in all_hosts if host.master]
+ nodes = [host for host in all_hosts if host.node]
+ if len(masters) == len(nodes):
+ return True
+ return False
+
class OOConfig(object):
default_dir = os.path.normpath(
diff --git a/utils/src/ooinstall/openshift_ansible.py b/utils/src/ooinstall/openshift_ansible.py
index e36116cc9..17196a813 100644
--- a/utils/src/ooinstall/openshift_ansible.py
+++ b/utils/src/ooinstall/openshift_ansible.py
@@ -58,19 +58,14 @@ def generate_inventory(hosts):
base_inventory.write('\n[nodes]\n')
- # TODO: It would be much better to calculate the schedulability elsewhere
- # and store it on the Node object.
- if set(nodes) == set(masters):
- for node in nodes:
- write_host(node, base_inventory, True)
- else:
- for node in nodes:
- # TODO: Until the Master can run the SDN itself we have to configure the Masters
- # as Nodes too.
- schedulable = None
- if node in masters:
- schedulable = False
- write_host(node, base_inventory, schedulable)
+ for node in nodes:
+ # Let the fact defaults decide if we're not a master:
+ schedulable = None
+
+ # If the node is also a master, we must explicitly set schedulablity:
+ if node.master:
+ schedulable = node.is_schedulable_node(hosts)
+ write_host(node, base_inventory, schedulable)
if not getattr(proxy, 'preconfigured', True):
base_inventory.write('\n[lb]\n')