Merge "Add command to deploy only containers"

This commit is contained in:
Zuul 2019-12-09 11:21:38 +00:00 committed by Gerrit Code Review
commit 78de8c1dd8
5 changed files with 130 additions and 0 deletions

View File

@ -84,6 +84,31 @@ service by the name of that service. For example: ``nova``, ``neutron`` or
(kayobe) $ kayobe overcloud service reconfigure --tags config --kolla-tags nova,ironic
Deploying Updated Container Images
==================================
A common task is to deploy updated container images, without configuration
changes. This might be to roll out an updated container OS or to pick up some
package updates. This should be faster than a full deployment or
reconfiguration.
To deploy updated container images::
(kayobe) $ kayobe overcloud service deploy containers
Note that if there are configuration changes, these will not be applied using
this command so if in doubt, use a normal ``kayobe overcloud service deploy``.
In case not all services' containers have been modified, performance can be
improved by specifying Ansible tags to limit the tasks run in kayobe and/or
kolla-ansible's playbooks. This may require knowledge of the inner workings of
these tools but in general, kolla-ansible tags the play used to configure each
service by the name of that service. For example: ``nova``, ``neutron`` or
``ironic``. Use ``-t`` or ``--tags`` to specify kayobe tags and ``-kt`` or
``--kolla-tags`` to specify kolla-ansible tags. For example::
(kayobe) $ kayobe overcloud service deploy containers --kolla-tags nova,ironic
Upgrading Containerised Services
================================

View File

@ -1225,6 +1225,49 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, VaultMixin,
self.run_kayobe_playbooks(parsed_args, playbooks, ignore_limit=True)
class OvercloudServiceDeployContainers(KollaAnsibleMixin, KayobeAnsibleMixin,
VaultMixin, Command):
"""Deploy the overcloud services without updating configuration.
* Configure kolla-ansible.
* Configure overcloud services in kolla-ansible.
* Perform kolla-ansible prechecks to verify the system state for
deployment.
* Perform a kolla-ansible deployment of the overcloud service containers.
* Configure and deploy kayobe extra services.
This can be used in conjunction with the --tags and --kolla-tags arguments
to deploy specific services.
"""
def get_parser(self, prog_name):
parser = super(OvercloudServiceDeployContainers, self).get_parser(
prog_name)
group = parser.add_argument_group("Service Deployment")
group.add_argument("--skip-prechecks", action='store_true',
help="skip the kolla-ansible prechecks command")
return parser
def take_action(self, parsed_args):
self.app.LOG.debug("Deploying overcloud services (containers only)")
# First prepare configuration.
self.generate_kolla_ansible_config(parsed_args)
# Run kolla-ansible prechecks before deployment.
if not parsed_args.skip_prechecks:
self.run_kolla_ansible_overcloud(parsed_args, "prechecks")
# Perform the kolla-ansible deployment.
self.run_kolla_ansible_overcloud(parsed_args, "deploy-containers")
# Deploy kayobe extra services.
playbooks = _build_playbook_list("overcloud-extras")
extra_vars = {"kayobe_action": "deploy"}
self.run_kayobe_playbooks(parsed_args, playbooks,
extra_vars=extra_vars, limit="overcloud")
class OvercloudServiceReconfigure(KollaAnsibleMixin, KayobeAnsibleMixin,
VaultMixin, Command):
"""Reconfigure the overcloud services.

View File

@ -1569,6 +1569,60 @@ class TestCase(unittest.TestCase):
]
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_playbooks")
@mock.patch.object(commands.KollaAnsibleMixin,
"run_kolla_ansible_overcloud")
def test_overcloud_service_deploy_containers(self, mock_kolla_run,
mock_run):
command = commands.OvercloudServiceDeployContainers(TestApp(), [])
parser = command.get_parser("test")
parsed_args = parser.parse_args([])
result = command.run(parsed_args)
self.assertEqual(0, result)
expected_calls = [
mock.call(
mock.ANY,
[utils.get_data_files_path("ansible", "kolla-ansible.yml")],
ignore_limit=True,
tags="config",
),
mock.call(
mock.ANY,
[
utils.get_data_files_path("ansible",
"kolla-openstack.yml"),
],
ignore_limit=True,
),
mock.call(
mock.ANY,
[
utils.get_data_files_path("ansible",
"overcloud-extras.yml"),
],
limit="overcloud",
extra_vars={
"kayobe_action": "deploy",
},
),
]
self.assertEqual(expected_calls, mock_run.call_args_list)
expected_calls = [
mock.call(
mock.ANY,
"prechecks",
),
mock.call(
mock.ANY,
"deploy-containers",
),
]
self.assertEqual(expected_calls, mock_kolla_run.call_args_list)
@mock.patch.object(commands.KayobeAnsibleMixin,
"run_kayobe_playbooks")
@mock.patch.object(commands.KollaAnsibleMixin,

View File

@ -0,0 +1,7 @@
---
features:
- |
Adds a new ``kayobe overcloud service deploy containers`` command. This is
similar to ``kayobe overcloud service deploy``, but only deploys new
containers if necessary, and skips service registration, bootstrapping and
configuration.

View File

@ -70,6 +70,7 @@ kayobe.cli=
overcloud_service_configuration_save = kayobe.cli.commands:OvercloudServiceConfigurationSave
overcloud_service_configuration_generate = kayobe.cli.commands:OvercloudServiceConfigurationGenerate
overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy
overcloud_service_deploy_containers = kayobe.cli.commands:OvercloudServiceDeployContainers
overcloud_service_destroy = kayobe.cli.commands:OvercloudServiceDestroy
overcloud_service_reconfigure = kayobe.cli.commands:OvercloudServiceReconfigure
overcloud_service_upgrade = kayobe.cli.commands:OvercloudServiceUpgrade