Switch the undercloud to be containerized by default

The undercloud is now by default containerized and the deployment
is not driven by instack-undercloud anymore but by TripleO Heat Templates
like it's done for the overcloud.

Note: if the undercloud isn't containerized and we don't support upgrades
from Queens at this point.

Depends-On: I910b15f78dc5a10e304d5aaf249516c56c82f6d0
Change-Id: I9e754a7efff4113c50c0c825d58461e6bc94aa24
This commit is contained in:
Emilien Macchi 2018-07-10 16:44:49 -05:00
parent 6070c4be1c
commit b10ca31475
3 changed files with 121 additions and 26 deletions

View File

@ -0,0 +1,10 @@
---
prelude: >
The undercloud is now by default containerized and the deployment
is not driven by instack-undercloud anymore but by TripleO Heat Templates
like it's done for the overcloud.
upgrade:
- |
The upgrade from a non-containerized undercloud to a containerized
undercloud is supported and can be executed with ``openstack undercloud
upgrade`` command (same as before).

View File

@ -47,16 +47,68 @@ class TestUndercloudInstall(TestPluginV1):
app_args.verbose_level = 1 app_args.verbose_level = 1
self.cmd = undercloud.InstallUndercloud(self.app, app_args) self.cmd = undercloud.InstallUndercloud(self.app, app_args)
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('getpass.getuser', return_value='stack')
@mock.patch('six.moves.builtins.open')
@mock.patch('shutil.copy')
@mock.patch('os.mkdir')
@mock.patch('tripleoclient.utils.write_env_file', autospec=True)
@mock.patch('subprocess.check_call', autospec=True) @mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_install_default(self, mock_subprocess): def test_undercloud_install_default(self, mock_subprocess,
arglist = [] mock_wr,
mock_os, mock_copy,
mock_open, mock_user):
arglist = ['--no-validations']
verifylist = [] verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
mock_subprocess.assert_called_with(['instack-install-undercloud']) mock_subprocess.assert_called_with(
['sudo', 'openstack', 'tripleo', 'deploy', '--standalone',
'--standalone-role', 'Undercloud', '--stack', 'undercloud',
'--local-domain=localdomain',
'--local-ip=192.168.24.1/24',
'--templates=/usr/share/openstack-tripleo-heat-templates/',
'--heat-native', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'docker.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic.yaml',
'-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/mistral.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/zaqar.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/tripleo-ui.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/tempest.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'public-tls-undercloud.yaml',
'--public-virtual-ip', '192.168.24.2',
'--control-virtual-ip', '192.168.24.3', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'ssl/tls-endpoints-public-ip.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'use-dns-for-vips.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-haproxy.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-keepalived.yaml',
# TODO(cjeanner) drop once we have proper oslo.privsep
'--deployment-user', 'stack',
'--output-dir=/home/stack', '--cleanup',
'-e', '/home/stack/tripleo-config-generated-env-files/'
'undercloud_parameters.yaml',
'--log-file=install-undercloud.log', '-e',
'/usr/share/openstack-tripleo-heat-templates/'
'undercloud-stack-vstate-dropin.yaml'])
@mock.patch('subprocess.check_call', autospec=True) @mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_install_with_heat_disabled(self, mock_subprocess): def test_undercloud_install_with_heat_disabled(self, mock_subprocess):
@ -502,28 +554,69 @@ class TestUndercloudUpgrade(TestPluginV1):
app_args.verbose_level = 1 app_args.verbose_level = 1
self.cmd = undercloud.UpgradeUndercloud(self.app, app_args) self.cmd = undercloud.UpgradeUndercloud(self.app, app_args)
# TODO(cjeanner) drop once we have proper oslo.privsep
@mock.patch('getpass.getuser', return_value='stack')
@mock.patch('shutil.copy')
@mock.patch('os.mkdir') @mock.patch('os.mkdir')
@mock.patch('tripleoclient.utils.write_env_file', autospec=True) @mock.patch('tripleoclient.utils.write_env_file', autospec=True)
@mock.patch('subprocess.check_call', autospec=True) @mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_upgrade_default(self, mock_subprocess, mock_wr, def test_undercloud_upgrade_default(self, mock_subprocess,
mock_os): mock_wr,
arglist = [] mock_os, mock_copy, mock_user):
arglist = ['--no-validations']
verifylist = [] verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist) parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples # DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args) self.cmd.take_action(parsed_args)
mock_subprocess.assert_has_calls( mock_subprocess.assert_called_with(
[ ['sudo', 'openstack', 'tripleo', 'deploy', '--standalone',
mock.call(['sudo', 'yum', 'update', '-y', '--standalone-role', 'Undercloud', '--stack', 'undercloud',
'instack-undercloud']), '--local-domain=localdomain',
mock.call('instack-pre-upgrade-undercloud'), '--local-ip=192.168.24.1/24',
mock.call('instack-upgrade-undercloud'), '--templates=/usr/share/openstack-tripleo-heat-templates/',
mock.call(['sudo', 'systemctl', 'restart', '--upgrade', '-e',
'openstack-nova-api']) '/usr/share/openstack-tripleo-heat-templates/environments/'
] 'lifecycle/undercloud-upgrade-prepare.yaml',
) '--heat-native', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'docker.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'undercloud.yaml', '-e', '/home/stack/foo.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic.yaml',
'-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/ironic-inspector.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/mistral.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/zaqar.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/tripleo-ui.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/tempest.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'public-tls-undercloud.yaml',
'--public-virtual-ip', '192.168.24.2',
'--control-virtual-ip', '192.168.24.3', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'ssl/tls-endpoints-public-ip.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'use-dns-for-vips.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-haproxy.yaml', '-e',
'/usr/share/openstack-tripleo-heat-templates/environments/'
'services/undercloud-keepalived.yaml',
# TODO(cjeanner) drop once we have proper oslo.privsep
'--deployment-user', 'stack',
'--output-dir=/home/stack', '--cleanup',
'-e', '/home/stack/tripleo-config-generated-env-files/'
'undercloud_parameters.yaml',
'--log-file=install-undercloud.log', '-e',
'/usr/share/openstack-tripleo-heat-templates/'
'undercloud-stack-vstate-dropin.yaml'])
@mock.patch('os.mkdir') @mock.patch('os.mkdir')
@mock.patch('tripleoclient.utils.write_env_file', autospec=True) @mock.patch('tripleoclient.utils.write_env_file', autospec=True)

View File

@ -132,11 +132,7 @@ class InstallUndercloud(command.Command):
utils.ensure_run_as_normal_user() utils.ensure_run_as_normal_user()
if parsed_args.use_heat is not None: if parsed_args.use_heat is not None:
self.log.warning('--use-heat is deprecated in Rocky') self.log.warning('--use-heat is deprecated in Rocky')
# NOTE(EmilienM): For backwards compatibility until CI has been if parsed_args.use_heat is not None and \
# switched we need to still run instack-undercloud when --use-heat
# is not provided. This will be removed in a follow up patch
# once CI has been converted to pass in --use-heat=False
if parsed_args.use_heat is None or \
parsed_args.use_heat.lower() == "false": parsed_args.use_heat.lower() == "false":
self.log.warning(_('Non-containerized undercloud deployment is ' self.log.warning(_('Non-containerized undercloud deployment is '
'deprecated in Rocky cycle.')) 'deprecated in Rocky cycle.'))
@ -183,11 +179,7 @@ class UpgradeUndercloud(InstallUndercloud):
utils.ensure_run_as_normal_user() utils.ensure_run_as_normal_user()
if parsed_args.use_heat is not None: if parsed_args.use_heat is not None:
self.log.warning('--use-heat is deprecated in Rocky') self.log.warning('--use-heat is deprecated in Rocky')
# NOTE(EmilienM): For backwards compatibility until CI has been if parsed_args.use_heat is not None and \
# switched we need to still run instack-undercloud when --use-heat
# is not provided. This will be removed in a follow up patch
# once CI has been converted to pass in --use-heat=False
if parsed_args.use_heat is None or \
parsed_args.use_heat.lower() == "false": parsed_args.use_heat.lower() == "false":
self.log.warning(_('Non-containerized undercloud deployment is ' self.log.warning(_('Non-containerized undercloud deployment is '
'deprecated in Rocky cycle.')) 'deprecated in Rocky cycle.'))