Add alternative tenks deploy and teardown entrypoints.

Allows users to explicitly specify which type of tenks
deployment they wish to create / destroy.
Preserves existing behaviour with defaults.
Modifies Zuul tests to use new tenks-deploy entrypoints.

Change-Id: I9aafed8481fd7564c0fc0abe5f6b21eceb824d75
This commit is contained in:
Isaac Prior 2019-06-05 10:51:07 +01:00
parent 17d63c8b99
commit 0d598bf01d
8 changed files with 142 additions and 18 deletions

View File

@ -431,17 +431,35 @@ function run_tenks_playbook {
# $2: The name of the playbook to run.
local tenks_path="$1"
local tenks_playbook="$2"
local tenks_deploy_type="${3:-default}"
local parent="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" ]]; then
# Overcloud
if [[ ! -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" &&
"${tenks_deploy_type}" = "compute" ]]; then
die $LINENO "Missing admin-openrc.sh & tenks_deploy_type is compute."
exit 1
fi
if [[ -f "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh" &&
( "${tenks_deploy_type}" = "default" ||
"${tenks_deploy_type}" = "compute" ) ]]; then
# Deploys Compute from Overcloud
default_tenks_config=tenks-deploy-config-compute.yml
source "${KOLLA_CONFIG_PATH:-/etc/kolla}/admin-openrc.sh"
else
# Seed
elif [[ "${tenks_deploy_type}" = "default" ||
"${tenks_deploy_type}" = "overcloud" ]]; then
# Deploys Overcloud from Seed
default_tenks_config=tenks-deploy-config-overcloud.yml
write_bifrost_clouds_yaml
export OS_CLOUD=bifrost
else
die $LINENO "Bad tenks_deploy_type: ${tenks_deploy_type}"
exit 1
fi
# Allow a specific Tenks config file to be specified via
@ -461,6 +479,7 @@ function tenks_deploy {
# 'breth1' exists. Arguments:
# $1: The path to the Tenks repo.
local tenks_path="$1"
local tenks_deploy_type="${2:-default}"
echo "Configuring Tenks"
@ -483,7 +502,7 @@ function tenks_deploy {
# vSwitch.
sudo cp --no-clobber "$parent/ovs-vsctl" /usr/bin/ovs-vsctl
run_tenks_playbook "$tenks_path" deploy.yml
run_tenks_playbook "$tenks_path" deploy.yml "$tenks_deploy_type"
}
function tenks_teardown {
@ -492,6 +511,7 @@ function tenks_teardown {
# Arguments:
# $1: The path to the Tenks repo.
local tenks_path="$1"
local tenks_deploy_type="${2:-default}"
echo "Tearing down Tenks"
@ -503,7 +523,7 @@ function tenks_teardown {
# Source the Tenks venv.
source ${TENKS_VENV_PATH:-$HOME/tenks-test-venv}/bin/activate
run_tenks_playbook "$tenks_path" teardown.yml
run_tenks_playbook "$tenks_path" teardown.yml "$tenks_deploy_type"
}
# General purpose

26
dev/tenks-deploy-compute.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eu
set -o pipefail
# Simple script to configure and deploy a Tenks cluster. This should be
# executed from within the VM. Arguments:
# $1: The path to the Tenks repo.
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${PARENT}/functions"
function main {
if [ -z ${1+x} ]; then
echo "Usage: $0 <tenks repo path>"
return 1
fi
tenks_path="$1"
config_init
tenks_deploy "$tenks_path" compute
}
main "$@"

26
dev/tenks-deploy-overcloud.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eu
set -o pipefail
# Simple script to configure and deploy a Tenks cluster. This should be
# executed from within the VM. Arguments:
# $1: The path to the Tenks repo.
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${PARENT}/functions"
function main {
if [ -z ${1+x} ]; then
echo "Usage: $0 <tenks repo path>"
return 1
fi
tenks_path="$1"
config_init
tenks_deploy "$tenks_path" overcloud
}
main "$@"

26
dev/tenks-teardown-compute.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eu
set -o pipefail
# Simple script to teardown a Tenks cluster. This should be executed from
# within the VM. Arguments:
# $1: The path to the Tenks repo.
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${PARENT}/functions"
function main {
if [ -z ${1+x} ]; then
echo "Usage: $0 <tenks repo path>"
return 1
fi
tenks_path="$1"
config_init
tenks_teardown "$tenks_path" compute
}
main "$@"

26
dev/tenks-teardown-overcloud.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
set -eu
set -o pipefail
# Simple script to teardown a Tenks cluster. This should be executed from
# within the VM. Arguments:
# $1: The path to the Tenks repo.
PARENT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${PARENT}/functions"
function main {
if [ -z ${1+x} ]; then
echo "Usage: $0 <tenks repo path>"
return 1
fi
tenks_path="$1"
config_init
tenks_teardown "$tenks_path" overcloud
}
main "$@"

View File

@ -131,9 +131,9 @@ Clone the tenks repository::
Optionally, edit the Tenks configuration file,
``dev/tenks-deploy-config-compute.yml``.
Run the ``dev/tenks-deploy.sh`` script to deploy Tenks::
Run the ``dev/tenks-deploy-compute.sh`` script to deploy Tenks::
./dev/tenks-deploy.sh ./tenks
./dev/tenks-deploy-compute.sh ./tenks
Check that Tenks has created VMs called ``tk0`` and ``tk1``::
@ -151,9 +151,9 @@ server instance, and delete it once it becomes active::
./dev/overcloud-test-baremetal.sh
The machines and networking created by Tenks can be cleaned up via
``dev/tenks-teardown.sh``::
``dev/tenks-teardown-compute.sh``::
./dev/tenks-teardown.sh ./tenks
./dev/tenks-teardown-compute.sh ./tenks
Upgrading
---------
@ -233,9 +233,9 @@ Clone the tenks repository::
Optionally, edit the Tenks configuration file,
``dev/tenks-deploy-config-overcloud.yml``.
Run the ``dev/tenks-deploy.sh`` script to deploy Tenks::
Run the ``dev/tenks-deploy-overcloud.sh`` script to deploy Tenks::
./dev/tenks-deploy.sh ./tenks
./dev/tenks-deploy-overcloud.sh ./tenks
Check that Tenks has created a VM called ``controller0``::
@ -246,9 +246,9 @@ Verify that VirtualBMC is running::
~/tenks-venv/bin/vbmc list
The machines and networking created by Tenks can be cleaned up via
``dev/tenks-teardown.sh``::
``dev/tenks-teardown-overcloud.sh``::
./dev/tenks-teardown.sh ./tenks
./dev/tenks-teardown-overcloud.sh ./tenks
.. _development-automated-seed-hypervisor:

View File

@ -11,7 +11,7 @@
shell:
# Pass absolute source directory, since otherwise the `chdir` will
# cause this to fail.
cmd: dev/tenks-deploy.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy
cmd: dev/tenks-deploy-compute.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy
chdir: "{{ kayobe_src_dir }}"
- name: Perform testing of the virtualized machines

View File

@ -27,9 +27,9 @@
- name: Ensure test Tenks cluster is deployed
shell:
# Pass absolute source directory, since otherwise the `chdir` will
# cause this to fail. Don't use previous_kayobe_source_dir as tenks-deploy.sh
# does not exist there.
cmd: dev/tenks-deploy.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy
# cause this to fail. Don't use previous_kayobe_source_dir as
# tenks-deploy-compute.sh does not exist there.
cmd: dev/tenks-deploy-compute.sh '{{ tenks_src_dir }}' > {{ logs_dir }}/ansible/tenks-deploy
chdir: "{{ kayobe_src_dir }}"
environment: