diff options
author | Devan Goodwin <dgoodwin@redhat.com> | 2015-11-27 11:31:35 -0400 |
---|---|---|
committer | Devan Goodwin <dgoodwin@redhat.com> | 2015-11-30 15:02:07 -0400 |
commit | 4872c5e1d298cba9901e2ecf207580b7d4fdece7 (patch) | |
tree | 0a172b65c7f6acd0bf655c0b1801d0b97cd87148 /utils/src | |
parent | 94ce712e8e0ebeec4b0c27c6b9b26f03a26a1fd5 (diff) | |
download | openshift-4872c5e1d298cba9901e2ecf207580b7d4fdece7.tar.gz openshift-4872c5e1d298cba9901e2ecf207580b7d4fdece7.tar.bz2 openshift-4872c5e1d298cba9901e2ecf207580b7d4fdece7.tar.xz openshift-4872c5e1d298cba9901e2ecf207580b7d4fdece7.zip |
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.
Diffstat (limited to 'utils/src')
-rw-r--r-- | utils/src/ooinstall/cli_installer.py | 41 |
1 files changed, 33 insertions, 8 deletions
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 = """ |