4624804f80
- Create a site definition to support a full site deployment workflow using VMs Multi-Nodes Gate Enable multi-node gate for Airship using core Airship components. Deployment will be driven by Shipyard. We will re-use and adapt the source codes from the Promenade g2 Gate [1]. [1] https://github.com/openstack/airship-promenade/tree/master/tools/g2 Change-Id: I41e79f5f26311fa179a2e5c121aa815caa05cfcd
45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
kubectl_apply() {
|
|
VIA=${1}
|
|
FILE=${2}
|
|
ssh_cmd "${VIA}" "cat ${FILE} | kubectl apply -f -"
|
|
}
|
|
|
|
kubectl_cmd() {
|
|
VIA=${1}
|
|
|
|
shift
|
|
|
|
ssh_cmd "${VIA}" kubectl "${@}"
|
|
}
|
|
|
|
kubectl_wait_for_pod() {
|
|
VIA=${1}
|
|
NAMESPACE=${2}
|
|
POD_NAME=${3}
|
|
SEC=${4:-600}
|
|
log Waiting "${SEC}" seconds for termination of pod "${POD_NAME}"
|
|
|
|
POD_PHASE_JSONPATH='{.status.phase}'
|
|
|
|
end=$(($(date +%s) + SEC))
|
|
while true; do
|
|
POD_PHASE=$(kubectl_cmd "${VIA}" --request-timeout 10s --namespace "${NAMESPACE}" get -o jsonpath="${POD_PHASE_JSONPATH}" pod "${POD_NAME}")
|
|
if [[ ${POD_PHASE} = "Succeeded" ]]; then
|
|
log Pod "${POD_NAME}" succeeded.
|
|
break
|
|
elif [[ $POD_PHASE = "Failed" ]]; then
|
|
log Pod "${POD_NAME}" failed.
|
|
kubectl_cmd "${VIA}" --request-timeout 10s --namespace "${NAMESPACE}" get -o yaml pod "${POD_NAME}" 1>&2
|
|
exit 1
|
|
else
|
|
now=$(date +%s)
|
|
if [[ $now -gt $end ]]; then
|
|
log Pod did not terminate before timeout.
|
|
kubectl_cmd "${VIA}" --request-timeout 10s --namespace "${NAMESPACE}" get -o yaml pod "${POD_NAME}" 1>&2
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
fi
|
|
done
|
|
}
|