Make hard-coded busybox image configurable

The image used to test kubectl logs in the validation scripts was hard
coded and is now configurable.

This also makes the power-up-node.sh gate script more robust by making
it wait for the node to be ready.

Change-Id: I531ca8477ac3575dd4249ab5e991881af290fa52
This commit is contained in:
Mark Burnett 2018-06-27 16:54:51 -05:00
parent 0d75314699
commit 44fb6db261
6 changed files with 61 additions and 3 deletions

View File

@ -75,4 +75,7 @@ data:
required: required:
docker: docker-engine=1.13.1-0~ubuntu-xenial docker: docker-engine=1.13.1-0~ubuntu-xenial
socat: socat=1.7.3.1-1 socat: socat=1.7.3.1-1
validation:
pod_logs:
image: busybox:1.28.3
... ...

View File

@ -131,6 +131,17 @@ data:
- required - required
additionalProperties: false additionalProperties: false
validation:
type: object
properties:
pod_logs:
type: object
properties:
image:
type: string
additionalProperties: false
additionalProperties: false
required: required:
- images - images
- packages - packages

View File

@ -234,7 +234,7 @@ spec:
kubernetes.io/hostname: ${NODE} kubernetes.io/hostname: ${NODE}
containers: containers:
- name: noisy - name: noisy
image: busybox:1.28.3 image: {{ config.get_path('HostSystem:validation.pod_logs.image', default='busybox:1.28.3') }}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
command: command:
- /bin/echo - /bin/echo

View File

@ -42,3 +42,33 @@ kubectl_wait_for_pod() {
fi fi
done done
} }
kubectl_wait_for_node_ready() {
set +x
VIA=${1}
NODE_NAME=${2}
SEC=${3:-300}
log Waiting $SEC seconds for $NODE_NAME to be ready.
NODE_READY_JSONPATH='{.status.conditions[?(@.type=="Ready")].status}'
end=$(($(date +%s) + $SEC))
while true; do
if (kubectl_cmd "${VIA}" --request-timeout 10s get nodes $NODE_NAME -o jsonpath="${NODE_READY_JSONPATH}" | grep True) ; then
log Node $NODE_NAME is ready.
break
else
now=$(date +%s)
if [ $now -gt $end ]; then
log Node $NODE_NAME was not ready before timeout.
fail
fi
echo -n .
sleep 15
fi
done
set -x
}

View File

@ -102,7 +102,9 @@
"name": "Power up n2", "name": "Power up n2",
"script": "power-up-node.sh", "script": "power-up-node.sh",
"arguments": [ "arguments": [
"-n", "n2" "-v", "n0",
"-n", "n2",
"-w", "120"
] ]
}, },
{ {

View File

@ -6,11 +6,19 @@ source "${GATE_UTILS}"
declare -a NODES declare -a NODES
while getopts "n:s" opt; do WAIT=60
while getopts "n:v:w:s" opt; do
case "${opt}" in case "${opt}" in
n) n)
NODES+=("${OPTARG}") NODES+=("${OPTARG}")
;; ;;
v)
VIA="${OPTARG}"
;;
w)
WAIT="${OPTARG}"
;;
*) *)
echo "Unknown option" echo "Unknown option"
exit 1 exit 1
@ -22,3 +30,7 @@ shift $((OPTIND-1))
for node in "${NODES[@]}"; do for node in "${NODES[@]}"; do
vm_start "${node}" vm_start "${node}"
done done
for node in "${NODES[@]}"; do
kubectl_wait_for_node_ready "${VIA}" "${node}" "${WAIT}"
done