Add a job for seed deployment

Adds a new CI job, kayobe-seed-centos, that deploys a single VM as a
seed host. The VM provided by Zuul is configured as the seed, rather
than a seed hypervisor that provisions a seed VM using nested virt.

This approach should be more reliable, faster, and easier to get
working, at the expense of not testing the seed hypervisor code paths.

Currently the seed services are deployed, but not tested. A future
change could test discovery and provisioning of an overcloud host using
the seed.

Change-Id: Iefe16215af6f1a9fb8ec78094cd6bd76a82a040a
Story: 2001655
Task: 6683
This commit is contained in:
Mark Goddard 2018-03-16 12:26:18 +00:00
parent 7bdee9a21c
commit cd6c366cc6
13 changed files with 202 additions and 30 deletions

View File

@ -10,6 +10,9 @@
# Path to the kayobe virtual environment. # Path to the kayobe virtual environment.
#export KAYOBE_VENV_PATH=~/kayobe-venv #export KAYOBE_VENV_PATH=~/kayobe-venv
# Whether to provision a VM for the seed host.
#export KAYOBE_SEED_VM_PROVISION=1
# Whether to build container images for the seed services. If 0, they will be # Whether to build container images for the seed services. If 0, they will be
# pulled. # pulled.
#export KAYOBE_SEED_CONTAINER_IMAGE_BUILD=0 #export KAYOBE_SEED_CONTAINER_IMAGE_BUILD=0
@ -17,3 +20,6 @@
# Whether to build container images for the overcloud services. If 0, they will # Whether to build container images for the overcloud services. If 0, they will
# be pulled. # be pulled.
#export KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD=0 #export KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD=0
# Additional arguments to pass to kayobe commands.
#export KAYOBE_EXTRA_ARGS=

View File

@ -27,6 +27,9 @@ function config_defaults {
# Path to the kayobe virtual environment. # Path to the kayobe virtual environment.
export KAYOBE_VENV_PATH="${KAYOBE_VENV_PATH:-${HOME}/kayobe-venv}" export KAYOBE_VENV_PATH="${KAYOBE_VENV_PATH:-${HOME}/kayobe-venv}"
# Whether to provision a VM for the seed host.
export KAYOBE_SEED_VM_PROVISION=${KAYOBE_SEED_VM_PROVISION:-1}
# Whether to build container images for the seed services. If 0, they will # Whether to build container images for the seed services. If 0, they will
# be pulled. # be pulled.
export KAYOBE_SEED_CONTAINER_IMAGE_BUILD=${KAYOBE_SEED_CONTAINER_IMAGE_BUILD:-0} export KAYOBE_SEED_CONTAINER_IMAGE_BUILD=${KAYOBE_SEED_CONTAINER_IMAGE_BUILD:-0}
@ -34,6 +37,9 @@ function config_defaults {
# Whether to build container images for the overcloud services. If 0, they # Whether to build container images for the overcloud services. If 0, they
# will be pulled. # will be pulled.
export KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD=${KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD:-0} export KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD=${KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD:-0}
# Additional arguments to pass to kayobe commands.
export KAYOBE_EXTRA_ARGS=${KAYOBE_EXTRA_ARGS:-}
} }
function config_set { function config_set {
@ -115,15 +121,21 @@ function environment_setup {
cd "${KAYOBE_SOURCE_PATH}" cd "${KAYOBE_SOURCE_PATH}"
} }
function run_kayobe {
# Run a kayobe command, including extra arguments provided via
# $KAYOBE_EXTRA_ARGS.
kayobe ${KAYOBE_EXTRA_ARGS} $*
}
function seed_hypervisor_deploy { function seed_hypervisor_deploy {
# Deploy a seed hypervisor. # Deploy a seed hypervisor.
environment_setup environment_setup
echo "Bootstrapping the ansible control host" echo "Bootstrapping the ansible control host"
kayobe control host bootstrap run_kayobe control host bootstrap
echo "Configuring the seed hypervisor" echo "Configuring the seed hypervisor"
kayobe seed hypervisor host configure run_kayobe seed hypervisor host configure
} }
function seed_deploy { function seed_deploy {
@ -131,34 +143,36 @@ function seed_deploy {
environment_setup environment_setup
echo "Bootstrapping the ansible control host" echo "Bootstrapping the ansible control host"
kayobe control host bootstrap run_kayobe control host bootstrap
echo "Provisioning the seed VM" if [[ ${KAYOBE_SEED_VM_PROVISION} = 1 ]]; then
kayobe seed vm provision echo "Provisioning the seed VM"
run_kayobe seed vm provision
fi
echo "Configuring the seed host" echo "Configuring the seed host"
kayobe seed host configure run_kayobe seed host configure
# Note: This must currently be before host configure, because host # Note: This must currently be before host configure, because host
# configure runs kolla-ansible.yml, which validates the presence of the # configure runs kolla-ansible.yml, which validates the presence of the
# built deploy images. # built deploy images.
if is_deploy_image_built_locally; then if is_deploy_image_built_locally; then
echo "Building seed deployment images" echo "Building seed deployment images"
kayobe seed deployment image build run_kayobe seed deployment image build
else else
echo "Not building seed deployment images" echo "Not building seed deployment images"
fi fi
if [[ ${KAYOBE_SEED_CONTAINER_IMAGE_BUILD} = 1 ]]; then if [[ ${KAYOBE_SEED_CONTAINER_IMAGE_BUILD} = 1 ]]; then
echo "Building seed container images" echo "Building seed container images"
kayobe seed container image build run_kayobe seed container image build
else else
echo "Not pulling seed container images - no such command yet" echo "Not pulling seed container images - no such command yet"
#kayobe seed container image pull #run_kayobe seed container image pull
fi fi
echo "Deploying containerised seed services" echo "Deploying containerised seed services"
kayobe seed service deploy run_kayobe seed service deploy
} }
function overcloud_deploy { function overcloud_deploy {
@ -169,35 +183,35 @@ function overcloud_deploy {
environment_setup environment_setup
echo "Bootstrapping the ansible control host" echo "Bootstrapping the ansible control host"
kayobe control host bootstrap run_kayobe control host bootstrap
echo "Configuring the controller host" echo "Configuring the controller host"
kayobe overcloud host configure run_kayobe overcloud host configure
# Note: This must currently be before host configure, because host # Note: This must currently be before host configure, because host
# configure runs kolla-ansible.yml, which validates the presence of the # configure runs kolla-ansible.yml, which validates the presence of the
# built deploy images. # built deploy images.
if is_deploy_image_built_locally; then if is_deploy_image_built_locally; then
echo "Building overcloud deployment images" echo "Building overcloud deployment images"
kayobe overcloud deployment image build run_kayobe overcloud deployment image build
else else
echo "Not building overcloud deployment images" echo "Not building overcloud deployment images"
fi fi
if [[ ${KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD} = 1 ]]; then if [[ ${KAYOBE_OVERCLOUD_CONTAINER_IMAGE_BUILD} = 1 ]]; then
echo "Building overcloud container images" echo "Building overcloud container images"
kayobe overcloud container image build run_kayobe overcloud container image build
else else
echo "Pulling overcloud container images" echo "Pulling overcloud container images"
kayobe overcloud container image pull run_kayobe overcloud container image pull
fi fi
echo "Deploying containerised overcloud services" echo "Deploying containerised overcloud services"
kayobe overcloud service deploy run_kayobe overcloud service deploy
echo "Performing post-deployment configuration" echo "Performing post-deployment configuration"
source "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" source "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh"
kayobe overcloud post configure run_kayobe overcloud post configure
echo "Control plane deployment complete" echo "Control plane deployment complete"
} }

View File

@ -99,7 +99,10 @@ def _validate_args(parsed_args, playbooks):
def _get_vars_files(config_path): def _get_vars_files(config_path):
"""Return a list of Kayobe Ansible configuration variable files.""" """Return a list of Kayobe Ansible configuration variable files.
The files will be sorted alphabetically by name.
"""
vars_files = [] vars_files = []
for vars_file in os.listdir(config_path): for vars_file in os.listdir(config_path):
abs_path = os.path.join(config_path, vars_file) abs_path = os.path.join(config_path, vars_file)
@ -107,7 +110,7 @@ def _get_vars_files(config_path):
root, ext = os.path.splitext(vars_file) root, ext = os.path.splitext(vars_file)
if ext in (".yml", ".yaml", ".json"): if ext in (".yml", ".yaml", ".json"):
vars_files.append(abs_path) vars_files.append(abs_path)
return vars_files return sorted(vars_files)
def build_args(parsed_args, playbooks, def build_args(parsed_args, playbooks,

View File

@ -3,6 +3,7 @@
vars: vars:
logs_dir: "/tmp/logs" logs_dir: "/tmp/logs"
kayobe_src_dir: "{{ zuul.project.src_dir }}" kayobe_src_dir: "{{ zuul.project.src_dir }}"
kayobe_config_src_dir: "{{ kayobe_src_dir }}/config/src/kayobe-config"
roles: roles:
- role: kayobe-diagnostics - role: kayobe-diagnostics
kayobe_diagnostics_phase: "pre" kayobe_diagnostics_phase: "pre"
@ -31,18 +32,20 @@
- name: Ensure kayobe-config directory exists - name: Ensure kayobe-config directory exists
file: file:
path: "{{ kayobe_src_dir }}/config/src" path: "{{ kayobe_config_src_dir }}"
state: directory state: directory
- name: Ensure kayobe-config repository is cloned - name: Ensure kayobe-config repository is cloned
git: git:
repo: https://github.com/stackhpc/dev-kayobe-config repo: https://github.com/stackhpc/dev-kayobe-config
dest: "{{ kayobe_src_dir }}/config/src/kayobe-config" dest: "{{ kayobe_config_src_dir }}"
# NOTE(mgoddard): Use the name zz-overrides.yml to ensure this takes
# precedence over the standard config files.
- name: Ensure kayobe-config override config file exists - name: Ensure kayobe-config override config file exists
template: template:
src: overrides.yml.j2 src: overrides.yml.j2
dest: "{{ kayobe_src_dir }}/config/src/kayobe-config/etc/kayobe/overrides.yml" dest: "{{ kayobe_config_src_dir }}/etc/kayobe/zz-overrides.yml"
# NOTE(mgoddard): The kayobe dev config by default expects a bridge - # NOTE(mgoddard): The kayobe dev config by default expects a bridge -
# breth1 - to exist with an IP address of 192.168.33.3. # breth1 - to exist with an IP address of 192.168.33.3.

View File

@ -0,0 +1,7 @@
---
# Don't build an IPA deployment image, instead download upstream images.
create_ipa_image: false
download_ipa: true
# Don't build a disk image. It takes time and can be unreliable.
use_cirros: true

View File

@ -0,0 +1,14 @@
---
# NOTE(mgoddard): Don't reboot after disabling SELinux during CI testing, as
# Ansible is run directly on the controller.
disable_selinux_do_reboot: false
# NOTE(mgoddard): We're using a cirros image, which doesn't require the
# resolv.conf work around used for CentOS.
overcloud_host_image_workaround_resolv_enabled: false
# NOTE(mgoddard): Use a loopback-mounted LVM volume for docker storage since
# the overlay driver doesn't work with the ansible template module until
# ansible 2.4.0, and this is required by bifrost.
seed_lvm_group_data_disks:
- /dev/loop0

View File

@ -0,0 +1,7 @@
---
- hosts: all
roles:
- role: kayobe-diagnostics
kayobe_diagnostics_phase: "post"
kayobe_diagnostics_log_dir: "/tmp/logs"
kayobe_diagnostics_executor_log_dir: "{{ zuul.executor.log_root }}/{{ inventory_hostname }}"

View File

@ -0,0 +1,84 @@
---
- hosts: primary
vars:
logs_dir: "/tmp/logs"
kayobe_src_dir: "{{ zuul.project.src_dir }}"
kayobe_config_src_dir: "{{ kayobe_src_dir }}/config/src/kayobe-config"
roles:
- role: kayobe-diagnostics
kayobe_diagnostics_phase: "pre"
kayobe_diagnostics_log_dir: "{{ logs_dir }}"
tasks:
- name: Install dbus for debian system
apt:
name: dbus
when:
- ansible_os_family == 'Debian'
become: true
- block:
# NOTE(mgoddard): The CentOS image used in CI has epel-release installed,
# but the configure-mirrors role used by Zuul disables epel. Since we
# install epel-release and expect epel to be enabled, enable it here.
- name: Ensure yum-utils is installed
yum:
name: yum-utils
state: installed
- name: Enable the EPEL yum repository
command: yum-config-manager --enable epel
when: ansible_os_family == 'RedHat'
become: true
- name: Ensure kayobe-config directory exists
file:
path: "{{ kayobe_config_src_dir }}"
state: directory
- name: Ensure kayobe-config repository is cloned
git:
repo: https://github.com/stackhpc/dev-kayobe-config
dest: "{{ kayobe_config_src_dir }}"
# NOTE(mgoddard): Use the name zz-overrides.yml to ensure this takes
# precedence over the standard config files.
- name: Ensure kayobe-config override config file exists
template:
src: overrides.yml.j2
dest: "{{ kayobe_config_src_dir }}/etc/kayobe/zz-overrides.yml"
- name: Ensure bifrost overrides directory exists
file:
path: "{{ kayobe_config_src_dir }}/etc/kayobe/kolla/config/bifrost"
state: "directory"
- name: Ensure bifrost overrides file exists
template:
src: bifrost-overrides.yml.j2
dest: "{{ kayobe_config_src_dir }}/etc/kayobe/kolla/config/bifrost/bifrost.yml"
# NOTE(mgoddard): Create a loopback device backed by a file for docker
# storage. We do this since the overlay driver doesn't work with the
# ansible template module until ansible 2.4.0, and this is required by
# bifrost.
- name: Ensure a docker storage backing file exists
command: truncate -s 20G /tmp/docker-storage
- name: Ensure the docker storage loopback device is created
command: losetup /dev/loop0 /tmp/docker-storage
become: true
# NOTE(mgoddard): The kayobe dev config by default expects a bridge -
# breth1 - to exist on the seed with an IP address of 192.168.33.5.
- name: Ensure all-in-one network bridge interface exists
command: "{{ item }}"
become: true
with_items:
- "ip l add breth1 type bridge"
- "ip l set breth1 up"
- "ip a add 192.168.33.5/24 dev breth1"
- name: Ensure kayobe is installed
shell:
cmd: dev/install.sh > {{ logs_dir }}/ansible/install
chdir: "{{ kayobe_src_dir }}"

View File

@ -0,0 +1,13 @@
---
- hosts: primary
vars:
kayobe_src_dir: "{{ zuul.project.src_dir }}"
logs_dir: "/tmp/logs"
tasks:
- name: Ensure seed is deployed
shell:
cmd: dev/seed-deploy.sh > {{ logs_dir }}/ansible/seed-deploy
chdir: "{{ kayobe_src_dir }}"
environment:
# Don't provision a seed VM - use the Zuul VM as the seed host.
KAYOBE_SEED_VM_PROVISION: 0

View File

@ -28,6 +28,8 @@ copy_logs() {
parted -l > ${LOG_DIR}/system_logs/parted-l.txt parted -l > ${LOG_DIR}/system_logs/parted-l.txt
mount > ${LOG_DIR}/system_logs/mount.txt mount > ${LOG_DIR}/system_logs/mount.txt
env > ${LOG_DIR}/system_logs/env.txt env > ${LOG_DIR}/system_logs/env.txt
ip address > ${LOG_DIR}/system_logs/ip-address.txt
ip route > ${LOG_DIR}/system_logs/ip-route.txt
if [ `command -v dpkg` ]; then if [ `command -v dpkg` ]; then
dpkg -l > ${LOG_DIR}/system_logs/dpkg-l.txt dpkg -l > ${LOG_DIR}/system_logs/dpkg-l.txt
@ -50,13 +52,6 @@ copy_logs() {
# logs.openstack.org clicking results in the browser shows the # logs.openstack.org clicking results in the browser shows the
# files, rather than trying to send it to another app or make you # files, rather than trying to send it to another app or make you
# download it, etc. # download it, etc.
# Rename files to .txt; this is so that when displayed via
# logs.openstack.org clicking results in the browser shows the
# files, rather than trying to send it to another app or make you
# download it, etc.
# Rename all .log files to .txt files
for f in $(find ${LOG_DIR}/{system_logs,kolla,docker_logs} -name "*.log"); do for f in $(find ${LOG_DIR}/{system_logs,kolla,docker_logs} -name "*.log"); do
mv $f ${f/.log/.txt} mv $f ${f/.log/.txt}
done done

View File

@ -16,6 +16,6 @@
- name: Download logs to executor - name: Download logs to executor
synchronize: synchronize:
src: "{{ kayobe_diagnostics_log_dir }}" src: "{{ kayobe_diagnostics_log_dir }}/"
dest: "{{ kayobe_diagnostics_executor_log_dir }}/" dest: "{{ kayobe_diagnostics_executor_log_dir }}/"
mode: pull mode: pull

View File

@ -16,6 +16,10 @@
# Base job for testing overcloud deployment. # Base job for testing overcloud deployment.
- job: - job:
name: kayobe-overcloud-base name: kayobe-overcloud-base
description: |
Base job for testing overcloud deployment.
Configures the primary VM as an overcloud controller.
pre-run: playbooks/kayobe-overcloud-base/pre.yml pre-run: playbooks/kayobe-overcloud-base/pre.yml
run: playbooks/kayobe-overcloud-base/run.yml run: playbooks/kayobe-overcloud-base/run.yml
post-run: playbooks/kayobe-overcloud-base/post.yml post-run: playbooks/kayobe-overcloud-base/post.yml
@ -29,3 +33,23 @@
name: kayobe-overcloud-centos name: kayobe-overcloud-centos
parent: kayobe-overcloud-base parent: kayobe-overcloud-base
nodeset: kayobe-centos nodeset: kayobe-centos
- job:
name: kayobe-seed-base
description: |
Base job for testing seed deployment.
Configures the primary VM as a seed.
pre-run: playbooks/kayobe-seed-base/pre.yml
run: playbooks/kayobe-seed-base/run.yml
post-run: playbooks/kayobe-seed-base/post.yml
attempts: 1
timeout: 5400
irrelevant-files:
- ^.*\.rst$
- ^doc/.*
- job:
name: kayobe-seed-centos
parent: kayobe-seed-base
nodeset: kayobe-centos

View File

@ -10,6 +10,7 @@
- kayobe-tox-ansible-syntax - kayobe-tox-ansible-syntax
- kayobe-tox-ansible - kayobe-tox-ansible
- kayobe-overcloud-centos - kayobe-overcloud-centos
- kayobe-seed-centos
gate: gate:
queue: kayobe queue: kayobe
@ -22,3 +23,4 @@
- kayobe-tox-ansible-syntax - kayobe-tox-ansible-syntax
- kayobe-tox-ansible - kayobe-tox-ansible
- kayobe-overcloud-centos - kayobe-overcloud-centos
- kayobe-seed-centos