Add namespace option to OpenStack test script

This is required for kubectl call inside this script.
It's useful to properly run OpenStack tests on envs deployed in non-standard
K8s namespaces (which is the case for multiple deployment script).

Change-Id: Ia0076f881ca3d350e539bb4dd5d10f20484d8577
This commit is contained in:
Marek Zawadzki 2016-10-26 12:12:31 +02:00
parent 084aad72a1
commit 59bc9b0013
2 changed files with 14 additions and 9 deletions

View File

@ -56,9 +56,9 @@ function display_horizon_access_info {
}
function run_openstack_tests {
source $1
./tools/deploy-test-vms.sh -a create
./tools/deploy-test-vms.sh -a destroy
source openrc-$1
./tools/deploy-test-vms.sh -k $1 -a create
./tools/deploy-test-vms.sh -k $1 -a destroy
}
@ -116,6 +116,6 @@ for n in $(seq 1 ${NUMBER_OF_ENVS}); do
${CCP} deploy
ccp_wait_for_deployment_to_finish ${NAMESPACE_PREFIX}-${n}
display_horizon_access_info ${NAMESPACE_PREFIX}-${n}
run_openstack_tests openrc-${NAMESPACE_PREFIX}-${n}
echo "CCP cleanup command: ccp --debug --config-file ${CONFIG_DIR}/ccp-cli-${VERSION}-config-${n} cleanup"
run_openstack_tests ${NAMESPACE_PREFIX}-${n}
echo "CCP cleanup command: ccp --verbose --debug --config-file ${CONFIG_DIR}/ccp-cli-${VERSION}-config-${n} cleanup"
done

View File

@ -11,8 +11,9 @@ usage() {
-h Prints this help
-a Required action. Choise from "create" and "destroy"
-c Calico networking insted of OVS
-n Number of VMs to spawn. (optional)
-i Public eth iface. (optional)
-n Number of VMs to spawn (optional)
-i Public eth iface (optional)
-k Kubernetes namespace (optional)
EOF
}
@ -48,7 +49,8 @@ create() {
exit 1
fi
EXTIP="`ifconfig $IFACE | grep -Po 'addr:\d+\.\d+\.\d+\.\d+' | awk -F':' '{print $NF}'`"
VNCP="`kubectl get svc nova-novncproxy -o yaml | awk '/nodePort/ {print $NF}'`"
[ -n "${K8S_NAMESPACE}" ] && KUBECTL_OPTION="--namespace ${K8S_NAMESPACE}"
VNCP="`kubectl ${KUBECTL_OPTION} get svc nova-novncproxy -o yaml | awk '/nodePort/ {print $NF}'`"
if [ "$CALICO" == "True" ]; then
openstack network create --provider-network-type local testnetwork
@ -82,7 +84,7 @@ destroy() {
openstack image delete cirros
}
while getopts ":a:n:i:hc" opt; do
while getopts ":a:n:i:k:hc" opt; do
case $opt in
a)
ACTION="$OPTARG"
@ -96,6 +98,9 @@ while getopts ":a:n:i:hc" opt; do
i)
IFACE="$OPTARG"
;;
k)
K8S_NAMESPACE="$OPTARG"
;;
h)
usage
exit 1