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:
|
vars:
|
||||||
# Set this to True to push images to the registry when built.
|
# Set this to True to push images to the registry when built.
|
||||||
push_images: False
|
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_venv: "{{ ansible_env['PWD'] }}/kolla-venv"
|
||||||
kolla_build_log_path: "/var/log/kolla-build.log"
|
kolla_build_log_path: "/var/log/kolla-build.log"
|
||||||
tasks:
|
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
|
- name: Display the regexes for container images that will be built
|
||||||
debug:
|
debug:
|
||||||
msg: >
|
msg: >
|
||||||
|
@ -209,6 +209,9 @@ class SeedContainerImageBuild(KayobeAnsibleMixin, Command):
|
|||||||
group.add_argument("--push", action="store_true",
|
group.add_argument("--push", action="store_true",
|
||||||
help="whether to push images to a registry after "
|
help="whether to push images to a registry after "
|
||||||
"building")
|
"building")
|
||||||
|
group.add_argument("regex", nargs='*',
|
||||||
|
help="regular expression matching names of images "
|
||||||
|
"to build. Builds all images if unspecified")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -216,6 +219,9 @@ class SeedContainerImageBuild(KayobeAnsibleMixin, Command):
|
|||||||
playbooks = _build_playbook_list(
|
playbooks = _build_playbook_list(
|
||||||
"kolla-build", "container-image-build")
|
"kolla-build", "container-image-build")
|
||||||
extra_vars = {"push_images": parsed_args.push}
|
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",
|
ansible.run_playbooks(parsed_args, playbooks, limit="seed",
|
||||||
extra_vars=extra_vars)
|
extra_vars=extra_vars)
|
||||||
|
|
||||||
@ -302,7 +308,7 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
|
|||||||
self.app.LOG.debug("Deploying overcloud services")
|
self.app.LOG.debug("Deploying overcloud services")
|
||||||
playbooks = _build_playbook_list("kolla-openstack", "swift-setup")
|
playbooks = _build_playbook_list("kolla-openstack", "swift-setup")
|
||||||
ansible.run_playbooks(parsed_args, playbooks)
|
ansible.run_playbooks(parsed_args, playbooks)
|
||||||
for command in ["pull", "prechecks", "deploy"]:
|
for command in ["prechecks", "deploy"]:
|
||||||
kolla_ansible.run_overcloud(parsed_args, command)
|
kolla_ansible.run_overcloud(parsed_args, command)
|
||||||
# FIXME: Fudge to work around incorrect configuration path.
|
# FIXME: Fudge to work around incorrect configuration path.
|
||||||
extra_vars = {"node_config_directory": parsed_args.kolla_config_path}
|
extra_vars = {"node_config_directory": parsed_args.kolla_config_path}
|
||||||
@ -310,6 +316,14 @@ class OvercloudServiceDeploy(KollaAnsibleMixin, KayobeAnsibleMixin, Command):
|
|||||||
extra_vars=extra_vars)
|
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):
|
class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
||||||
"""Build the overcloud container images."""
|
"""Build the overcloud container images."""
|
||||||
|
|
||||||
@ -320,6 +334,9 @@ class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
|||||||
group.add_argument("--push", action="store_true",
|
group.add_argument("--push", action="store_true",
|
||||||
help="whether to push images to a registry after "
|
help="whether to push images to a registry after "
|
||||||
"building")
|
"building")
|
||||||
|
group.add_argument("regex", nargs='*',
|
||||||
|
help="regular expression matching names of images "
|
||||||
|
"to build. Builds all images if unspecified")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -327,5 +344,20 @@ class OvercloudContainerImageBuild(KayobeAnsibleMixin, Command):
|
|||||||
playbooks = _build_playbook_list(
|
playbooks = _build_playbook_list(
|
||||||
"kolla-build", "container-image-build")
|
"kolla-build", "container-image-build")
|
||||||
extra_vars = {"push_images": parsed_args.push}
|
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",
|
ansible.run_playbooks(parsed_args, playbooks, limit="controllers",
|
||||||
extra_vars=extra_vars)
|
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 logging
|
||||||
import os
|
import os
|
||||||
|
import six
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -83,5 +84,9 @@ def run_command(cmd, quiet=False, **kwargs):
|
|||||||
if quiet:
|
if quiet:
|
||||||
kwargs["stdout"] = subprocess.PIPE
|
kwargs["stdout"] = subprocess.PIPE
|
||||||
kwargs["stderr"] = 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)
|
subprocess.check_call(cmd, **kwargs)
|
||||||
|
4
setup.py
4
setup.py
@ -40,11 +40,13 @@ setup(
|
|||||||
'configuration_dump = kayobe.cli.commands:ConfigurationDump',
|
'configuration_dump = kayobe.cli.commands:ConfigurationDump',
|
||||||
'kolla_ansible_run = kayobe.cli.commands:KollaAnsibleRun',
|
'kolla_ansible_run = kayobe.cli.commands:KollaAnsibleRun',
|
||||||
'overcloud_container_image_build = kayobe.cli.commands:OvercloudContainerImageBuild',
|
'overcloud_container_image_build = kayobe.cli.commands:OvercloudContainerImageBuild',
|
||||||
|
'overcloud_container_image_pull = kayobe.cli.commands:OvercloudContainerImagePull',
|
||||||
'overcloud_deprovision = kayobe.cli.commands:OvercloudDeprovision',
|
'overcloud_deprovision = kayobe.cli.commands:OvercloudDeprovision',
|
||||||
'overcloud_host_configure = kayobe.cli.commands:OvercloudHostConfigure',
|
'overcloud_host_configure = kayobe.cli.commands:OvercloudHostConfigure',
|
||||||
'overcloud_inventory_discover = kayobe.cli.commands:OvercloudInventoryDiscover',
|
'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_provision = kayobe.cli.commands:OvercloudProvision',
|
||||||
|
'overcloud_service_deploy = kayobe.cli.commands:OvercloudServiceDeploy',
|
||||||
'physical_network_configure = kayobe.cli.commands:PhysicalNetworkConfigure',
|
'physical_network_configure = kayobe.cli.commands:PhysicalNetworkConfigure',
|
||||||
'playbook_run = kayobe.cli.commands:PlaybookRun',
|
'playbook_run = kayobe.cli.commands:PlaybookRun',
|
||||||
'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild',
|
'seed_container_image_build = kayobe.cli.commands:SeedContainerImageBuild',
|
||||||
|
Loading…
Reference in New Issue
Block a user