Allow specification of container images to build
Also adds a command to pull container images
This commit is contained in:
parent
518be97adb
commit
456b10e074
@ -4,9 +4,18 @@
|
||||
vars:
|
||||
# Set this to True to push images to the registry when built.
|
||||
push_images: False
|
||||
# Set this variable to a space-separated list of regexes to override the
|
||||
# default set of images.
|
||||
container_image_regexes: ""
|
||||
kolla_venv: "{{ ansible_env['PWD'] }}/kolla-venv"
|
||||
kolla_build_log_path: "/var/log/kolla-build.log"
|
||||
tasks:
|
||||
- name: Set the container image sets to build if images regexes specified
|
||||
set_fact:
|
||||
container_image_sets:
|
||||
- regexes: "{{ container_image_regexes }}"
|
||||
when: "{{ container_image_regexes != '' }}"
|
||||
|
||||
- name: Display the regexes for container images that will be built
|
||||
debug:
|
||||
msg: >
|
||||
|
@ -209,6 +209,9 @@ class SeedContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||
group.add_argument("--push", action="store_true",
|
||||
help="whether to push images to a registry after "
|
||||
"building")
|
||||
group.add_argument("regex", nargs='*',
|
||||
help="regular expression matching names of images "
|
||||
"to build. Builds all images if unspecified")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -216,6 +219,9 @@ class SeedContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||
playbooks = _build_playbook_list(
|
||||
"kolla-build", "container-image-build")
|
||||
extra_vars = {"push_images": parsed_args.push}
|
||||
if parsed_args.regex:
|
||||
regexes = " ".join(parsed_args.regex)
|
||||
extra_vars["container_image_regexes"] = regexes
|
||||
ansible.run_playbooks(parsed_args, playbooks, limit="seed",
|
||||
extra_vars=extra_vars)
|
||||
|
||||
@ -302,7 +308,7 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
|
||||
self.app.LOG.debug("Deploying overcloud services")
|
||||
playbooks = _build_playbook_list("kolla-openstack", "swift-setup")
|
||||
ansible.run_playbooks(parsed_args, playbooks)
|
||||
for command in ["pull", "prechecks", "deploy"]:
|
||||
for command in ["prechecks", "deploy"]:
|
||||
kolla_ansible.run_overcloud(parsed_args, command)
|
||||
# FIXME: Fudge to work around incorrect configuration path.
|
||||
extra_vars = {"node_config_directory": parsed_args.kolla_config_path}
|
||||
@ -310,6 +316,14 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudContainerImagePull(KollaAnsibleMixin, Command):
|
||||
"""Pull the overcloud container images from a registry."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Pulling overcloud container images")
|
||||
kolla_ansible.run_overcloud(parsed_args, "pull")
|
||||
|
||||
|
||||
class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||
"""Build the overcloud container images."""
|
||||
|
||||
@ -320,6 +334,9 @@ class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||
group.add_argument("--push", action="store_true",
|
||||
help="whether to push images to a registry after "
|
||||
"building")
|
||||
group.add_argument("regex", nargs='*',
|
||||
help="regular expression matching names of images "
|
||||
"to build. Builds all images if unspecified")
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -327,5 +344,20 @@ class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||
playbooks = _build_playbook_list(
|
||||
"kolla-build", "container-image-build")
|
||||
extra_vars = {"push_images": parsed_args.push}
|
||||
if parsed_args.regex:
|
||||
regexes = " ".join(parsed_args.regex)
|
||||
extra_vars["container_image_regexes"] = regexes
|
||||
ansible.run_playbooks(parsed_args, playbooks, limit="controllers",
|
||||
extra_vars=extra_vars)
|
||||
|
||||
|
||||
class OvercloudPostConfigure(KayobeAnsibleMixin, Command):
|
||||
"""Perform post-deployment configuration."""
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.app.LOG.debug("Performing post-deployment configuration")
|
||||
playbooks = _build_playbook_list(
|
||||
"ipa-images", "overcloud-introspection-rules",
|
||||
"overcloud-introspection-rules-dell-lldp-workaround",
|
||||
"provision-net")
|
||||
ansible.run_playbooks(parsed_args, playbooks)
|
||||
|
@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import six
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
@ -83,5 +84,9 @@ def run_command(cmd, quiet=False, **kwargs):
|
||||
if quiet:
|
||||
kwargs["stdout"] = subprocess.PIPE
|
||||
kwargs["stderr"] = subprocess.PIPE
|
||||
LOG.debug("Running command: %s", " ".join(cmd))
|
||||
if isinstance(cmd, six.string_types):
|
||||
cmd_string = cmd
|
||||
else:
|
||||
cmd_string = " ".join(cmd)
|
||||
LOG.debug("Running command: %s", cmd_string)
|
||||
subprocess.check_call(cmd, **kwargs)
|
||||
|
4
setup.py
4
setup.py
@ -40,11 +40,13 @@ setup(
|
||||
'configuration_dump = kayobe.cli.commands:ConfigurationDump',
|
||||
'kolla_ansible_run = kayobe.cli.commands:KollaAnsibleRun',
|
||||
'overcloud_container_image_build = kayobe.cli.commands:OvercloudContainerImageBuild',
|
||||
'overcloud_container_image_pull = kayobe.cli.commands:OvercloudContainerImagePull',
|
||||
'overcloud_deprovision = kayobe.cli.commands:OvercloudDeprovision',
|
||||
'overcloud_host_configure = kayobe.cli.commands:OvercloudHostConfigure',
|
||||
'overcloud_inventory_discover = kayobe.cli.commands:OvercloudInventoryDiscover',
|
||||
'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy',
|
||||
'overcloud_post_configure = kayobe.cli.commands:OvercloudPostConfigure',
|
||||
'overcloud_provision = kayobe.cli.commands:OvercloudProvision',
|
||||
'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy',
|
||||
'physical_network_configure = kayobe.cli.commands:PhysicalNetworkConfigure',
|
||||
'playbook_run = kayobe.cli.commands:PlaybookRun',
|
||||
'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild',
|
||||
|
Loading…
Reference in New Issue
Block a user