From 139a82349040983a4af7ebd7e09e32a96bc00667 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 26 Nov 2015 10:40:05 -0400 Subject: Block re-use of master/node as load balancer in attended install. Code was present to catch this in unattended installs but was looking for a host record with both master/node and master_lb set to true, but in the attended installs we were adding a separate host record with the same connect_to. Attended tests can now optionally specify multiple "attempted" strings for the master_lb specification, we'll try to input each if multiple are specified. Cleanup some empty defaults and error messages as well. --- utils/src/ooinstall/cli_installer.py | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index d7c06745e..a016a5597 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -106,8 +106,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen num_masters = 0 while more_hosts: host_props = {} - host_props['connect_to'] = click.prompt('Enter hostname or IP address:', - default='', + host_props['connect_to'] = click.prompt('Enter hostname or IP address', value_proc=validate_prompt_hostname) if not masters_set: @@ -144,13 +143,17 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen more_hosts = click.confirm('Do you want to add additional hosts?') if num_masters > 1: - hosts.append(collect_master_lb()) + collect_master_lb(hosts) return hosts -def collect_master_lb(): +def collect_master_lb(hosts): """ - Get an HA proxy from the user + Get a valid load balancer from the user and append it to the list of + hosts. + + Ensure user does not specify a system already used as a master/node as + this is an invalid configuration. """ message = """ Setting up High Availability Masters requires a load balancing solution. @@ -166,17 +169,28 @@ hostname. """ click.echo(message) host_props = {} - host_props['connect_to'] = click.prompt('Enter hostname or IP address:', - default='', - value_proc=validate_prompt_hostname) + + # Using an embedded function here so we have access to the hosts list: + def validate_prompt_lb(hostname): + # Run the standard hostname check first: + hostname = validate_prompt_hostname(hostname) + + # Make sure this host wasn't already specified: + for host in hosts: + if host.connect_to == hostname and (host.master or host.node): + raise click.BadParameter('Cannot re-use "%s" as a load balancer, ' + 'please specify a separate host' % hostname) + return hostname + + host_props['connect_to'] = click.prompt('Enter hostname or IP address', + value_proc=validate_prompt_lb) install_haproxy = click.confirm('Should the reference haproxy load balancer be installed on this host?') host_props['preconfigured'] = not install_haproxy host_props['master'] = False host_props['node'] = False host_props['master_lb'] = True master_lb = Host(**host_props) - - return master_lb + hosts.append(master_lb) def confirm_hosts_facts(oo_cfg, callback_facts): hosts = oo_cfg.hosts @@ -261,6 +275,7 @@ def check_hosts_config(oo_cfg): if master_lb[0].master or master_lb[0].node: click.echo('The Master load balancer is configured as a master or node. Please correct this.') sys.exit(0) + # Check for another host with same connect_to? else: message = """ No HAProxy given in config. Either specify one or provide a load balancing solution -- cgit v1.2.3 From e6054d0ef7d07f370496dac82975b17dc3dfce70 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 26 Nov 2015 11:55:32 -0400 Subject: Don't prompt to continue during unattended installs. --- utils/src/ooinstall/cli_installer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index a016a5597..acfb5065b 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -263,7 +263,7 @@ Edit %s with the desired values and run `atomic-openshift-installer --unattended -def check_hosts_config(oo_cfg): +def check_hosts_config(oo_cfg, unattended): click.clear() masters = [host for host in oo_cfg.hosts if host.master] if len(masters) > 1: @@ -283,7 +283,8 @@ of your choice to balance the master API (port 8443) on all master hosts. https://docs.openshift.org/latest/install_config/install/advanced_install.html#multiple-masters """ - confirm_continue(message) + if not unattended: + confirm_continue(message) nodes = [host for host in oo_cfg.hosts if host.node] if len(masters) == len(nodes): @@ -292,7 +293,8 @@ No dedicated Nodes specified. By default, colocated Masters have their Nodes set to unscheduleable. Continuing at this point will label all nodes as scheduleable. """ - confirm_continue(message) + if not unattended: + confirm_continue(message) return @@ -654,7 +656,7 @@ def install(ctx, force): else: oo_cfg = get_missing_info_from_user(oo_cfg) - check_hosts_config(oo_cfg) + check_hosts_config(oo_cfg, ctx.obj['unattended']) click.echo('Gathering information from hosts...') callback_facts, error = openshift_ansible.default_facts(oo_cfg.hosts, -- cgit v1.2.3 From 8a0153e992938a9b3441faca77305be1bb42f4d2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Thu, 26 Nov 2015 12:20:25 -0400 Subject: Test unattended HA quick install. Checking behavior when there is no LB specified, and when the user attempts to re-use a master or node as their LB. --- utils/src/ooinstall/cli_installer.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index acfb5065b..82f695fca 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -278,22 +278,28 @@ def check_hosts_config(oo_cfg, unattended): # Check for another host with same connect_to? else: message = """ -No HAProxy given in config. Either specify one or provide a load balancing solution -of your choice to balance the master API (port 8443) on all master hosts. +WARNING: No master load balancer specified in config. If you proceed you will +need to provide a load balancing solution of your choice to balance the +API (port 8443) on all master hosts. https://docs.openshift.org/latest/install_config/install/advanced_install.html#multiple-masters """ - if not unattended: + if unattended: + click.echo(message) + else: confirm_continue(message) nodes = [host for host in oo_cfg.hosts if host.node] + # TODO: This looks a little unsafe, maybe look for dedicated nodes only: 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 label all nodes as -scheduleable. +WARNING: No dedicated Nodes specified. By default, colocated Masters have +their Nodes set to unscheduleable. If you proceed all nodes will be labelled +as schedulable. """ - if not unattended: + if unattended: + click.echo(message) + else: confirm_continue(message) return @@ -318,7 +324,8 @@ def get_variant_and_version(multi_master=False): return product, version def confirm_continue(message): - click.echo(message) + if message: + click.echo(message) click.confirm("Are you ready to continue?", default=False, abort=True) return -- cgit v1.2.3 From d4f56d9e00596e0268bec8926bf1faeaffeefae7 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 27 Nov 2015 10:27:48 -0400 Subject: Text improvements for host specification. --- utils/src/ooinstall/cli_installer.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 82f695fca..ec9ccb565 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -81,19 +81,31 @@ def collect_hosts(version=None, masters_set=False, print_summary=True): """ min_masters_for_ha = 3 click.clear() - click.echo('***Host Configuration***') + click.echo('*** Host Configuration ***') message = """ -The OpenShift Master serves the API and web console. It also coordinates the -jobs that have to run across the environment. It can even run the datastore. -For wizard based installations the database will be embedded. It's possible to -change this later using etcd from Red Hat Enterprise Linux 7. +You must now specify the hosts that will compose your OpenShift cluster. + +Please enter an IP or hostname to connect to for each system in the cluster. +You will then be prompted to identify what role you would like this system to +serve in the cluster. + +OpenShift Masters serve the API and web console and coordinate the jobs to run +across the environment. If desired you can specify multiple Master systems for +an HA deployment, in which case you will be prompted to identify a *separate* +system to act as the load balancer for your cluster after all Masters and Nodes +are defined. + +If only one Master is specified, an etcd instance embedded within the OpenShift +Master service will be used as the datastore. This can be later replaced with a +separate etcd instance if desired. If multiple Masters are specified, a +separate etcd cluster will be configured with each Master serving as a member. Any Masters configured as part of this installation process will also be configured as Nodes. This is so that the Master will be able to proxy to Pods from the API. By default this Node will be unscheduleable but this can be changed after installation with 'oadm manage-node'. -The OpenShift Node provides the runtime environments for containers. It will +OpenShift Nodes provide the runtime environments for containers. They will host the required services to be managed by the Master. http://docs.openshift.com/enterprise/latest/architecture/infrastructure_components/kubernetes_infrastructure.html#master @@ -415,7 +427,7 @@ https://docs.openshift.com/enterprise/latest/admin_guide/install/prerequisites.h def collect_new_nodes(): click.clear() - click.echo('***New Node Configuration***') + click.echo('*** New Node Configuration ***') message = """ Add new nodes here """ -- cgit v1.2.3 From 23674ef59589b884d399c5c0c57f30f2baf5b89e Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 27 Nov 2015 10:38:23 -0400 Subject: Print a system summary after adding each. --- utils/src/ooinstall/cli_installer.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index ec9ccb565..56bb75187 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -14,6 +14,7 @@ from ooinstall.variants import find_variant, get_variant_version_combos DEFAULT_ANSIBLE_CONFIG = '/usr/share/atomic-openshift-utils/ansible.cfg' DEFAULT_PLAYBOOK_DIR = '/usr/share/ansible/openshift-ansible/' +MIN_MASTERS_FOR_HA = 3 def validate_ansible_dir(path): if not path: @@ -79,7 +80,6 @@ def collect_hosts(version=None, masters_set=False, print_summary=True): Returns: a list of host information collected from the user """ - min_masters_for_ha = 3 click.clear() click.echo('*** Host Configuration ***') message = """ @@ -126,7 +126,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen host_props['master'] = True num_masters += 1 - if num_masters >= min_masters_for_ha or version == '3.0': + if num_masters >= MIN_MASTERS_FOR_HA or version == '3.0': masters_set = True host_props['node'] = True @@ -145,13 +145,9 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen hosts.append(host) if print_summary: - click.echo('') - click.echo('Current Masters: {}'.format(num_masters)) - click.echo('Current Nodes: {}'.format(len(hosts))) - click.echo('Additional Masters required for HA: {}'.format(max(min_masters_for_ha - num_masters, 0))) - click.echo('') + print_host_summary(hosts) - if num_masters <= 1 or num_masters >= min_masters_for_ha: + if num_masters <= 1 or num_masters >= MIN_MASTERS_FOR_HA: more_hosts = click.confirm('Do you want to add additional hosts?') if num_masters > 1: @@ -159,6 +155,22 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen return hosts + +def print_host_summary(hosts): + masters = [host for host in hosts if host.master] + nodes = [host for host in hosts if host.node] + click.echo('') + click.echo('Current Masters: %s' % len(masters)) + for host in masters: + click.echo(' %s' % host.connect_to) + click.echo('Current Nodes: %s' % len(nodes)) + for host in nodes: + click.echo(' %s' % host.connect_to) + click.echo('Additional Masters required for HA: %s' % + max(MIN_MASTERS_FOR_HA - len(masters), 0)) + click.echo('') + + def collect_master_lb(hosts): """ Get a valid load balancer from the user and append it to the list of -- cgit v1.2.3 From 94ce712e8e0ebeec4b0c27c6b9b26f03a26a1fd5 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 27 Nov 2015 10:47:35 -0400 Subject: Improved output when re-running after editing config. --- utils/src/ooinstall/cli_installer.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 56bb75187..28b72a7dc 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -160,10 +160,10 @@ def print_host_summary(hosts): masters = [host for host in hosts if host.master] nodes = [host for host in hosts if host.node] click.echo('') - click.echo('Current Masters: %s' % len(masters)) + click.echo('OpenShift Masters: %s' % len(masters)) for host in masters: click.echo(' %s' % host.connect_to) - click.echo('Current Nodes: %s' % len(nodes)) + click.echo('OpenShift Nodes: %s' % len(nodes)) for host in nodes: click.echo(' %s' % host.connect_to) click.echo('Additional Masters required for HA: %s' % @@ -690,6 +690,7 @@ def install(ctx, force): check_hosts_config(oo_cfg, ctx.obj['unattended']) click.echo('Gathering information from hosts...') + print_host_summary(oo_cfg.hosts) callback_facts, error = openshift_ansible.default_facts(oo_cfg.hosts, verbose) if error: @@ -714,8 +715,8 @@ def install(ctx, force): click.echo('Ready to run installation process.') message = """ -If changes are needed to the values recorded by the installer please update {}. -""".format(oo_cfg.config_path) +If changes are needed please edit the config file above and re-run. +""" if not ctx.obj['unattended']: confirm_continue(message) -- cgit v1.2.3 From 4872c5e1d298cba9901e2ecf207580b7d4fdece7 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Fri, 27 Nov 2015 11:31:35 -0400 Subject: Adjust requirement for 3 masters for HA deployments. If only 2 masters are specified, consider this a configuration error if running an unattended install, and prevent it completely if running an attended install. (continues to prompt for hosts until you have at least 3) Because this condition cannot be entered in the interactive install, we can't really write a test for this negative case. --- utils/src/ooinstall/cli_installer.py | 41 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 28b72a7dc..9a447406f 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -14,7 +14,6 @@ from ooinstall.variants import find_variant, get_variant_version_combos DEFAULT_ANSIBLE_CONFIG = '/usr/share/atomic-openshift-utils/ansible.cfg' DEFAULT_PLAYBOOK_DIR = '/usr/share/ansible/openshift-ansible/' -MIN_MASTERS_FOR_HA = 3 def validate_ansible_dir(path): if not path: @@ -126,7 +125,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen host_props['master'] = True num_masters += 1 - if num_masters >= MIN_MASTERS_FOR_HA or version == '3.0': + if version == '3.0': masters_set = True host_props['node'] = True @@ -147,10 +146,13 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen if print_summary: print_host_summary(hosts) - if num_masters <= 1 or num_masters >= MIN_MASTERS_FOR_HA: + # If we have one master, this is enough for an all-in-one deployment, + # thus we can start asking if you wish to proceed. Otherwise we assume + # you must. + if masters_set or num_masters != 2: more_hosts = click.confirm('Do you want to add additional hosts?') - if num_masters > 1: + if num_masters >= 3: collect_master_lb(hosts) return hosts @@ -166,8 +168,26 @@ def print_host_summary(hosts): click.echo('OpenShift Nodes: %s' % len(nodes)) for host in nodes: click.echo(' %s' % host.connect_to) - click.echo('Additional Masters required for HA: %s' % - max(MIN_MASTERS_FOR_HA - len(masters), 0)) + + click.echo("") + + if len(masters) == 1: + click.echo("NOTE: Add a total of 3 or more Masters to perform an HA" + " installation.") + elif len(masters) == 2: + min_masters_message = """ +WARNING: A minimum of 3 masters are required to perform an HA installation. +Please add one more to proceed. +""" + click.echo(min_masters_message) + elif len(masters) >= 3: + ha_message = """ +NOTE: Multiple Masters specified, this will be an HA deployment with a separate +etcd cluster. You will be prompted to provide the FQDN of a load balancer once +finished entering hosts. +""" + click.echo(ha_message) + click.echo('') @@ -290,15 +310,20 @@ Edit %s with the desired values and run `atomic-openshift-installer --unattended def check_hosts_config(oo_cfg, unattended): click.clear() masters = [host for host in oo_cfg.hosts if host.master] + + if len(masters) == 2: + click.echo("A minimum of 3 Masters are required for HA deployments.") + sys.exit(1) + if len(masters) > 1: master_lb = [host for host in oo_cfg.hosts if host.master_lb] if len(master_lb) > 1: click.echo('More than one Master load balancer specified. Only one is allowed.') - sys.exit(0) + sys.exit(1) elif len(master_lb) == 1: if master_lb[0].master or master_lb[0].node: click.echo('The Master load balancer is configured as a master or node. Please correct this.') - sys.exit(0) + sys.exit(1) # Check for another host with same connect_to? else: message = """ -- cgit v1.2.3 From cdd9aa7543f869aab5914fb816a66ed0debb0930 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 Nov 2015 15:20:54 -0400 Subject: Error out if no load balancer specified. --- utils/src/ooinstall/cli_installer.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 9a447406f..249a8a7d9 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -201,11 +201,11 @@ def collect_master_lb(hosts): """ message = """ Setting up High Availability Masters requires a load balancing solution. -Please provide a host that will be configured as a proxy. This can either be -an existing load balancer configured to balance all masters on port 8443 or a -new host that will have HAProxy installed on it. +Please provide a the FQDN of a host that will be configured as a proxy. This +can be either an existing load balancer configured to balance all masters on +port 8443 or a new host that will have HAProxy installed on it. -If the host provided does is not yet configured a reference haproxy load +If the host provided does is not yet configured, a reference haproxy load balancer will be installed. It's important to note that while the rest of the environment will be fault tolerant this reference load balancer will not be. It can be replaced post-installation with a load balancer with the same @@ -318,25 +318,21 @@ def check_hosts_config(oo_cfg, unattended): if len(masters) > 1: master_lb = [host for host in oo_cfg.hosts if host.master_lb] if len(master_lb) > 1: - click.echo('More than one Master load balancer specified. Only one is allowed.') + click.echo('ERROR: More than one Master load balancer specified. Only one is allowed.') sys.exit(1) elif len(master_lb) == 1: if master_lb[0].master or master_lb[0].node: - click.echo('The Master load balancer is configured as a master or node. Please correct this.') + click.echo('ERROR: The Master load balancer is configured as a master or node. Please correct this.') sys.exit(1) - # Check for another host with same connect_to? else: message = """ -WARNING: No master load balancer specified in config. If you proceed you will -need to provide a load balancing solution of your choice to balance the -API (port 8443) on all master hosts. +ERROR: No master load balancer specified in config. You must provide the FQDN +of a load balancer to balance the API (port 8443) on all Master hosts. https://docs.openshift.org/latest/install_config/install/advanced_install.html#multiple-masters """ - if unattended: - click.echo(message) - else: - confirm_continue(message) + click.echo(message) + sys.exit(1) nodes = [host for host in oo_cfg.hosts if host.node] # TODO: This looks a little unsafe, maybe look for dedicated nodes only: -- cgit v1.2.3 From 4f6794ea6b3b7eb7383a74cb35e8ce6d445675c8 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 Nov 2015 15:30:02 -0400 Subject: Suggest dedicated nodes for an HA deployment. --- utils/src/ooinstall/cli_installer.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 249a8a7d9..8f9d82f43 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -188,6 +188,15 @@ finished entering hosts. """ click.echo(ha_message) + dedicated_nodes_message = """ +WARNING: Dedicated Nodes are recommended for an HA deployment. If no dedicated +Nodes are specified, each configured Master will be marked as a schedulable +Node. +""" + dedicated_nodes = [host for host in hosts if host.node and not host.master] + if len(dedicated_nodes) == 0: + click.echo(dedicated_nodes_message) + click.echo('') -- cgit v1.2.3 From e796856c804cd7090ed45aba7838436e7fdc9580 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Mon, 30 Nov 2015 15:56:12 -0400 Subject: Fix bug when warning on no dedicated nodes. --- utils/src/ooinstall/cli_installer.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 8f9d82f43..f8dfe2feb 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -343,9 +343,8 @@ https://docs.openshift.org/latest/install_config/install/advanced_install.html#m click.echo(message) sys.exit(1) - nodes = [host for host in oo_cfg.hosts if host.node] - # TODO: This looks a little unsafe, maybe look for dedicated nodes only: - if len(masters) == len(nodes): + dedicated_nodes = [host for host in oo_cfg.hosts if host.node and not host.master] + if len(dedicated_nodes) == 0: message = """ WARNING: No dedicated Nodes specified. By default, colocated Masters have their Nodes set to unscheduleable. If you proceed all nodes will be labelled -- cgit v1.2.3 From 1b770dff59abc23e93eecfb76c4b10dc9e2dafe2 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 1 Dec 2015 10:06:48 -0400 Subject: Add warning for HA deployments with < 3 dedicated nodes. --- utils/src/ooinstall/cli_installer.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index ee962c21a..31e8cb147 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -172,30 +172,34 @@ def print_host_summary(hosts): click.echo("") if len(masters) == 1: - click.echo("NOTE: Add a total of 3 or more Masters to perform an HA" - " installation.") + ha_hint_message = """ +NOTE: Add a total of 3 or more Masters to perform an HA installation.""" + click.echo(ha_hint_message) elif len(masters) == 2: min_masters_message = """ WARNING: A minimum of 3 masters are required to perform an HA installation. -Please add one more to proceed. -""" +Please add one more to proceed.""" click.echo(min_masters_message) elif len(masters) >= 3: ha_message = """ NOTE: Multiple Masters specified, this will be an HA deployment with a separate etcd cluster. You will be prompted to provide the FQDN of a load balancer once -finished entering hosts. -""" +finished entering hosts.""" click.echo(ha_message) dedicated_nodes_message = """ WARNING: Dedicated Nodes are recommended for an HA deployment. If no dedicated Nodes are specified, each configured Master will be marked as a schedulable -Node. -""" +Node.""" + + min_ha_nodes_message = """ +WARNING: A minimum of 3 dedicated Nodes are recommended for an HA +deployment.""" dedicated_nodes = [host for host in hosts if host.node and not host.master] if len(dedicated_nodes) == 0: click.echo(dedicated_nodes_message) + elif len(dedicated_nodes) < 3: + click.echo(min_ha_nodes_message) click.echo('') -- cgit v1.2.3 From d7ff5b10a3de3f7966148d9e08c0468ef3d6a7f0 Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 1 Dec 2015 10:41:43 -0400 Subject: Improved installation summary. Displays each host and the roles it will play based on the current configuration. As the configuration grows the summary will adapt to indicate embedded vs separte etcd, scheduled vs unscheduled nodes, etc. --- utils/src/ooinstall/cli_installer.py | 57 ++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') diff --git a/utils/src/ooinstall/cli_installer.py b/utils/src/ooinstall/cli_installer.py index 31e8cb147..dbe3f6c32 100644 --- a/utils/src/ooinstall/cli_installer.py +++ b/utils/src/ooinstall/cli_installer.py @@ -144,7 +144,7 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen hosts.append(host) if print_summary: - print_host_summary(hosts) + print_installation_summary(hosts) # If we have one master, this is enough for an all-in-one deployment, # thus we can start asking if you wish to proceed. Otherwise we assume @@ -158,18 +158,26 @@ http://docs.openshift.com/enterprise/latest/architecture/infrastructure_componen return hosts -def print_host_summary(hosts): +def print_installation_summary(hosts): + """ + Displays a summary of all hosts configured thus far, and what role each + will play. + + Shows total nodes/masters, hints for performing/modifying the deployment + with additional setup, warnings for invalid or sub-optimal configurations. + """ + click.clear() + click.echo('*** Installation Summary ***\n') + click.echo('Hosts:') + for host in hosts: + print_host_summary(hosts, host) + masters = [host for host in hosts if host.master] nodes = [host for host in hosts if host.node] + dedicated_nodes = [host for host in hosts if host.node and not host.master] click.echo('') - click.echo('OpenShift Masters: %s' % len(masters)) - for host in masters: - click.echo(' %s' % host.connect_to) - click.echo('OpenShift Nodes: %s' % len(nodes)) - for host in nodes: - click.echo(' %s' % host.connect_to) - - click.echo("") + click.echo('Total OpenShift Masters: %s' % len(masters)) + click.echo('Total OpenShift Nodes: %s' % len(nodes)) if len(masters) == 1: ha_hint_message = """ @@ -195,7 +203,6 @@ Node.""" min_ha_nodes_message = """ WARNING: A minimum of 3 dedicated Nodes are recommended for an HA deployment.""" - dedicated_nodes = [host for host in hosts if host.node and not host.master] if len(dedicated_nodes) == 0: click.echo(dedicated_nodes_message) elif len(dedicated_nodes) < 3: @@ -204,6 +211,32 @@ deployment.""" click.echo('') +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: + click.echo(" - OpenShift Node (Dedicated)") + elif host.master and len(masters) == len(nodes): + click.echo(" - OpenShift Node") + else: + click.echo(" - OpenShift Node (Unscheduled)") + if host.master_lb: + if host.preconfigured: + click.echo(" - Load Balancer (Preconfigured)") + else: + click.echo(" - Load Balancer (HAProxy)") + if host.master: + if len(masters) > 1: + click.echo(" - Etcd Member") + else: + click.echo(" - Etcd (Embedded)") + + def collect_master_lb(hosts): """ Get a valid load balancer from the user and append it to the list of @@ -723,7 +756,7 @@ def install(ctx, force): check_hosts_config(oo_cfg, ctx.obj['unattended']) click.echo('Gathering information from hosts...') - print_host_summary(oo_cfg.hosts) + print_installation_summary(oo_cfg.hosts) callback_facts, error = openshift_ansible.default_facts(oo_cfg.hosts, verbose) if error: -- cgit v1.2.3 From bd43109412c1477fde8152db7e84d73c857d544f Mon Sep 17 00:00:00 2001 From: Devan Goodwin Date: Tue, 1 Dec 2015 15:09:10 -0400 Subject: Centralize etcd/schedulability logic for each host. --- utils/src/ooinstall/cli_installer.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'utils/src/ooinstall/cli_installer.py') 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)") -- cgit v1.2.3