7853db4f36
* Last AIAB commit ID: d7d345f * Also moving from Quagga to FRRouting for bgp router script. * Synced the recent changes in aiab and removed the frrouting change which is still open in aiab Change-Id: If5e4e030dacaa7fcf525f9767f50c82b07516e27
48 lines
1.3 KiB
Bash
48 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
kubectl_apply() {
|
|
VIA=${1}
|
|
FILE=${2}
|
|
ssh_cmd_raw "${VIA}" "KUBECONFIG=${KUBECONFIG}" "cat ${FILE} | kubectl apply -f -"
|
|
}
|
|
|
|
kubectl_cmd() {
|
|
VIA=${1}
|
|
|
|
shift
|
|
|
|
ssh_cmd_raw "${VIA}" "KUBECONFIG=${KUBECONFIG}" 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
|
|
}
|