Update Istio installation
@@ -146,6 +146,25 @@ function wait_until_pods_running() {
return 1
}
+# Waits until all batch job pods are running in the given namespace.
+# Parameters: $1 - namespace.
+function wait_until_batch_job_complete() {
+ echo -n "Waiting until all batch job pods in namespace $1 run to completion."
+ for i in {1..150}; do # timeout after 5 minutes
+ local pods="$(kubectl get pods --selector=job-name --no-headers -n $1 2>/dev/null | grep -v '^[[:space:]]*$')"
+ # All pods must be complete
+ local not_complete=$(echo "${pods}" | grep -v Completed | wc -l)
+ if [[ ${not_complete} -eq 0 ]]; then
+ echo -e "\nAll pods are complete:\n${pods}"
+ return 0
+ fi
+ echo -n "."
+ sleep 2
+ done
+ echo -e "\n\nERROR: timeout waiting for pods to complete\n${pods}"
+ return 1
+}
+
# Waits until the given service has an external address (IP/hostname).
# Parameters: $1 - namespace.
# $2 - service name.
@@ -302,8 +321,9 @@ function report_go_test() {
function start_latest_knative_serving() {
header "Starting Knative Serving"
subheader "Installing Istio"
- echo "Installing Istio CRD from ${KNATIVE_ISTIO_CRD_YAML}"
+ echo "Running Istio CRD from ${KNATIVE_ISTIO_CRD_YAML}"
kubectl apply -f ${KNATIVE_ISTIO_CRD_YAML} || return 1
+ wait_until_batch_job_complete istio-system || return 1
echo "Installing Istio from ${KNATIVE_ISTIO_YAML}"
kubectl apply -f ${KNATIVE_ISTIO_YAML} || return 1
wait_until_pods_running istio-system || return 1
